<?php
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Repeater;
use Elementor\Scheme_Color;
use Elementor\Group_Control_Typography;
Use Elementor\Core\Schemes\Typography;
use Elementor\Group_Control_Border;
use Elementor\Utils;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Image_Size;

if (!defined('ABSPATH')) exit; // Exit if accessed directly

class Widgetkit_Pro_Woo_Product_Carousel extends Widget_Base
{

    public function get_name()
    {
        return 'widgetkit-pro-woo-product-carousel';
    }

    public function get_title()
    {
        return __('Woo Product Carousel', 'widgetkit-pro');
    }

    public function get_icon()
    {
        return 'eicon-woocommerce';
    }

    public function get_categories()
    {
        return ['widgetkit_pro'];
    }

    /**
	 * A list of style that the widgets is depended in
	 **/
	public function get_style_depends() {
        return [
            'widgetkit_bs',
            'owl-css',
            'fontawesome',
            'widgetkit_pro_default',
        ];
    }
	/**
	 * A list of scripts that the widgets is depended in
	 **/
	public function get_script_depends() {
		return [ 
			'owl-carousel',
		 ];
	}

    protected function register_controls()
    {
        /**
         * Header
         */
        $this->start_controls_section(
            'section_control_header',
            [
                'label' => __('Header', 'widgetkit-pro'),
            ]
        );
        
        $this->add_control(
            'product_layout_header',
            [
                'label'       => __( 'Header', 'widgetkit-pro' ),
                'type'        => Controls_Manager::TEXT,
                'default'     => __( 'Latest Product', 'widgetkit-pro' ),
                'placeholder' => __( 'Latest Product', 'widgetkit-pro' ),
            ]
        );
        $this->end_controls_section();
        /**
         * Layout
         */
        $this->start_controls_section(
            'section_control_layout',
            [
                'label' => __('Layout', 'widgetkit-pro'),
            ]
        );
        $this->add_group_control(
            Group_Control_Image_Size::get_type(),
            [
                'name' => 'image',
                'default' => 'large',
                'separator' => 'none',
            ]
        );
        $this->add_control(
            'product_layout_style',
            [
                'label'       => __( 'Style', 'widgetkit-pro' ),
                'type' => Controls_Manager::SELECT,
                'default' => 'image_top',
                'options' => [
                    'image_top'  => __( 'Image Top', 'widgetkit-pro' ),
                    'image_left'  => __( 'Image Left', 'widgetkit-pro' ),
                ],
            ]
        );
        
        $this->add_responsive_control(
            'product_column_image_top',
            [
                'label'   => __( 'Column', 'widgetkit-pro' ),
                'type'    => Controls_Manager::NUMBER,
                'default' => 4,
                'min'     => 1,
                'max'     => 4,
                'step'    => 1,
                'condition' => [
                    'product_layout_style' => 'image_top'
                ],
                'devices' => [ 'desktop', 'tablet', 'mobile' ],
				'desktop_default' => 4,
				'tablet_default' => 2,
				'mobile_default' => 1,
            ]
        );
        $this->add_control(
            'product_column_image_left',
            [
                'label'   => __( 'Column', 'widgetkit-pro' ),
                'type'    => Controls_Manager::NUMBER,
                'default' => 2,
                'min'     => 1,
                'max'     => 4,
                'step'    => 1,
                'condition' => [
                    'product_layout_style' => 'image_left'
                ]
            ]
        );
        
        $this->add_control(
            'show_cart_button',
            [
                'label' => __( 'Show Cart Button', 'widgetkit-pro' ),
                'type' => Controls_Manager::SWITCHER,
                'default' => 'yes',
                'label_on' => __( 'Show', 'widgetkit-pro' ),
                'label_off' => __( 'Hide', 'widgetkit-pro' ),
                'return_value' => 'yes',
            ]
        );
        $this->add_control(
            'cart_button_layout_style',
            [
                'label'       => __( 'Cart Button', 'widgetkit-pro' ),
                'type' => Controls_Manager::SELECT,
                'default' => 'overlay',
                'options' => [
                    'overlay'  => __( 'Overaly', 'widgetkit-pro' ),
                    'inside_content'  => __( 'Inside Content', 'widgetkit-pro' ),
                ],
                'condition' => [
                    'product_layout_style' => 'image_top',
                    'show_cart_button' => 'yes'
                ]
            ]
        );
        $this->end_controls_section();


        /**
         * product Query
         */
        $this->start_controls_section(
            'section_control_product',
            [
                'label' => __('Query', 'widgetkit-pro'),
            ]
        );
        $this->add_control(
            'product_query_type',
            [
                'label'       => __( 'Type', 'widgetkit-pro' ),
                'type' => Controls_Manager::SELECT,
                'default' => 'latest',
                'options' => [
                    'latest'  => __( 'Latest', 'widgetkit-pro' ),
                    'featured'  => __( 'Featured', 'widgetkit-pro' ),
                    'best_selling'  => __( 'Best Selling', 'widgetkit-pro' ),
                    'sale'  => __( 'Sale', 'widgetkit-pro' ),
                    'top_rated'  => __( 'Top Rated', 'widgetkit-pro' ),
                ],
            ]
        );
        $this->add_control(
            'product_num_to_show',
            [
                'label'   => __( 'Number of Product to Show', 'widgetkit-pro' ),
                'type'    => Controls_Manager::NUMBER,
                'default' => 8,
                'min'     => 1,
                'max'     => 50,
                'step'    => 1,
            ]
        );
        
        $this->add_control(
            'product_order_by',
            [
                'label'       => __( 'Orderby', 'widgetkit-pro' ),
                'type' => Controls_Manager::SELECT,
                'default' => 'date',
                'options' => [
                    'id'  => __( 'ID', 'widgetkit-pro' ),
                    'date'  => __( 'Date', 'widgetkit-pro' ),
                    'title'  => __( 'Title', 'widgetkit-pro' ),
                    'popularity'  => __( 'Popularity', 'widgetkit-pro' ),
                    'rand'  => __( 'Rand', 'widgetkit-pro' ),
                    'Rating'  => __( 'Rating', 'widgetkit-pro' ),
                ],
            ]
        );
        $this->add_control(
            'show_category',
            [
                'label' => __( 'Show Category', 'widgetkit-pro' ),
                'type' => Controls_Manager::SWITCHER,
                'default' => 'yes',
                'label_on' => __( 'Show', 'widgetkit-pro' ),
                'label_off' => __( 'Hide', 'widgetkit-pro' ),
                'return_value' => 'yes',
            ]
        );
        $this->add_control(
            'show_product_price',
            [
                'label' => __( 'Show Price', 'widgetkit-pro' ),
                'type' => Controls_Manager::SWITCHER,
                'default' => 'yes',
                'label_on' => __( 'Show', 'widgetkit-pro' ),
                'label_off' => __( 'Hide', 'widgetkit-pro' ),
                'return_value' => 'yes',
            ]
        );
        $this->add_control(
            'show_product_rating',
            [
                'label' => __( 'Show Rating', 'widgetkit-pro' ),
                'type' => Controls_Manager::SWITCHER,
                'default' => 'yes',
                'label_on' => __( 'Show', 'widgetkit-pro' ),
                'label_off' => __( 'Hide', 'widgetkit-pro' ),
                'return_value' => 'yes',
            ]
        );
        $this->add_control(
            'show_short_description',
            [
                'label' => __( 'Show Excerpt', 'widgetkit-pro' ),
                'type' => Controls_Manager::SWITCHER,
                'default' => '',
                'label_on' => __( 'Show', 'widgetkit-pro' ),
                'label_off' => __( 'Hide', 'widgetkit-pro' ),
                'return_value' => 'yes',
            ]
        );
        
        $this->end_controls_section();

        /**
         * Carousel Option
         */
        $this->start_controls_section(
            'section_control_carousel',
            [
                'label' => __('Options', 'widgetkit-pro'),
            ]
        );
        $this->add_control(
            'carousel_option_arrow',
            [
                'label' => __( 'Arrow', 'widgetkit-pro' ),
                'type' => Controls_Manager::SWITCHER,
                'default' => 'yes',
                'label_on' => __( 'Yes', 'widgetkit-pro' ),
                'label_off' => __( 'No', 'widgetkit-pro' ),
                'return_value' => 'yes',
            ]
        );
        // $this->add_control(
        //     'carousel_option_dots',
        //     [
        //         'label' => __( 'Dots', 'widgetkit-pro' ),
        //         'type' => Controls_Manager::SWITCHER,
        //         'default' => '',
        //         'label_on' => __( 'Yes', 'widgetkit-pro' ),
        //         'label_off' => __( 'No', 'widgetkit-pro' ),
        //         'return_value' => 'yes',
        //     ]
        // );
        $this->add_control(
            'carousel_option_auto_play',
            [
                'label' => __( 'Auto Play', 'widgetkit-pro' ),
                'type' => Controls_Manager::SWITCHER,
                'default' => '',
                'label_on' => __( 'Yes', 'widgetkit-pro' ),
                'label_off' => __( 'No', 'widgetkit-pro' ),
                'return_value' => 'yes',
            ]
        );
        $this->add_control(
            'carousel_option_auto_height',
            [
                'label' => __( 'Auto Height', 'widgetkit-pro' ),
                'type' => Controls_Manager::SWITCHER,
                'default' => '',
                'label_on' => __( 'Yes', 'widgetkit-pro' ),
                'label_off' => __( 'No', 'widgetkit-pro' ),
                'return_value' => 'yes',
            ]
        );
        $this->add_control(
            'carousel_option_auto_loop',
            [
                'label' => __( 'Loop', 'widgetkit-pro' ),
                'type' => Controls_Manager::SWITCHER,
                'default' => 'yes',
                'label_on' => __( 'Yes', 'widgetkit-pro' ),
                'label_off' => __( 'No', 'widgetkit-pro' ),
                'return_value' => 'yes',
            ]
        );
        $this->add_control(
            'carousel_option_slide_by',
            [
                'label'   => __( 'Slide By', 'widgetkit-pro' ),
                'type'    => Controls_Manager::NUMBER,
                'default' => 1,
                'min'     => 1,
                'max'     => 4,
                'step'    => 1,
            ]
        );
        $this->end_controls_section();

        /**
         * header
         */
        $this->start_controls_section(
            'section_style_header',
            [
                'label' => __( 'Header', 'widgetkit-pro' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
        
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => __( 'Font', 'widgetkit-pro' ),
                'name' => 'layout_header_typography',
                'selector' => '{{WRAPPER}} .woo-layout-header',
            ]
        );
        $this->add_control(
            'layout-header-color',
            [
                'label' => __( 'Color', 'widgetkit-pro' ),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .woo-layout-header' => 'color: {{VALUE}}'
                ],
            ]
        );
        $this->add_control(
            'single_product_header_align',
            [
                'label' => esc_html__( 'Alignment', 'widgetkit-for-elementor' ),
                'type'  => Controls_Manager::CHOOSE,
                'default'   => 'center',
                'options' => [
                    'left'    => [
                        'title' => esc_html__( 'Left', 'widgetkit-for-elementor' ),
                        'icon'  => 'eicon-text-align-left',
                    ],
                    'center' => [
                        'title' => esc_html__( 'Center', 'widgetkit-for-elementor' ),
                        'icon'  => 'eicon-text-align-center',
                    ],
                    'right' => [
                        'title' => esc_html__( 'Right', 'widgetkit-for-elementor' ),
                        'icon'  => 'eicon-text-align-right',
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .woo-layout-header' => 'text-align: {{VALUE}}',
                ],
            ]
        );
        $this->add_control(
            'header_bottom_spacing',
            [
                'label' => __( 'Bottom Spacing', 'widgetkit-pro' ),
                'type' => Controls_Manager::SLIDER,
                'default' => [
                    'size' => 35,
                ],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'size_units' => [ 'px' ],
                'separator' => 'before',
                'selectors' => [
					'{{WRAPPER}} .woo-layout-header' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				],
            ]
        );
        $this->end_controls_section();

        /**
         * Title and Description
         */
        $this->start_controls_section(
            'section_style_content',
            [
                'label' => __( 'Title & Description', 'widgetkit-pro' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
        $this->add_control(
            'title_section',
            [
            'label' => __( 'Title ', 'widgetkit-pro' ),
            'type' => Controls_Manager::HEADING,
            'separator' => 'before',
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => __( 'Font', 'widgetkit-pro' ),
                'name' => 'content_title_typography',
                'selector' => '{{WRAPPER}} .column .product-content h4 a',
            ]
        );
        /**
         * tab start for title
         */
        $this->start_controls_tabs('section_title_style_tabs');
            /**
             * Normal Tab
             */
            $this->start_controls_tab(
                'section_title_style_normal',
                [
                    'label' => __( 'Normal', 'widgetkit-pro' ),
                ]
            );
            $this->add_control(
                'content_title_color',
                [
                    'label' => __( 'Color', 'widgetkit-pro' ),
                    'type' => Controls_Manager::COLOR,
                    'default' => '#3d3d3d',
                    'selectors' => [
                        '{{WRAPPER}} .column .product-content h4 a' => 'color: {{VALUE}} ',
                    ],
                ]
            );
            $this->end_controls_tab();
            /**
             * Hover style
             */
            $this->start_controls_tab(
                'section_title_style_hover',
                [
                    'label' => __( 'Hover', 'widgetkit-pro' ),
                ]
            );
            $this->add_control(
                'content_title_color_hover',
                [
                    'label' => __( 'Color', 'widgetkit-pro' ),
                    'type' => Controls_Manager::COLOR,
                    'default' => '#7c7000',
                    'selectors' => [
                        '{{WRAPPER}} .column .product-content h4 a:hover' => 'color: {{VALUE}} ',
                    ],
                ]
            );
            $this->end_controls_tab();
        $this->end_controls_tabs();
        $this->add_control(
            'title_bottom_spacing',
            [
                'label' => __( 'Bottom Spacing', 'widgetkit-pro' ),
                'type' => Controls_Manager::SLIDER,
                'range' => [
                    'px' => [
                        'min' => -20,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'size_units' => [ 'px' ],
                'selectors' => [
					'{{WRAPPER}} .column .product-content h4' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				],
            ]
        );

        /**
         * Meta
         */
        $this->add_control(
            'meta_section',
            [
            'label' => __( 'Meta ', 'widgetkit-pro' ),
            'type' => Controls_Manager::HEADING,
            'separator' => 'before',
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => __( 'Font', 'widgetkit-pro' ),
                'name' => 'content_category_typography',
                'selector' => '{{WRAPPER}} .column .product-content .cat-lists li a',
            ]
        );

        /**
         * Tab start for meta
         */
        $this->start_controls_tabs('section_meta_style_tabs');
        /**
         * Normal Tab
         */
        $this->start_controls_tab(
            'section_meta_style_normal',
            [
                'label' => __( 'Normal', 'widgetkit-pro' ),
            ]
            );
            $this->add_control(
                'content_category_color',
                [
                    'label' => __( 'Color', 'widgetkit-pro' ),
                    'type' => Controls_Manager::COLOR,
                    'default' => '#707070',
                    'selectors' => [
                        '{{WRAPPER}} .column .product-content .cat-lists li a' => 'color: {{VALUE}}',
                    ],
                ]
            );
            $this->end_controls_tab();
            /**
             * Hover style
             */
            $this->start_controls_tab(
            'section_meta_style_hover',
            [
                'label' => __( 'Hover', 'widgetkit-pro' ),
            ]
            );
            $this->add_control(
                'content_category_color_hover',
                [
                    'label' => __( 'Color', 'widgetkit-pro' ),
                    'type' => Controls_Manager::COLOR,
                    'default' => '#7c7000',
                    'selectors' => [
                        '{{WRAPPER}} .column .product-content .cat-lists li a:hover' => 'color: {{VALUE}} ',
                    ],
                ]
            );
            $this->end_controls_tab();
        $this->end_controls_tabs();
        $this->add_control(
            'meta_bottom_spacing',
            [
                'label' => __( 'Bottom Spacing', 'widgetkit-pro' ),
                'type' => Controls_Manager::SLIDER,
                'range' => [
                    'px' => [
                        'min' => -20,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'size_units' => [ 'px' ],
                'selectors' => [
					'{{WRAPPER}} .column .product-content .cat-lists' => 'margin-bottom: {{SIZE}}{{UNIT}};',
				],
            ]
        );
    

        /**
         * Description
         */
        $this->add_control(
            'description_section',
            [
            'label' => __( 'Description', 'widgetkit-pro' ),
            'type' => Controls_Manager::HEADING,
            'separator' => 'before',
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => __( 'Font', 'widgetkit-pro' ),
                'name' => 'content_excerpt_typography',
                'selector' =>'{{WRAPPER}} .column .product-content .excerpt',
            ]
        );
        $this->add_control(
            'content_excerpt_color',
            [
                'label' => __( 'Color', 'widgetkit-pro' ),
                'type' => Controls_Manager::COLOR,
                'default' => '#707070',
                'selectors' => [
                    '{{WRAPPER}} .column .product-content .excerpt' => 'color: {{VALUE}}',
                ],
            ]
        );
        $this->add_responsive_control(
            'content_padding',
            [
                'label'         => __('Content Box Padding', 'widgetkit-pro'),
                'type'          => Controls_Manager::DIMENSIONS,
                'size_units'    => ['px','%'],
                'separator'     => 'before',
                'selectors'     => [
                    '{{WRAPPER}} .column .product-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
                ],
            ]
        );
        $this->add_control(
            'description_bottom_spacing',
            [
                'label' => __( 'Bottom Spacing', 'widgetkit-pro' ),
                'type' => Controls_Manager::SLIDER,
                'range' => [
                    'px' => [
                        'min' => -20,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'size_units' => [ 'px' ],
                'selectors' => [
					'{{WRAPPER}} .column .product-content .excerpt' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                ],
            ]
        );
        
        $this->end_controls_section();


        /**
         * pricing
         */
        $this->start_controls_section(
            'section_style_pricing',
            [
                'label' => __( 'Pricing', 'widgetkit-pro' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => __( 'Font', 'widgetkit-pro' ),
                'name' => 'content_price_typography',
                'selector' => '{{WRAPPER}} .column .product-content .price',
            ]
        );
        $this->add_control(
            'content_price_color',
            [
                'label' => __( 'Color', 'widgetkit-pro' ),
                'type' => Controls_Manager::COLOR,
                'default' => '#7c7000',
                'selectors' => [
                    '{{WRAPPER}} .column .product-content .price' => 'color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_control(
            'product_on_sale',
            [
            'label' => __( 'Product On Sale', 'widgetkit-pro' ),
            'type' => Controls_Manager::HEADING,
            'separator' => 'before',
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => __( 'Font', 'widgetkit-pro' ),
                'name' => 'product_sale_typography',
                'selector' => '{{WRAPPER}} .column .product-thumb .onsale',
            ]
        );
        $this->add_control(
            'sale_color',
            [
                'label' => __( 'Color', 'widgetkit-pro' ),
                'type' => Controls_Manager::COLOR,
                'default' => '#fff',
                'selectors' => [
                    '{{WRAPPER}} .column .product-thumb .onsale' => 'color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_control(
            'sale_background_color',
            [
                'label' => __( 'Background Color', 'widgetkit-pro' ),
                'type' => Controls_Manager::COLOR,
                'default' => '#EEB90E',
                'selectors' => [
                    '{{WRAPPER}} .column .product-thumb .onsale' => 'background-color: {{VALUE}} ',
                ],
            ]
        );
        $this->add_control(
            'price_bottom_spacing',
            [
                'label' => __( 'Bottom Spacing', 'widgetkit-pro' ),
                'type' => Controls_Manager::SLIDER,
                'range' => [
                    'px' => [
                        'min' => -20,
                        'max' => 100,
                        'step' => 1,
                    ],
                ],
                'size_units' => [ 'px' ],
                'separator' => 'before',
                'selectors' => [
					'{{WRAPPER}} .column .product-content .price' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                ],
            ]
        );
        $this->end_controls_section();


        /**
         * Button
         */
        $this->start_controls_section(
            'section_style_button',
            [
                'label' => __( 'Button', 'widgetkit-pro' ),
                'tab' => Controls_Manager::TAB_STYLE,
                'condition' => [
                    'show_cart_button' => 'yes'
                ]
            ]
        );
        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => __( 'Font', 'widgetkit-pro' ),
                'name' => 'content_button_typography',
                'selector' =>'{{WRAPPER}} .column .product-content a.add_to_cart_button, {{WRAPPER}} .column .product-content a.product_type_external',
            ]
        );
            $this->start_controls_tabs('add_to_cart_button_style');
                /**
                 * Normal
                 */
                $this->start_controls_tab(
                    'button_style_normal',
                    [
                        'label' => __( 'Normal', 'widgetkit-pro' ),
                    ]
                );
                $this->add_control(
                    'content_button_color',
                    [
                        'label' => __( 'Text', 'widgetkit-pro' ),
                        'type' => Controls_Manager::COLOR,
                        'default' => '#fff',
                        'selectors' => [
                            '{{WRAPPER}} .column a.add_to_cart_button' => 'color: {{VALUE}}',
                            '{{WRAPPER}} .column a.product_type_external' => 'color: {{VALUE}}',
                            '{{WRAPPER}} .column a.product_type_grouped' => 'color: {{VALUE}}',
                        ],
                    ]
                );
                $this->add_control(
                    'content_button_bg_color',
                    [
                        'label' => __( 'Background', 'widgetkit-pro' ),
                        'type' => Controls_Manager::COLOR,
                        'default' => '#EEB90E',
                        'selectors' => [
                            '{{WRAPPER}} .column a.add_to_cart_button' => 'background: {{VALUE}}',
                            '{{WRAPPER}} .column a.product_type_external' => 'background: {{VALUE}}',
                            '{{WRAPPER}} .column a.product_type_grouped' => 'background: {{VALUE}}',
                        ],
                    ]
                );
                $this->add_control(
                    'button_hr',
                    [
                        'type' => \Elementor\Controls_Manager::DIVIDER,
                    ]
                );
                $this->add_group_control(
                    Group_Control_Border::get_type(), 
                    [
                        'name'          => 'Border',
                        'selector'      => '{{WRAPPER}} .column .product-content a.add_to_cart_button, {{WRAPPER}} .column .product-content a.product_type_external, {{WRAPPER}} .column .product-content a.product_type_grouped',
                    ]
                );
                $this->end_controls_tab();
                /**
                 * hover
                 */
                $this->start_controls_tab(
                    'button_style_hover',
                    [
                        'label' => __( 'Hover', 'widgetkit-pro' ),
                    ]
                );
                $this->add_control(
                    'content_button_color_hover',
                    [
                        'label' => __( 'Button Text', 'widgetkit-pro' ),
                        'type' => Controls_Manager::COLOR,
                        'default' => '#7c7000',
                        'selectors' => [
                            '{{WRAPPER}} .column a.add_to_cart_button:hover' => 'color: {{VALUE}} ',
                            '{{WRAPPER}} .column a.product_type_external:hover' => 'color: {{VALUE}}',
                            '{{WRAPPER}} .column a.product_type_grouped:hover' => 'color: {{VALUE}}',
                        ],
                    ]
                );
                $this->add_control(
                    'content_button_bg_color_hover',
                    [
                        'label' => __( 'Button Background', 'widgetkit-pro' ),
                        'type' => Controls_Manager::COLOR,
                        'default' => '#fff',
                        'selectors' => [
                            '{{WRAPPER}} .column a.add_to_cart_button:hover' => 'background: {{VALUE}}',
                            '{{WRAPPER}} .column a.product_type_external:hover' => 'background: {{VALUE}}',
                            '{{WRAPPER}} .column a.product_type_grouped:hover' => 'background: {{VALUE}}',
                        ],
                    ]
                );
                $this->add_control(
                    'content_button_border_color_hover',
                    [
                        'label' => __( 'Button Border', 'widgetkit-pro' ),
                        'type' => Controls_Manager::COLOR,
                        'selectors' => [
                            '{{WRAPPER}} .column .product-content a.add_to_cart_button:hover' => 'border-color: {{VALUE}}',
                            '{{WRAPPER}} .column .product-content a.product_type_external:hover' => 'border-color: {{VALUE}}',
                        ],
                    ]
                );
                $this->end_controls_tab();
            $this->end_controls_tabs();
            $this->add_responsive_control(
                'button_padding',
                [
                    'label'         => __('Padding', 'widgetkit-pro'),
                    'type'          => Controls_Manager::DIMENSIONS,
                    'size_units'    => ['px','%'],
                    'separator'     => 'before',
                    'selectors'     => [
                        '{{WRAPPER}} .column .product a.button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
                    ],
                ]
            );
            $this->add_responsive_control(
                'button_margin',
                [
                    'label'         => __('Margin', 'widgetkit-pro'),
                    'type'          => Controls_Manager::DIMENSIONS,
                    'size_units'    => ['px','%'],
                    'separator'     => 'before',
                    'selectors'     => [
                        '{{WRAPPER}} .column .product a.button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
                    ],
                ]
            );
        $this->end_controls_section();
        

    }


    protected function render()
    {
        ?>

        <div id="woo-product-carousel-<?php echo $this->get_id(); ?>" class="woo-product-carousel woo-product-carousel-<?php echo $this->get_id() ?>">
            <?php include( plugin_dir_path( __FILE__ ) . '../layout/woo/product-carousel.php'); ?>
        </div>
        <script>
            jQuery(function($){
                if(!$('body').hasClass('wkpro-woo-product-carousel')){
                    $('body').addClass('wkpro-woo-product-carousel');
                }
                /**
                 * Enable Carousel
                 * =================
                 */
                $(".woo-product-carousel-<?php echo $this->get_id() ?> .carousel-wrapper").addClass('owl-carousel').owlCarousel({
                    pagination: true,
                    dots:false,
                    loop:<?php echo $carousel_option_auto_loop ? 'true' : 'false'; ?>,
                    items:4,
                    nav: <?php echo $carousel_option_arrow ? 'true' : 'false'; ?>,
                    navClass: ['owl-carousel-left','owl-carousel-right'],
                    navText: ['<i class="fa fa-angle-left fa-fw""></i>', '<i class="fa fa-angle-right fa-fw"></i>'],
                    margin:10,
                    autoplay:<?php echo $carousel_option_auto_play ? 'true' : 'false'; ?>,
                    autoHeight: <?php echo $carousel_option_auto_height ? 'true': 'false'; ?>,
                    slideBy: <?php echo $carousel_option_slide_by ?>,
                    lazyLoad: true,
                    autoHeightClass: 'owl-height',
                    responsive:{
                        0:{
                            items: <?php echo $product_layout_style == 'image_left' ? 1 : $product_column_image_top_responsive_arr['mobile']; ?>
                        },
                        600:{
                            items: <?php echo $product_layout_style == 'image_left' ? 2 : $product_column_image_top_responsive_arr['tablet']; ?>
                        },
                        1000:{
                            items:<?php echo $product_layout_style == 'image_left' ? $product_column_image_left : $product_column_image_top_responsive_arr['desktop']; ?>
                        }
                    }
                });
                
            });

        </script>

    <?php
    }
    protected function _content_template()
    {
    }
}
