documents->is_document_type( 'single' ); } protected function _register_controls() { $css_scheme = apply_filters( 'jet-woo-builder/jet-single-price/css-scheme', array( 'price' => '.jet-woo-builder.elementor-jet-single-price .price', 'currency' => '.jet-woo-builder.elementor-jet-single-price .price .woocommerce-Price-currencySymbol', ) ); $this->start_controls_section( 'section_single_price_style', array( 'label' => esc_html__( 'Price', 'jet-woo-builder' ), 'tab' => Controls_Manager::TAB_STYLE, 'show_label' => false, ) ); $this->add_group_control( Group_Control_Typography::get_type(), array( 'name' => 'single_price_typography', 'selector' => '{{WRAPPER}} ' . $css_scheme['price'], ) ); $this->add_control( 'single_price_color', array( 'label' => esc_html__( 'Color', 'jet-woo-builder' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] => 'color: {{VALUE}}', ), ) ); $this->add_responsive_control( 'single_price_space_between', array( 'label' => esc_html__( 'Space Between Prices', 'jet-woo-builder' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 0, 'max' => 200, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' del+ins' => ! is_rtl() ? 'margin-left: {{SIZE}}{{UNIT}};' : 'margin-right: {{SIZE}}{{UNIT}};', ), ) ); $this->add_responsive_control( 'single_price_item_alignment', array( 'label' => esc_html__( 'Alignment', 'jet-woo-builder' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => array( 'left' => array( 'title' => esc_html__( 'Left', 'jet-woo-builder' ), 'icon' => 'eicon-text-align-left', ), 'center' => array( 'title' => esc_html__( 'Center', 'jet-woo-builder' ), 'icon' => 'eicon-text-align-center', ), 'right' => array( 'title' => esc_html__( 'Right', 'jet-woo-builder' ), 'icon' => 'eicon-text-align-right', ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] => 'text-align: {{VALUE}};', ), 'classes' => 'elementor-control-align', ) ); $this->start_controls_tabs( 'tabs_single_price_style' ); $this->start_controls_tab( 'tab_single_price_regular', array( 'label' => __( 'Regular', 'jet-woo-builder' ), ) ); $this->add_control( 'single_price_regular_color', array( 'label' => esc_html__( 'Color', 'jet-woo-builder' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' del' => 'color: {{VALUE}}', ), ) ); $this->add_control( 'single_price_regular_decoration', array( 'label' => esc_html__( 'Text Decoration', 'jet-woo-builder' ), 'type' => Controls_Manager::SELECT, 'default' => 'line-through', 'options' => array( 'none' => esc_html__( 'None', 'jet-woo-builder' ), 'line-through' => esc_html__( 'Line Through', 'jet-woo-builder' ), 'underline' => esc_html__( 'Underline', 'jet-woo-builder' ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' del' => 'text-decoration: {{VALUE}}', ), ) ); $this->add_responsive_control( 'single_price_regular_size', array( 'label' => esc_html__( 'Size', 'jet-woo-builder' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 6, 'max' => 90, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' del' => 'font-size: {{SIZE}}{{UNIT}};', ), ) ); $this->add_control( 'single_price_regular_weight', array( 'label' => esc_html__( 'Font Weight', 'jet-woo-builder' ), 'type' => Controls_Manager::SELECT, 'default' => '400', 'options' => array( '100' => esc_html__( '100', 'jet-woo-builder' ), '200' => esc_html__( '200', 'jet-woo-builder' ), '300' => esc_html__( '300', 'jet-woo-builder' ), '400' => esc_html__( '400', 'jet-woo-builder' ), '500' => esc_html__( '500', 'jet-woo-builder' ), '600' => esc_html__( '600', 'jet-woo-builder' ), '700' => esc_html__( '700', 'jet-woo-builder' ), '800' => esc_html__( '800', 'jet-woo-builder' ), '900' => esc_html__( '900', 'jet-woo-builder' ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' del' => 'font-weight: {{VALUE}}', ), ) ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_single_price_sale', array( 'label' => __( 'Sale', 'jet-woo-builder' ), ) ); $this->add_control( 'single_price_sale_color', array( 'label' => esc_html__( 'Color', 'jet-woo-builder' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' ins' => 'color: {{VALUE}}', ), ) ); $this->add_control( 'single_price_sale_decoration', array( 'label' => esc_html__( 'Text Decoration', 'jet-woo-builder' ), 'type' => Controls_Manager::SELECT, 'default' => 'none', 'options' => array( 'none' => esc_html__( 'None', 'jet-woo-builder' ), 'line-through' => esc_html__( 'Line Through', 'jet-woo-builder' ), 'underline' => esc_html__( 'Underline', 'jet-woo-builder' ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' ins' => 'text-decoration: {{VALUE}}', ), ) ); $this->add_responsive_control( 'single_price_sale_size', array( 'label' => esc_html__( 'Size', 'jet-woo-builder' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 6, 'max' => 90, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' ins' => 'font-size: {{SIZE}}{{UNIT}};', ), ) ); $this->add_control( 'single_price_sale_weight', array( 'label' => esc_html__( 'Font Weight', 'jet-woo-builder' ), 'type' => Controls_Manager::SELECT, 'default' => '400', 'options' => array( '100' => esc_html__( '100', 'jet-woo-builder' ), '200' => esc_html__( '200', 'jet-woo-builder' ), '300' => esc_html__( '300', 'jet-woo-builder' ), '400' => esc_html__( '400', 'jet-woo-builder' ), '500' => esc_html__( '500', 'jet-woo-builder' ), '600' => esc_html__( '600', 'jet-woo-builder' ), '700' => esc_html__( '700', 'jet-woo-builder' ), '800' => esc_html__( '800', 'jet-woo-builder' ), '900' => esc_html__( '900', 'jet-woo-builder' ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' ins' => 'font-weight: {{VALUE}}', ), ) ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_currency_sign_style', array( 'label' => esc_html__( 'Currency Sign', 'jet-woo-builder' ), 'tab' => Controls_Manager::TAB_STYLE, 'show_label' => false, ) ); $this->add_control( 'currency_sign_color', array( 'label' => esc_html__( 'Color', 'jet-woo-builder' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['currency'] => 'color: {{VALUE}}', ), ) ); $this->add_responsive_control( 'currency_sign_size', array( 'label' => esc_html__( 'Size', 'jet-woo-builder' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 6, 'max' => 90, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['currency'] => 'font-size: {{SIZE}}{{UNIT}};', ), ) ); $this->add_control( 'currency_sign_vertical_align', array( 'label' => esc_html__( 'Vertical Alignment', 'jet-woo-builder' ), 'type' => Controls_Manager::SELECT, 'options' => array( 'baseline' => esc_html__( 'Baseline', 'jet-woo-builder' ), 'top' => esc_html__( 'Top', 'jet-woo-builder' ), 'middle' => esc_html__( 'Middle', 'jet-woo-builder' ), 'bottom' => esc_html__( 'Bottom', 'jet-woo-builder' ), 'sub' => esc_html__( 'Sub', 'jet-woo-builder' ), 'super' => esc_html__( 'Super', 'jet-woo-builder' ), 'text-top' => esc_html__( 'Text Top', 'jet-woo-builder' ), 'text-bottom' => esc_html__( 'Text Bottom', 'jet-woo-builder' ), ), 'default' => 'baseline', 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['currency'] => 'vertical-align: {{VALUE}};', ), ) ); $this->start_controls_tabs( 'tabs_currency_sign_style' ); $this->start_controls_tab( 'tab_currency_sign_regular', array( 'label' => __( 'Regular', 'jet-woo-builder' ), ) ); $this->add_control( 'currency_sign_color_regular', array( 'label' => esc_html__( 'Color', 'jet-woo-builder' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' del .woocommerce-Price-currencySymbol' => 'color: {{VALUE}}', ), ) ); $this->add_responsive_control( 'currency_sign_size_regular', array( 'label' => esc_html__( 'Size', 'jet-woo-builder' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 6, 'max' => 90, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' del .woocommerce-Price-currencySymbol' => 'font-size: {{SIZE}}{{UNIT}};', ), ) ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_currency_sign_sale', array( 'label' => __( 'Sale', 'jet-woo-builder' ), ) ); $this->add_control( 'currency_sign_color_sale', array( 'label' => esc_html__( 'Color', 'jet-woo-builder' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' ins .woocommerce-Price-currencySymbol' => 'color: {{VALUE}}', ), ) ); $this->add_responsive_control( 'currency_sign_size_sale', array( 'label' => esc_html__( 'Size', 'jet-woo-builder' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 6, 'max' => 90, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['price'] . ' ins .woocommerce-Price-currencySymbol' => 'font-size: {{SIZE}}{{UNIT}};', ), ) ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } protected function render() { $this->__context = 'render'; global $product; $product = wc_get_product(); if ( empty( $product ) ) { return; } if ( true === $this->__set_editor_product() ) { $this->__open_wrap(); include $this->__get_global_template( 'index' ); $this->__close_wrap(); $this->__reset_editor_product(); } } }