WC_Widget_Price_Filter::__construct()
Constructor.
Method of the class: WC_Widget_Price_Filter{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Widget_Price_Filter = new WC_Widget_Price_Filter(); $WC_Widget_Price_Filter->__construct();
WC_Widget_Price_Filter::__construct() WC Widget Price Filter:: construct code WC 9.4.2
public function __construct() { $this->widget_cssclass = 'woocommerce widget_price_filter'; $this->widget_description = __( 'Display a slider to filter products in your store by price.', 'woocommerce' ); $this->widget_id = 'woocommerce_price_filter'; $this->widget_name = __( 'Filter Products by Price', 'woocommerce' ); $this->settings = array( 'title' => array( 'type' => 'text', 'std' => __( 'Filter by price', 'woocommerce' ), 'label' => __( 'Title', 'woocommerce' ), ), ); $suffix = Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min'; $version = Constants::get_constant( 'WC_VERSION' ); wp_register_script( 'accounting', WC()->plugin_url() . '/assets/js/accounting/accounting' . $suffix . '.js', array( 'jquery' ), '0.4.2', true ); wp_register_script( 'wc-jquery-ui-touchpunch', WC()->plugin_url() . '/assets/js/jquery-ui-touch-punch/jquery-ui-touch-punch' . $suffix . '.js', array( 'jquery-ui-slider' ), $version, true ); wp_register_script( 'wc-price-slider', WC()->plugin_url() . '/assets/js/frontend/price-slider' . $suffix . '.js', array( 'jquery-ui-slider', 'wc-jquery-ui-touchpunch', 'accounting' ), $version, true ); wp_localize_script( 'wc-price-slider', 'woocommerce_price_slider_params', array( 'currency_format_num_decimals' => 0, 'currency_format_symbol' => get_woocommerce_currency_symbol(), 'currency_format_decimal_sep' => esc_attr( wc_get_price_decimal_separator() ), 'currency_format_thousand_sep' => esc_attr( wc_get_price_thousand_separator() ), 'currency_format' => esc_attr( str_replace( array( '%1$s', '%2$s' ), array( '%s', '%v' ), get_woocommerce_price_format() ) ), ) ); if ( is_customize_preview() ) { wp_enqueue_script( 'wc-price-slider' ); } parent::__construct(); }