<?php

use Elementor\Widget_Base;
use Elementor\Controls_Manager;

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


class Productscarouselfifteenthstkaveh extends Widget_Base
{

  public function get_name()
  {
    return 'productscarouselfifteenthstkaveh';
  }

  public function get_title()
  {
    return esc_html__('Products Carousel Style Fifteen', 'kavehTheme');
  }

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

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

  protected function register_controls()
  {

    $this->start_controls_section(
      'contentproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Element Title', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
      ]
    );
    $this->add_control(
      'title2productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Title', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('Most Popular', 'kavehTheme'),

      ]
    );
    $this->add_control(
      'tagheadingproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Title Tag', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SELECT,
        'default' => 'H2',
        'options' => [
          'H1'  => esc_html__('H1', 'kavehTheme'),
          'H2' => esc_html__('H2', 'kavehTheme'),
          'H3' => esc_html__('H3', 'kavehTheme'),
          'H4' => esc_html__('H4', 'kavehTheme'),
          'H5' => esc_html__('H5', 'kavehTheme'),
          'H6' => esc_html__('H6', 'kavehTheme'),
          'p' => esc_html__('p', 'kavehTheme'),
          'div' => esc_html__('div', 'kavehTheme'),
        ],
      ]
    );
    $this->add_control(
      'titleproducts2carouseleleventhstkaveh',
      [
        'label' => esc_html__('Subtitle', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('Best Sellers', 'kavehTheme'),

      ]
    );
    $this->add_control(
      'tagheadingfproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Subtitle Tag', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SELECT,
        'default' => 'div',
        'options' => [
          'H1'  => esc_html__('H1', 'kavehTheme'),
          'H2' => esc_html__('H2', 'kavehTheme'),
          'H3' => esc_html__('H3', 'kavehTheme'),
          'H4' => esc_html__('H4', 'kavehTheme'),
          'H5' => esc_html__('H5', 'kavehTheme'),
          'H6' => esc_html__('H6', 'kavehTheme'),
          'p' => esc_html__('p', 'kavehTheme'),
          'div' => esc_html__('div', 'kavehTheme'),
        ],
      ]
    );
    $this->add_control(
      'buttonti2productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Button Title', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('View Special Offer', 'kavehTheme'),

      ]
    );
    $this->add_control(
      'iconbuttproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Icon', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::ICONS,
        'skin' => 'inline',
        'exclude_inline_options' => ['svg'],
        'default' => [
          'value' => 'icon-angle-left',
        ],
      ]
    );
    $this->add_control(
      'buttontilink2productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Button Link', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('#', 'kavehTheme'),

      ]
    );
    $this->add_control(
      'showticol1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Show First Column', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'yes',
      ]
    );
    $this->end_controls_section();
    $this->start_controls_section(
      'contentcol1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('First Column Carousel', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
        'condition' => [
          'showticol1productscarouselfifteenthstkaveh' => 'yes',
        ],
      ]
    );
    $this->add_control(
      'titlecol1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Main Title', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('Best Sellers', 'kavehTheme'),

      ]
    );
    $this->add_control(
      'tagheadingfcol1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Title Tag', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SELECT,
        'default' => 'H4',
        'options' => [
          'H1'  => esc_html__('H1', 'kavehTheme'),
          'H2' => esc_html__('H2', 'kavehTheme'),
          'H3' => esc_html__('H3', 'kavehTheme'),
          'H4' => esc_html__('H4', 'kavehTheme'),
          'H5' => esc_html__('H5', 'kavehTheme'),
          'H6' => esc_html__('H6', 'kavehTheme'),
          'p' => esc_html__('p', 'kavehTheme'),
          'div' => esc_html__('div', 'kavehTheme'),
        ],
      ]
    );
    $this->add_control(
      'title2col1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Subtitle', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => esc_html__('apple', 'kavehTheme'),

      ]
    );
    $this->add_control(
      'tagheadingcol1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Subtitle Tag', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SELECT,
        'default' => 'div',
        'options' => [
          'H1'  => esc_html__('H1', 'kavehTheme'),
          'H2' => esc_html__('H2', 'kavehTheme'),
          'H3' => esc_html__('H3', 'kavehTheme'),
          'H4' => esc_html__('H4', 'kavehTheme'),
          'H5' => esc_html__('H5', 'kavehTheme'),
          'H6' => esc_html__('H6', 'kavehTheme'),
          'p' => esc_html__('p', 'kavehTheme'),
          'div' => esc_html__('div', 'kavehTheme'),
        ],
      ]
    );
    $this->add_control(
      'titlepcol1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Description', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'default' => esc_html__('Best-selling Apple products chosen by customers with guarantee of highest quality and authenticity', 'kavehTheme'),

      ]
    );
    $this->add_control(
      'bottomimgproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Image', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::MEDIA,
        'default' => [
          'url' => \Elementor\Utils::get_placeholder_image_src(),
        ],
      ]
    );

    $this->end_controls_section();

    $this->start_controls_section(
      'content4productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Product Settings', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
      ]
    );
    $this->add_control(
      'kaveh_exclude_out_of_stock',
      [
        'label' => esc_html__('Do not display out of stock products', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'yes',
      ]
    );
    $this->add_control(
      'pproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Show Products', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SELECT,
        'default' => 'all',
        'options' => [
          'all'  => esc_html__('All', 'kavehTheme'),
          'cat'  => esc_html__('Category', 'kavehTheme'),

        ],
      ]
    );
    $this->add_control(
      'psortproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Sort products by', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SELECT,
        'default' => 'date',
        'options' => [
          'date'  => esc_html__('Date', 'kavehTheme'),
          '_price'  => esc_html__('Price', 'kavehTheme'),
          '_wc_average_rating'  => esc_html__('Most Popular', 'kavehTheme'),
          'total_sales'  => esc_html__('Sales Amount', 'kavehTheme'),

        ],
      ]
    );
    $this->add_control(
      'psortiproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Sort Type', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SELECT,
        'default' => 'desc',
        'options' => [
          'asc'  => esc_html__('Ascending', 'kavehTheme'),
          'desc'  => esc_html__('Descending', 'kavehTheme'),
        ],
      ]
    );
    $options5 = array();
    $orderby = 'name';
    $order = 'asc';
    $hide_empty = false;
    $cat_args = array(
      'orderby'    => $orderby,
      'order'      => $order,
      'hide_empty' => $hide_empty,
    );

    $product_categories = get_terms('product_cat', $cat_args);

    foreach ($product_categories as $key => $category) {
      $options5[$category->term_id] = $category->name;
    }
    $this->add_control(
      'catproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Select Category', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SELECT2,
        'multiple' => true,
        'options' => $options5,
        'condition' => [
          'pproductscarouselfifteenthstkaveh' => 'cat',
        ],
      ]
    );
    $this->end_controls_section();
    $this->start_controls_section(
      'content5productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Carousel Settings', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
      ]
    );
    $this->add_control(
      'showarrowsproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Show Arrows?', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'yes',
      ]
    );
    $this->add_control(
      'productnumberproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Number of Products Displayed', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::NUMBER,
        'min' => 0,
        'max' => 50,
        'step' => 1,
        'default' => 5,
      ]
    );
    $this->add_control(
      'productcolumnproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Number of Product Columns on Desktop', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::NUMBER,
        'min' => 0,
        'max' => 5,
        'step' => 0.2,
        'default' => 4.6,

      ]
    );
    $this->add_control(
      'productcolumn2productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Number of Product Columns on Tablet', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::NUMBER,
        'min' => 0,
        'max' => 5,
        'step' => 0.2,
        'default' => 3.2,

      ]
    );
    $this->add_control(
      'productcolumn3productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Number of Product Columns on Mobile', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::NUMBER,
        'min' => 0,
        'max' => 5,
        'step' => 0.2,
        'default' => 1.4,

      ]
    );
    $this->add_control(
      'autoplayproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Enable Autoplay', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'no',
      ]
    );
    $this->add_control(
      'autoplaydelayproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Autoplay Delay (milliseconds)', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::NUMBER,
        'min' => 1000,
        'max' => 10000,
        'step' => 500,
        'default' => 3000,
        'condition' => [
          'autoplayproductscarouselfifteenthstkaveh' => 'yes',
        ],
      ]
    );
    $this->add_control(
      'pauseonhoverproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Pause on Hover', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'yes',
        'condition' => [
          'autoplayproductscarouselfifteenthstkaveh' => 'yes',
        ],
      ]
    );
    $this->add_control(
      'loopproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Infinite Loop', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'yes',
      ]
    );
    $this->add_control(
      'speedproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Transition Speed (milliseconds)', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::NUMBER,
        'min' => 300,
        'max' => 3000,
        'step' => 100,
        'default' => 300,
      ]
    );
    $this->add_control(
      'centeredslidesproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Centered Slides', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'no',
      ]
    );
    $this->add_control(
      'freemodeproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Free Mode', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'no',
        'description' => esc_html__('Slides move freely', 'kavehTheme'),
      ]
    );
    $this->add_control(
      'effectproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Transition Effect', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SELECT,
        'default' => 'slide',
        'options' => [
          'slide' => esc_html__('Slide', 'kavehTheme'),
          'fade' => esc_html__('Fade', 'kavehTheme'),
          'cube' => esc_html__('Cube', 'kavehTheme'),
          'coverflow' => esc_html__('Coverflow', 'kavehTheme'),
          'flip' => esc_html__('Flip', 'kavehTheme'),
        ],
      ]
    );
    $this->add_control(
      'showarrowproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Show Arrows?', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'no',
      ]
    );
    $this->add_control(
      'showdotsproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Show Pagination Dots', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'yes' => esc_html__('Yes', 'kavehTheme'),
        'no' => esc_html__('No', 'kavehTheme'),
        'return_value' => 'yes',
        'default' => 'no',
      ]
    );
    $this->end_controls_section();
    $this->start_controls_section(
      'style_productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Title Styles', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
      ]
    );
    $this->add_control(
      'textcolor21productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Main Title Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading .title' => 'color: {{VALUE}} !important;',
        ],
      ]
    );
    $this->add_group_control(
      \Elementor\Group_Control_Typography::get_type(),
      [
        'name' => 'title_productscarouselfifteenthstkaveh',
        'label' => esc_html__('Main Title Typography', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-heading .title',
      ]
    );
    $this->add_control(
      'textcolor3productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Subtitle Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading .sub-title' => 'color: {{VALUE}} !important;',
        ],
      ]
    );
    $this->add_group_control(
      \Elementor\Group_Control_Typography::get_type(),
      [
        'name' => 'title2_productscarouselfifteenthstkaveh',
        'label' => esc_html__('Subtitle Typography', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-heading .sub-title',
      ]
    );
    $this->end_controls_section();
    $this->start_controls_section(
      'styleb_productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Button Style', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
      ]
    );
    $this->add_group_control(
      \Elementor\Group_Control_Typography::get_type(),
      [
        'name' => 'button_productscarouselfifteenthstkaveh',
        'label' => esc_html__('Button Text Typography', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-heading a',
      ]
    );
    $this->add_group_control(
      \Elementor\Group_Control_Text_Shadow::get_type(),
      [
        'name' => 'text_shadowproductscarouselfifteenthstkaveh',
        'label' => esc_html__('Text Shadow', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-heading a',
      ]
    );
    $this->add_control(
      'iconsizenchbproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Icon Size', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => ['px'],
        'range' => [
          'px' => [
            'min' => 0,
            'max' => 200,
            'step' => 1,
          ],
        ],
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a i' => 'font-size: {{SIZE}}{{UNIT}};',
        ],
      ]
    );
    $this->start_controls_tabs(
      'style_tabsproductscarouselfifteenthstkaveh'
    );

    $this->start_controls_tab(
      'style_normal_tabproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Normal', 'kavehTheme'),
      ]
    );
    $this->add_control(
      'textbuttoncolorproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Button Text Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a' => 'color: {{VALUE}}',
        ],
      ]
    );
    $this->add_control(
      'textbutton1colorproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Icon Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a i' => 'color: {{VALUE}}',
        ],
      ]
    );
    $this->add_control(
      'buttoncolorproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Button Background Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a' => 'background-color: {{VALUE}}',
        ],
      ]
    );
    $this->add_control(
      'buttonradiusproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('More Button Border Radius', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => ['px'],
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
        ],
      ]
    );
    $this->add_group_control(
      \Elementor\Group_Control_Border::get_type(),
      [
        'name' => 'borderproductscarouselfifteenthstkaveh',
        'label' => esc_html__('Border', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-heading a',
      ]
    );
    $this->add_control(
      'buttonbordersproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Border Width', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => ['px'],
        'condition' => [
          'borderproductscarouselfifteenthstkaveh!' => '',
        ],
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
        ],
      ]
    );
    $this->end_controls_tab();
    $this->start_controls_tab(
      'style_hove_tabproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Hover', 'kavehTheme'),
      ]
    );
    $this->add_control(
      'textbuttoncolorhoverproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Button Text Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a:hover' => 'color: {{VALUE}}',
        ],
      ]
    );
    $this->add_control(
      'textbutton1hovercolorproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Icon Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a:hover i' => 'color: {{VALUE}}',
        ],
      ]
    );
    $this->add_control(
      'buttoncolorhoverproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Button Background Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a:hover' => 'background-color: {{VALUE}}',
        ],
      ]
    );
    $this->add_control(
      'buttonradiushoverproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('More Button Border Radius', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => ['px'],
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
        ],
      ]
    );
    $this->add_group_control(
      \Elementor\Group_Control_Border::get_type(),
      [
        'name' => 'borderhoverproductscarouselfifteenthstkaveh',
        'label' => esc_html__('Border', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-heading a:hover',
      ]
    );
    $this->add_control(
      'buttonbordershoverproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Border Width', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => ['px'],
        'condition' => [
          'borderhoverproductscarouselfifteenthstkaveh!' => '',
        ],
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a:hover' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
        ],
      ]
    );
    $this->end_controls_tab();
    $this->end_controls_tabs();
    $this->add_group_control(
      \Elementor\Group_Control_Box_Shadow::get_type(),
      [
        'name' => 'box_shadowproductscarouselfifteenthstkaveh',
        'label' => esc_html__('Button Shadow', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-heading a',
      ]
    );
    $this->add_control(
      'hr2productscarouselfifteenthstkaveh',
      [
        'type' => \Elementor\Controls_Manager::DIVIDER,
      ]
    );
    $this->add_control(
      'buttonpaddingproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Padding', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => ['px'],
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-heading a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
        ],
      ]
    );
    $this->end_controls_section();
    $this->start_controls_section(
      'style3_productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('First Column Style', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
        'condition' => [
          'showticol1productscarouselfifteenthstkaveh' => 'yes',
        ],
      ]
    );
    $this->add_control(
      'textcolor21col1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Main Title Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-box-title .title' => 'color: {{VALUE}} !important;',
        ],
      ]
    );
    $this->add_group_control(
      \Elementor\Group_Control_Typography::get_type(),
      [
        'name' => 'title_col1productscarouselfifteenthstkaveh',
        'label' => esc_html__('Main Title Typography', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-box-title .title',
      ]
    );
    $this->add_control(
      'textcolor3col1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Subtitle Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-box-title .title-en' => 'color: {{VALUE}} !important;',
        ],
      ]
    );
    $this->add_group_control(
      \Elementor\Group_Control_Typography::get_type(),
      [
        'name' => 'title2_col1productscarouselfifteenthstkaveh',
        'label' => esc_html__('Subtitle Typography', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-box-title .title-en',
      ]
    );
    $this->add_control(
      'pcolor3col1productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Text Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-box-title p' => 'color: {{VALUE}} !important;',
        ],
      ]
    );
    $this->add_group_control(
      \Elementor\Group_Control_Typography::get_type(),
      [
        'name' => 'p2_col1productscarouselfifteenthstkaveh',
        'label' => esc_html__('Text Typography', 'kavehTheme'),
        'selector' => '{{WRAPPER}} .top-selling-nic-box-title p',
      ]
    );
    $this->add_control(
      'imagewidth3productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Image Width', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => ['px'],
        'range' => [
          'px' => [
            'min' => 0,
            'max' => 500,
            'step' => 5,
          ],

        ],
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-box-title img' => 'width: {{SIZE}}{{UNIT}};',

        ],
      ]
    );
    $this->add_control(
      'imageheight3amazingoffersecondstkaveh',
      [
        'label' => esc_html__('Image Height', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => ['px'],
        'range' => [
          'px' => [
            'min' => 0,
            'max' => 500,
            'step' => 5,
          ],
        ],
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-box-title img' => 'height: {{SIZE}}{{UNIT}};',
        ],
      ]
    );

    $this->end_controls_section();
    $this->start_controls_section(
      'style5_productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Carousel Arrow Styles', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
        'condition' => [
          'showarrowsproductscarouselfifteenthstkaveh' => 'yes',

        ],
      ]
    );
    $this->start_controls_tabs(
      'style_tabsarrowproductscarouselfifteenthstkaveh'
    );

    $this->start_controls_tab(
      'style_normal_tabarrowproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Normal', 'kavehTheme'),
      ]
    );
    $this->add_control(
      'textbutton1colorarrowproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Icon Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .swiper-button-next::after' => 'color: {{VALUE}}',
          '{{WRAPPER}} .swiper-button-prev::after' => 'color: {{VALUE}}',

        ],
      ]
    );
    $this->add_control(
      'buttoncolorarrowproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Background Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic .swiper-button-next' => 'background-color: {{VALUE}}',
          '{{WRAPPER}} .top-selling-nic .swiper-button-prev' => 'background-color: {{VALUE}}',
        ],
      ]
    );

    $this->end_controls_tab();
    $this->start_controls_tab(
      'style_hove_tabarrowproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Hover', 'kavehTheme'),
      ]
    );
    $this->add_control(
      'textbutton1hovercolorarrowproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Icon Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .swiper-button-next:hover::after' => 'color: {{VALUE}}',
          '{{WRAPPER}} .swiper-button-prev:hover::after' => 'color: {{VALUE}}',
        ],
      ]
    );
    $this->add_control(
      'buttoncolorhoverarrowproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Background Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic .swiper-button-next:hover' => 'background-color: {{VALUE}}',
          '{{WRAPPER}} .top-selling-nic .swiper-button-prev:hover' => 'background-color: {{VALUE}}',

        ],
      ]
    );
    $this->end_controls_tab();
    $this->end_controls_tabs();
    $this->end_controls_section();
    $this->start_controls_section(
      'stylebox_productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Right Box Style', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
        'condition' => [
          'showticol1productscarouselfifteenthstkaveh' => 'yes',
        ],
      ]
    );
    $this->add_control(
      'boxradiproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('More Button Border Radius', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => ['px'],
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-box-title' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
        ],
      ]
    );
    $this->add_control(
      'boxbgnproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Background Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-box-title' => 'background-color: {{VALUE}}',

        ],
      ]
    );
    $this->add_control(
      'boxbghovproductscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Hover Background Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .top-selling-nic-box-title:hover' => 'background-color: {{VALUE}}',
        ],
      ]
    );
    $this->end_controls_section();
    $this->start_controls_section(
      'stylebox_2productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Product Box Style', 'kavehTheme'),
        'tab' => \Elementor\Controls_Manager::TAB_STYLE,
      ]
    );
    $this->add_control(
      'boxradi2productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('More Button Border Radius', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::DIMENSIONS,
        'size_units' => ['px'],
        'selectors' => [
          '{{WRAPPER}} .product-sixteen' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
        ],
      ]
    );
    $this->add_control(
      'boxbgn2productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Background Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .product-sixteen' => 'background-color: {{VALUE}}',

        ],
      ]
    );
    $this->add_control(
      'boxbghov2productscarouselfifteenthstkaveh',
      [
        'label' => esc_html__('Hover Background Color', 'kavehTheme'),
        'type' => \Elementor\Controls_Manager::COLOR,
        'selectors' => [
          '{{WRAPPER}} .product-sixteen:hover' => 'background-color: {{VALUE}}',
        ],
      ]
    );
    $this->end_controls_section();
  }


  protected function render()
  {
    $settings = $this->get_settings_for_display();
    $clsid = $this->get_id();
?>
    <section class="top-selling-nic px-md-4">
      <div class="container">
        <!-- Start Heading -->
        <div class="top-selling-nic-heading d-flex align-items-center mb-2">
          <<?php echo  esc_attr($settings['tagheadingproductscarouselfifteenthstkaveh']); ?> class="title text-white mb-0"> <?php echo  esc_html($settings['title2productscarouselfifteenthstkaveh']); ?></<?php echo  esc_attr($settings['tagheadingproductscarouselfifteenthstkaveh']); ?>>
          <<?php echo  esc_attr($settings['tagheadingfproductscarouselfifteenthstkaveh']); ?> class="sub-title ms-2 d-none d-sm-block"> <?php echo  esc_html($settings['titleproducts2carouseleleventhstkaveh']); ?></<?php echo  esc_attr($settings['tagheadingfproductscarouselfifteenthstkaveh']); ?>>
          <a href="<?php echo  esc_url($settings['buttontilink2productscarouselfifteenthstkaveh']); ?>" class="ms-auto d-flex align-items-center">
            <?php echo  esc_html($settings['buttonti2productscarouselfifteenthstkaveh']); ?>
            <i class="<?php echo  esc_html($settings['iconbuttproductscarouselfifteenthstkaveh']['value']); ?> ms-1"></i>
          </a>
        </div>
        <!-- End Heading -->
        <div class="position-relative">
          <!-- Start Carousel -->
          <div class="swiper swiper-top-selling-nic overflow-hidden" data-swiper='<?php echo json_encode([
                                                                                    "loop" => $settings['loopproductscarouselfifteenthstkaveh'] === "yes",
                                                                                    "autoplay" => $settings['autoplayproductscarouselfifteenthstkaveh'] === "yes" ? [
                                                                                      "delay" => intval($settings['autoplaydelayproductscarouselfifteenthstkaveh']),
                                                                                      "pauseOnMouseEnter" => $settings['pauseonhoverproductscarouselfifteenthstkaveh'] === "yes"
                                                                                    ] : false,
                                                                                    "speed" => intval($settings['speedproductscarouselfifteenthstkaveh']),
                                                                                    "effect" => $settings['effectproductscarouselfifteenthstkaveh'],
                                                                                    "centeredSlides" => $settings['centeredslidesproductscarouselfifteenthstkaveh'] === "yes",
                                                                                    "freeMode" => $settings['freemodeproductscarouselfifteenthstkaveh'] === "yes",
                                                                                    "navigation" => $settings['showarrowproductscarouselfifteenthstkaveh'] === "yes" ? [
                                                                                      "prevEl" => ".swiper-button-prev",
                                                                                      "nextEl" => ".swiper-button-next"
                                                                                    ] : false,
                                                                                    "pagination" => $settings['showdotsproductscarouselfifteenthstkaveh'] === "yes" ? [
                                                                                      "el" => ".swiper-pagination",
                                                                                      "clickable" => true
                                                                                    ] : false,
                                                                                    "breakpoints" => [
                                                                                      320 => ["slidesPerView" => intval($settings['productcolumn3productscarouselfifteenthstkaveh']), "spaceBetween" => 4],
                                                                                      576 => ["slidesPerView" => intval($settings['productcolumn2productscarouselfifteenthstkaveh']), "spaceBetween" => 8],
                                                                                      768 => ["slidesPerView" => intval($settings['productcolumn2productscarouselfifteenthstkaveh']), "spaceBetween" => 12],
                                                                                      992 => ["slidesPerView" => intval($settings['productcolumnproductscarouselfifteenthstkaveh']), "spaceBetween" => 12],
                                                                                    ]
                                                                                  ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>'>
            <div class="swiper-wrapper">
              <?php if ("yes" === $settings['showticol1productscarouselfifteenthstkaveh']) { ?>
                <!-- Start Slide -->
                <div class="swiper-slide h-auto">
                  <div class="top-selling-nic-box-title pt-3 px-3 position-relative rounded-4 d-flex flex-column h-100">
                    <<?php echo  esc_attr($settings['tagheadingfcol1productscarouselfifteenthstkaveh']); ?> class="title text-white text-center mt-4 mb-0"><?php echo  esc_html($settings['titlecol1productscarouselfifteenthstkaveh']); ?></<?php echo  esc_attr($settings['tagheadingfcol1productscarouselfifteenthstkaveh']); ?>>
                    <<?php echo  esc_attr($settings['tagheadingcol1productscarouselfifteenthstkaveh']); ?> class="title-en text-center"> <?php echo  esc_html($settings['title2col1productscarouselfifteenthstkaveh']); ?> </<?php echo  esc_attr($settings['tagheadingcol1productscarouselfifteenthstkaveh']); ?>>
                    <p class="mb-4"> <?php echo  esc_html($settings['titlepcol1productscarouselfifteenthstkaveh']); ?>
                    </p>
                    <img src="<?php echo esc_url($settings['bottomimgproductscarouselfifteenthstkaveh']['url']); ?>" alt=""
                      class="d-block mt-auto mx-auto" width="220" height="220">
                  </div>
                </div>
                <!-- End Slide -->
              <?php } ?>
              <?php if ('cat' === $settings['pproductscarouselfifteenthstkaveh']) { ?>
                <?php

                // WP_Query args
                $q_pc2_query_args = array(
                  'post_type' => array('product'),
                  'post_status' => array('publish'),
                  'posts_per_page' => $settings['productnumberproductscarouselfifteenthstkaveh'],
                  'order' => 'DESC',
                  'orderby' => 'date',
                  'tax_query' => array(
                    array(
                      "taxonomy" => "product_cat",
                      "field"    => "tag_ID",
                      "terms"    => $settings['catproductscarouselfifteenthstkaveh'],
                    ),
                  ),


                );
                if ("yes" === $settings['kaveh_exclude_out_of_stock']) {
                  $q_pc2_query_args['meta_query'] = array(
                    array(
                      'key' => '_stock_status',
                      'value' => 'outofstock',
                      'compare' => 'NOT IN',
                    ),
                  );
                }

                // The Query
                $pc2_query = new \WP_Query($q_pc2_query_args);

                // The Loop
                if ($pc2_query->have_posts()) {
                  while ($pc2_query->have_posts()) {
                    $pc2_query->the_post(); ?>
                    <?php
                    global $product;
                    $sale_price = $product->get_sale_price();
                    $normal_price = $product->get_regular_price();

                    $pr_id = get_the_ID();
                    $stocka = $product->get_stock_status();
                    ?>
                    <!-- Start Slide -->
                    <div class="swiper-slide h-auto">
                      <div
                        <?php wc_product_class('product-sixteen position-relative my-3 pt-2 px-2 pb-3 rounded-4 h-100 d-flex flex-column justify-content-center', $product); ?>>
                        <div class="image mb-2">
                          <a href="javascript:void(0)" class="d-block">
                            <?php if ($this->options['kaveh_compare_system'] === '1'): ?>

                              <?php echo do_shortcode('[compare_button id=' . get_the_ID() . ' background_color="#6f42c1" style="icon_text" radius="50" tag="a" class="kaveh_compare_top"]'); ?>
                            <?php endif; ?>

                            <img src="<?php the_post_thumbnail_url('full'); ?>" alt="<?php the_title(); ?>" width="156" height="156"
                              class="d-block mx-auto">
                          </a>
                        </div>
                        <h2 class="title fw-bold text-white text-center">
                          <a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a>
                        </h2>
                        <?php
                        $categories = wp_get_post_terms($product->get_id(), 'product_cat');
                        foreach ($categories as $category) {
                          $category_link = get_term_link($category);
                          $category_name = $category->name;

                          echo '<a href="' . esc_url($category_link) . '">';
                          echo '<div class="detail text-center">' . esc_html($category_name) . '</div>';
                          echo '</a>';
                        }
                        ?>
                        <ul class="colors d-flex align-items-center justify-content-center">
                          <?php
                          // Get the terms associated with the product

                          $terms = get_the_terms($pr_id, 'pa_color');
                          if (!empty($terms)) {
                            // Loop through the terms
                            foreach ($terms as $term) {
                              $val     = get_term_meta($term->term_id, 'wpcvs_color', true) ?: '';
                              $tooltip = get_term_meta($term->term_id, 'wpcvs_tooltip', true) ?: $term->name;
                          ?>
                              <li>
                                <a href="<?php the_permalink(); ?>" aria-label="<?php echo esc_attr($tooltip) ?>" title="<?php echo esc_attr($tooltip) ?>" class="d-block rounded-circle" style="background-color: <?php echo esc_attr($val) ?>;"></a>
                              </li>
                          <?php
                            }
                          }
                          ?>
                        </ul>
                        <div class="price text-center">
                          <?php if ("instock" == $stocka) {
                            if (!$product->is_type('variable')) {
                              if (empty($sale_price) && empty($normal_price)) {
                                $price_v = $product->get_price_html(); ?>
                                <?php
                                echo str_replace("&ndash;", "<span class=\"dashvar\"> – </span>", $price_v); ?>
                                <?php
                                ?>
                              <?php } else { ?>
                                <?php if (!empty($sale_price)) { ?>

                                  <del class="d-block">
                                    <span>
                                      <?php if (!empty($normal_price)) {
                                        echo number_format($normal_price, 0, '.', ',');
                                      } ?>
                                    </span>
                                    <?php echo get_woocommerce_currency_symbol(); ?>
                                  </del>
                                  <div class="fw-bold">
                                    <span>
                                      <?php echo number_format($sale_price, 0, '.', ','); ?>
                                    </span>
                                    <?php echo get_woocommerce_currency_symbol(); ?>
                                  </div>
                                <?php } else { ?>
                                  <div class="fw-bold">
                                    <?php if (!empty($normal_price)) { ?>
                                      <span>
                                      <?php
                                      echo number_format($normal_price, 0, '.', ',');
                                    } ?>
                                      </span>
                                      <?php echo get_woocommerce_currency_symbol(); ?>
                                  </div>
                                <?php } ?>
                              <?php }
                            } else {
                              $price_v = $product->get_price_html(); ?>
                              <?php
                              echo str_replace("&ndash;", "<span class=\"dashvar\"> – </span>", $price_v); ?>
                            <?php
                            }
                          } else { ?>
                            <span class="outstock">
                              Out of Stock
                            </span>
                          <?php
                          }
                          ?>
                        </div>
                      </div>
                    </div>
                    <!-- End Slide -->
                <?php
                    // Reset Original Post Data
                    wp_reset_postdata();
                  }
                }

                ?>
                <?php } elseif ('all' === $settings['pproductscarouselfifteenthstkaveh']) {
                // WP_Query args
                $ordvalue = $settings['psortproductscarouselfifteenthstkaveh'];
                $ordi = $settings['psortiproductscarouselfifteenthstkaveh'];
                $q_pc2_query_args = array(
                  'post_type' => array('product'),
                  'post_status' => array('publish'),
                  'posts_per_page' => $settings['productnumberproductscarouselfifteenthstkaveh'],
                  'order' => $ordi,
                  'orderby' => 'meta_value_num',
                  'meta_key'       => $ordvalue,


                );
                if ("yes" === $settings['kaveh_exclude_out_of_stock']) {
                  $q_pc2_query_args['meta_query'] = array(
                    array(
                      'key' => '_stock_status',
                      'value' => 'outofstock',
                      'compare' => 'NOT IN',
                    ),
                  );
                }

                // The Query
                $pc2_query = new \WP_Query($q_pc2_query_args);

                // The Loop
                if ($pc2_query->have_posts()) {
                  while ($pc2_query->have_posts()) {
                    $pc2_query->the_post(); ?>
                    <?php
                    global $product;
                    $sale_price = $product->get_sale_price();
                    $normal_price = $product->get_regular_price();

                    $pr_id = get_the_ID();
                    $stocka = $product->get_stock_status();
                    ?>
                    <!-- Start Slide -->
                    <div class="swiper-slide h-auto">
                      <div
                        <?php wc_product_class('product-sixteen position-relative my-3 pt-2 px-2 pb-3 rounded-4 h-100 d-flex flex-column justify-content-center', $product); ?>>
                        <div class="image mb-2">
                          <a href="javascript:void(0)" class="d-block">
                            <?php if ($this->options['kaveh_compare_system'] === '1'): ?>

                              <?php echo do_shortcode('[compare_button id=' . get_the_ID() . ' background_color="#6f42c1" style="icon_text" radius="50" tag="a" class="kaveh_compare_top"]'); ?>

                            <?php endif; ?>

                            <img src="<?php the_post_thumbnail_url('full'); ?>" alt="<?php the_title(); ?>" width="156" height="156"
                              class="d-block mx-auto">
                          </a>
                        </div>
                        <h2 class="title fw-bold text-white text-center">
                          <a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a>
                        </h2>
                        <?php
                        $categories = wp_get_post_terms($product->get_id(), 'product_cat');
                        foreach ($categories as $category) {
                          $category_link = get_term_link($category);
                          $category_name = $category->name;

                          echo '<a href="' . esc_url($category_link) . '">';
                          echo '<div class="detail text-center">' . esc_html($category_name) . '</div>';
                          echo '</a>';
                        }
                        ?>
                        <ul class="colors d-flex align-items-center justify-content-center">
                          <?php
                          // Get the terms associated with the product

                          $terms = get_the_terms($pr_id, 'pa_color');
                          if (!empty($terms)) {
                            // Loop through the terms
                            foreach ($terms as $term) {
                              $val     = get_term_meta($term->term_id, 'wpcvs_color', true) ?: '';
                              $tooltip = get_term_meta($term->term_id, 'wpcvs_tooltip', true) ?: $term->name;
                          ?>
                              <li>
                                <a href="<?php the_permalink(); ?>" aria-label="<?php echo esc_attr($tooltip) ?>" title="<?php echo esc_attr($tooltip) ?>" class="d-block rounded-circle" style="background-color: <?php echo esc_attr($val) ?>;"></a>
                              </li>
                          <?php
                            }
                          }
                          ?>
                        </ul>
                        <div class="price text-center">
                          <?php if ("instock" == $stocka) {
                            if (!$product->is_type('variable')) {
                              if (empty($sale_price) && empty($normal_price)) {
                                $price_v = $product->get_price_html(); ?>
                                <?php
                                echo str_replace("&ndash;", "<span class=\"dashvar\"> – </span>", $price_v); ?>
                                <?php
                                ?>
                              <?php } else { ?>
                                <?php if (!empty($sale_price)) { ?>

                                  <del class="d-block">
                                    <span>
                                      <?php if (!empty($normal_price)) {
                                        echo number_format($normal_price, 0, '.', ',');
                                      } ?>
                                    </span>
                                    <?php echo get_woocommerce_currency_symbol(); ?>
                                  </del>
                                  <div class="fw-bold">
                                    <span>
                                      <?php echo number_format($sale_price, 0, '.', ','); ?>
                                    </span>
                                    <?php echo get_woocommerce_currency_symbol(); ?>
                                  </div>
                                <?php } else { ?>
                                  <div class="fw-bold">
                                    <?php if (!empty($normal_price)) { ?>
                                      <span>
                                      <?php
                                      echo number_format($normal_price, 0, '.', ',');
                                    } ?>
                                      </span>
                                      <?php echo get_woocommerce_currency_symbol(); ?>
                                  </div>
                                <?php } ?>
                              <?php }
                            } else {
                              $price_v = $product->get_price_html(); ?>
                              <?php
                              echo str_replace("&ndash;", "<span class=\"dashvar\"> – </span>", $price_v); ?>
                            <?php
                            }
                          } else { ?>
                            <span class="outstock">
                              Out of Stock
                            </span>
                          <?php
                          }
                          ?>
                        </div>
                      </div>
                    </div>
                    <!-- End Slide -->
                <?php
                    // Reset Original Post Data
                    wp_reset_postdata();
                  }
                }

                ?>
              <?php } ?>
            </div>
            <?php if ($settings['showarrowproductscarouselfifteenthstkaveh'] === 'yes') { ?>
              <!-- Start Button -->
              <div class="swiper-button-prev"></div>
              <div class="swiper-button-next"></div>
              <!-- End Button -->
            <?php } ?>
            <?php if ($settings['showdotsproductscarouselfifteenthstkaveh'] === 'yes') { ?>
              <div class="swiper-pagination"></div>
            <?php } ?>
          </div>
          <!-- End Carousel -->
        </div>
      </div>
    </section>


<?php
  }
}
