| Server IP : 62.60.133.156 / Your IP : 216.73.217.51 Web Server : LiteSpeed System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : mimradmin ( 1166) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/mimradmin/theme/digitaz/inc/elementor/widgets/ |
Upload File : |
<?php
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
if (!digitaz_is_woocommerce_activated()) {
return;
}
use Elementor\Controls_Manager;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Image_Size;
use Elementor\Group_Control_Typography;
use Elementor\Repeater;
/**
* Elementor Digitaz_Elementor_Products_Categories
* @since 1.0.0
*/
class Digitaz_Elementor_Products_Categories extends Elementor\Widget_Base
{
public function get_categories()
{
return array('digitaz-addons');
}
/**
* Get widget name.
*
* Retrieve tabs widget name.
*
* @return string Widget name.
* @since 1.0.0
* @access public
*
*/
public function get_name()
{
return 'digitaz-product-categories';
}
/**
* Get widget title.
*
* Retrieve tabs widget title.
*
* @return string Widget title.
* @since 1.0.0
* @access public
*
*/
public function get_title()
{
return esc_html__('Product Categories', 'digitaz');
}
/**
* Get widget icon.
*
* Retrieve tabs widget icon.
*
* @return string Widget icon.
* @since 1.0.0
* @access public
*
*/
public function get_icon()
{
return 'eicon-tabs';
}
public function get_script_depends()
{
return ['digitaz-elementor-product-categories', 'slick'];
}
public function on_export($element)
{
unset($element['settings']['category_image']['id']);
return $element;
}
protected function register_controls()
{
//Section Query
$this->start_controls_section(
'section_setting',
[
'label' => esc_html__('Categories', 'digitaz'),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$repeater = new Repeater();
$repeater->add_control(
'categories_name',
[
'label' => esc_html__('Alternate Name', 'digitaz'),
'type' => Controls_Manager::TEXT,
]
);
$repeater->add_control(
'categories',
[
'label' => esc_html__('Categories', 'digitaz'),
'type' => Controls_Manager::SELECT2,
'label_block' => true,
'options' => $this->get_product_categories(),
'multiple' => false,
]
);
$repeater->add_control(
'categories_type',
[
'label' => esc_html__('Type', 'digitaz'),
'type' => Controls_Manager::SELECT,
'default' => 'cate_image',
'options' => [
'cate_image' => esc_html__('Image', 'digitaz'),
'cate_icon' => esc_html__('Icon', 'digitaz'),
]
]
);
$repeater->add_control(
'category_icon',
[
'label' => esc_html__('Icon', 'digitaz'),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-star',
'library' => 'fa-solid',
],
'condition' => [
'categories_type' => 'cate_icon'
]
]
);
$repeater->add_control(
'category_image',
[
'label' => esc_html__('Choose Image', 'digitaz'),
'default' => [
'url' => Elementor\Utils::get_placeholder_image_src(),
],
'type' => Controls_Manager::MEDIA,
'show_label' => false,
'condition' => [
'categories_type' => 'cate_image'
]
]
);
$repeater->add_control(
'tab_color_item',
[
'label' => __('Background Color', 'digitaz'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}}.product-cat' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .layout-6 {{CURRENT_ITEM}}.product-cat .cat-title' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .layout-8 {{CURRENT_ITEM}}.product-cat:before' => 'background-color: {{VALUE}}',
],
]
);
$this->add_control(
'categories_list',
[
'label' => esc_html__('Items', 'digitaz'),
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'title_field' => '{{{ categories }}}',
]
);
$this->add_group_control(
Elementor\Group_Control_Image_Size::get_type(),
[
'name' => 'image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `brand_image_size` and `brand_image_custom_dimension`.
'default' => 'full',
'separator' => 'none',
]
);
$this->add_responsive_control(
'alignment',
[
'label' => esc_html__('Alignment', 'digitaz'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__('Left', 'digitaz'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__('Center', 'digitaz'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__('Right', 'digitaz'),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}}',
'{{WRAPPER}} .cat-title' => 'text-align: {{VALUE}}',
],
]
);
$this->add_control(
'product_cate_layout',
[
'label' => esc_html__('Layout', 'digitaz'),
'type' => Controls_Manager::SELECT,
'default' => '1',
'options' => [
'1' => esc_html__('Layout 1', 'digitaz'),
'2' => esc_html__('Layout 2', 'digitaz'),
'3' => esc_html__('Layout 3', 'digitaz'),
'4' => esc_html__('Layout 4', 'digitaz'),
]
]
);
$this->add_responsive_control(
'column',
[
'label' => esc_html__('Columns', 'digitaz'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 1,
'options' => [1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8],
]
);
$this->add_responsive_control(
'product_gutter',
[
'label' => esc_html__('Gutter', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 50,
],
],
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} [data-elementor-columns] .column-item' => 'padding-left: calc({{SIZE}}{{UNIT}} / 2); padding-right: calc({{SIZE}}{{UNIT}} / 2); margin-bottom: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .digitaz-carousel .column-item' => 'padding-left: calc({{SIZE}}{{UNIT}} / 2); padding-right: calc({{SIZE}}{{UNIT}} / 2);',
'{{WRAPPER}} .row' => 'margin-left: calc({{SIZE}}{{UNIT}} / -2); margin-right: calc({{SIZE}}{{UNIT}} / -2);',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'product_cate_style',
[
'label' => esc_html__('Box', 'digitaz'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'box_padding',
[
'label' => esc_html__('Padding', 'digitaz'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .product-cat-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
],
]
);
$this->add_responsive_control(
'min-height',
[
'label' => esc_html__('Height', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 100,
'max' => 1000,
],
'vh' => [
'min' => 10,
'max' => 100,
],
],
'size_units' => ['px', 'vh'],
'selectors' => [
'{{WRAPPER}} .product-cat-link' => 'min-height: {{SIZE}}{{UNIT}}',
],
]
);
$this->add_control(
'box_border_radius',
[
'label' => esc_html__('Border Radius', 'digitaz'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .product-cat-link' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'caption_style',
[
'label' => esc_html__('Caption', 'digitaz'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'vertical_align',
[
'label' => esc_html__('Vertical Align', 'digitaz'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__('Top', 'digitaz'),
'icon' => 'eicon-v-align-top',
],
'center' => [
'title' => esc_html__('Middle', 'digitaz'),
'icon' => 'eicon-v-align-middle',
],
'flex-end' => [
'title' => esc_html__('Bottom', 'digitaz'),
'icon' => 'eicon-v-align-bottom',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .product-cat-caption' => 'justify-content: {{VALUE}}',
],
'condition' => [
'product_cate_layout' => '4',
],
]
);
$this->add_responsive_control(
'Horizontal_align',
[
'label' => esc_html__( 'Horizontal Align', 'digitaz' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'digitaz' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'digitaz' ),
'icon' => 'eicon-h-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'digitaz' ),
'icon' => 'eicon-h-align-right',
],
],
'default' => 'flex-start',
'selectors' => [
'{{WRAPPER}} .product-cat-caption' => 'align-items: {{VALUE}}',
],
'condition' => [
'product_cate_layout' => '4',
],
]
);
$this->add_responsive_control(
'caption_padding',
[
'label' => esc_html__('Padding', 'digitaz'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .product-cat-caption' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'image_style',
[
'label' => esc_html__('Image', 'digitaz'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'image_box_shadow',
'selector' => '{{WRAPPER}} .category-product-img img',
]
);
$this->add_responsive_control(
'image_width',
[
'label' => esc_html__('Width', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'default' => [
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
],
'mobile_default' => [
'unit' => '%',
],
'size_units' => ['%', 'px', 'vw'],
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
'px' => [
'min' => 1,
'max' => 1000,
],
'vw' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .category-product-img img' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'image_max_width',
[
'label' => esc_html__('Max Width', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'default' => [
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
],
'mobile_default' => [
'unit' => '%',
],
'size_units' => ['%', 'px', 'vw'],
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
'px' => [
'min' => 1,
'max' => 1000,
],
'vw' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .category-product-img' => 'max-width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'image_height',
[
'label' => esc_html__('Height', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'default' => [
'unit' => 'px',
],
'tablet_default' => [
'unit' => 'px',
],
'mobile_default' => [
'unit' => 'px',
],
'size_units' => ['px', 'vh'],
'range' => [
'px' => [
'min' => 1,
'max' => 500,
],
'vh' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .category-product-img img' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'image_border_radius',
[
'label' => esc_html__('Border Radius', 'digitaz'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .category-product-img img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'image_padding',
[
'label' => esc_html__('Padding', 'digitaz'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .category-product-img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'image_margin',
[
'label' => esc_html__('Margin', 'digitaz'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .category-product-img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'title_style',
[
'label' => esc_html__('Title', 'digitaz'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'tilte_typography',
'selector' => '{{WRAPPER}} .cat-title',
]
);
$this->add_responsive_control(
'title_margin',
[
'label' => esc_html__('Margin', 'digitaz'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em'],
'selectors' => [
'{{WRAPPER}} .cat-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'title_padding',
[
'label' => esc_html__('Padding', 'digitaz'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em'],
'selectors' => [
'{{WRAPPER}} .cat-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->start_controls_tabs('tab_title');
$this->start_controls_tab(
'tab_title_normal',
[
'label' => esc_html__('Normal', 'digitaz'),
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__('Color', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .cat-title' => 'color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_title_hover',
[
'label' => esc_html__('Hover', 'digitaz'),
]
);
$this->add_control(
'title_color_hover',
[
'label' => esc_html__('Hover Color', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .product-cat-link:hover .cat-title' => 'color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
$this->start_controls_section(
'total_style',
[
'label' => esc_html__('Total', 'digitaz'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'total_typography',
'selector' => '{{WRAPPER}} .cat-total',
]
);
$this->add_control(
'total_color_text',
[
'label' => esc_html__('Color Text', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .product-cat-caption .cat-total' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'total_color_hover',
[
'label' => esc_html__('Color Count', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .product-cat .cat-total .count' => 'color: {{VALUE}};',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'icon_style',
[
'label' => esc_html__('Icon', 'digitaz'),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'icon_space',
[
'label' => esc_html__('Spacing', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .category-product-icon' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'icon_size',
[
'label' => esc_html__('Size', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 6,
'max' => 200,
],
],
'selectors' => [
'{{WRAPPER}} .category-product-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
],
]
);
$this->start_controls_tabs('tab_icon');
$this->start_controls_tab(
'tab_icon_normal',
[
'label' => esc_html__('Normal', 'digitaz'),
]
);
$this->add_control(
'icon_color',
[
'label' => esc_html__('Color', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .category-product-icon' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'icon_background_color',
[
'label' => esc_html__('Background Color', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .category-product-icon' => 'background-color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_icon_hover',
[
'label' => esc_html__('Hover', 'digitaz'),
]
);
$this->add_control(
'icon_color_hover',
[
'label' => esc_html__('Color Hover', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .product-cat-link:hover .category-product-icon' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'icon_background_color_hover',
[
'label' => esc_html__('Background Color Hover', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .product-cat-link:hover .category-product-icon' => 'background-color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
// Carousel options
$this->add_control_carousel();
}
protected function get_product_categories()
{
$categories = get_terms(array(
'taxonomy' => 'product_cat',
'hide_empty' => false,
)
);
$results = array();
if (!is_wp_error($categories)) {
foreach ($categories as $category) {
$results[$category->slug] = $category->name;
}
}
return $results;
}
/**
* Render tabs widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.0.0
* @access protected
*/
protected function render()
{
$settings = $this->get_settings_for_display();
if (!empty($settings['categories_list']) && is_array($settings['categories_list'])) {
$this->add_render_attribute('wrapper', 'class', 'elementor-categories-item-wrapper');
// Row
$this->add_render_attribute('row', 'class', 'row');
$this->add_render_attribute('row', 'class', 'layout-' . esc_attr($settings['product_cate_layout']));
// Carousel
if ($settings['enable_carousel'] === 'yes') {
$this->add_render_attribute('row', 'class', 'digitaz-carousel');
$carousel_settings = $this->get_carousel_settings();
$this->add_render_attribute('row', 'data-settings', wp_json_encode($carousel_settings));
} else {
if (!empty($settings['column_widescreen'])) {
$this->add_render_attribute('row', 'data-elementor-columns-widescreen', $settings['column_widescreen']);
}
if (!empty($settings['column'])) {
$this->add_render_attribute('row', 'data-elementor-columns', $settings['column']);
} else {
$this->add_render_attribute('row', 'data-elementor-columns', 5);
}
if (!empty($settings['column_laptop'])) {
$this->add_render_attribute('row', 'data-elementor-columns-laptop', $settings['column_laptop']);
}
if (!empty($settings['column_tablet_extra'])) {
$this->add_render_attribute('row', 'data-elementor-columns-tablet-extra', $settings['column_tablet_extra']);
}
if (!empty($settings['column_tablet'])) {
$this->add_render_attribute('row', 'data-elementor-columns-tablet', $settings['column_tablet']);
} else {
$this->add_render_attribute('row', 'data-elementor-columns-tablet', 2);
}
if (!empty($settings['column_mobile_extra'])) {
$this->add_render_attribute('row', 'data-elementor-columns-mobile-extra', $settings['column_mobile_extra']);
}
if (!empty($settings['column_mobile'])) {
$this->add_render_attribute('row', 'data-elementor-columns-mobile', $settings['column_mobile']);
} else {
$this->add_render_attribute('row', 'data-elementor-columns-mobile', 1);
}
}
// Item
$this->add_render_attribute('item', 'class', 'column-item elementor-categories-item');
?>
<div <?php echo digitaz_elementor_get_render_attribute_string('wrapper', $this); // WPCS: XSS ok. ?>>
<div <?php echo digitaz_elementor_get_render_attribute_string('row', $this); // WPCS: XSS ok. ?>>
<?php foreach ($settings['categories_list'] as $index => $item): ?>
<?php
$class_item = 'elementor-repeater-item-' . $item['_id'];
$tab_title_setting_key = $this->get_repeater_setting_key('tab_title', 'tabs', $index);
$this->add_render_attribute($tab_title_setting_key, ['class' => ['product-cat', $class_item],]); ?>
<div <?php echo digitaz_elementor_get_render_attribute_string('item', $this); // WPCS: XSS ok. ?>>
<?php if (empty($item['categories'])) {
echo esc_html__('Choose Category', 'digitaz');
return;
}
$category = get_term_by('slug', $item['categories'], 'product_cat');
if ($category && !is_wp_error($category)) {
if (!empty($item['category_image']['id'])) {
$image = Group_Control_Image_Size::get_attachment_image_src($item['category_image']['id'], 'image', $settings);
} else {
$thumbnail_id = get_term_meta($category->term_id, 'thumbnail_id', true);
if (!empty($thumbnail_id)) {
$image = wp_get_attachment_url($thumbnail_id);
} else {
$image = wc_placeholder_img_src();
}
} ?>
<div <?php echo digitaz_elementor_get_render_attribute_string($tab_title_setting_key, $this); ?>>
<a class="product-cat-link" href="<?php echo esc_url(get_term_link($category)); ?>"
title="<?php echo esc_attr($category->name); ?>">
<?php if ($settings['product_cate_layout'] == '1'): ?>
<div class="product-cat-caption">
<div class="cat-title">
<i class="digitaz-icon-drop-right"></i>
<?php echo empty($item['categories_name']) ? esc_html($category->name) : sprintf('%s', $item['categories_name']); ?>
</div>
<div class="cat-total">
<span class="count">(<?php echo esc_html($category->count); ?>)</span>
</div>
</div>
<?php endif; ?>
<?php if ($settings['product_cate_layout'] == '2'): ?>
<?php if ($item['categories_type'] == 'cate_image'): ?>
<div class="category-product-img">
<img src="<?php echo esc_url_raw($image); ?>"
alt="<?php echo esc_attr($category->name); ?>">
</div>
<?php endif; ?>
<?php if ($item['categories_type'] == 'cate_icon'): ?>
<?php if (!empty($item['category_icon']['value'])): ?>
<div class="category-product-icon"><?php \Elementor\Icons_Manager::render_icon($item['category_icon'], ['aria-hidden' => 'true']); ?></div>
<?php endif; ?>
<?php endif; ?>
<div class="product-cat-caption">
<div class="cat-title">
<?php echo empty($item['categories_name']) ? esc_html($category->name) : sprintf('%s', $item['categories_name']); ?>
</div>
</div>
<?php endif; ?>
<?php if ($settings['product_cate_layout'] == '3'): ?>
<?php if ($item['categories_type'] == 'cate_image'): ?>
<div class="category-product-img">
<img src="<?php echo esc_url_raw($image); ?>"
alt="<?php echo esc_attr($category->name); ?>">
</div>
<?php endif; ?>
<?php if ($item['categories_type'] == 'cate_icon'): ?>
<?php if (!empty($item['category_icon']['value'])): ?>
<div class="category-product-icon"><?php \Elementor\Icons_Manager::render_icon($item['category_icon'], ['aria-hidden' => 'true']); ?></div>
<?php endif; ?>
<?php endif; ?>
<div class="product-cat-caption">
<div class="cat-title">
<?php echo empty($item['categories_name']) ? esc_html($category->name) : sprintf('%s', $item['categories_name']); ?>
</div>
</div>
<?php endif; ?>
<?php if ($settings['product_cate_layout'] == '4'): ?>
<?php if ($item['categories_type'] == 'cate_image'): ?>
<div class="category-product-img">
<img src="<?php echo esc_url_raw($image); ?>"
alt="<?php echo esc_attr($category->name); ?>">
</div>
<?php endif; ?>
<?php if ($item['categories_type'] == 'cate_icon'): ?>
<?php if (!empty($item['category_icon']['value'])): ?>
<div class="category-product-icon"><?php \Elementor\Icons_Manager::render_icon($item['category_icon'], ['aria-hidden' => 'true']); ?></div>
<?php endif; ?>
<?php endif; ?>
<div class="product-cat-caption">
<div class="cat-title">
<?php echo empty($item['categories_name']) ? esc_html($category->name) : sprintf('%s', $item['categories_name']); ?>
</div>
<div class="cat-total">
<span class="count">
<?php echo esc_html($category->count); ?>
<?php echo esc_html__('Products', 'digitaz'); ?>
</span>
</div>
</div>
<?php endif; ?>
</a>
</div>
<?php } ?>
</div>
<?php endforeach; ?>
</div>
</div>
<?php
}
}
protected function add_control_carousel($condition = array())
{
$this->start_controls_section(
'section_carousel_options',
[
'label' => esc_html__('Carousel Options', 'digitaz'),
'type' => Controls_Manager::SECTION,
'condition' => $condition,
]
);
$this->add_control(
'enable_carousel',
[
'label' => esc_html__('Enable', 'digitaz'),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'navigation',
[
'label' => esc_html__('Navigation', 'digitaz'),
'type' => Controls_Manager::SELECT,
'default' => 'dots',
'options' => [
'both' => esc_html__('Arrows and Dots', 'digitaz'),
'arrows' => esc_html__('Arrows', 'digitaz'),
'dots' => esc_html__('Dots', 'digitaz'),
'none' => esc_html__('None', 'digitaz'),
],
'condition' => [
'enable_carousel' => 'yes'
],
]
);
$this->add_control(
'pause_on_hover',
[
'label' => esc_html__('Pause on Hover', 'digitaz'),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'condition' => [
'enable_carousel' => 'yes'
],
]
);
$this->add_control(
'autoplay',
[
'label' => esc_html__('Autoplay', 'digitaz'),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'condition' => [
'enable_carousel' => 'yes'
],
]
);
$this->add_control(
'autoplay_speed',
[
'label' => esc_html__('Autoplay Speed', 'digitaz'),
'type' => Controls_Manager::NUMBER,
'default' => 5000,
'condition' => [
'autoplay' => 'yes',
'enable_carousel' => 'yes'
],
'selectors' => [
'{{WRAPPER}} .slick-slide-bg' => 'animation-duration: calc({{VALUE}}ms*1.2); transition-duration: calc({{VALUE}}ms)',
],
]
);
$this->add_control(
'infinite',
[
'label' => esc_html__('Infinite Loop', 'digitaz'),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'condition' => [
'enable_carousel' => 'yes'
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'carousel_arrows',
[
'label' => esc_html__('Carousel Arrows', 'digitaz'),
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'enable_carousel',
'operator' => '==',
'value' => 'yes',
],
[
'name' => 'navigation',
'operator' => '!==',
'value' => 'none',
],
[
'name' => 'navigation',
'operator' => '!==',
'value' => 'dots',
],
],
],
]
);
$this->add_control(
'style_arrow',
[
'label' => esc_html__('Style Arrow', 'digitaz'),
'type' => Controls_Manager::SELECT,
'options' => [
'style-1' => esc_html__('Style 1', 'digitaz'),
'style-2' => esc_html__('Style 2', 'digitaz'),
'style-3' => esc_html__('Style 3', 'digitaz'),
],
'default' => 'style-1',
'prefix_class' => 'arrow-'
]
);
//add icon next size
$this->add_responsive_control(
'arrow_icon_size',
[
'label' => esc_html__('Size', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 300,
],
],
'selectors' => [
'{{WRAPPER}} .slick-arrow:before' => 'font-size: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'carousel_width',
[
'label' => esc_html__('Width', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'default' => [
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
],
'mobile_default' => [
'unit' => '%',
],
'size_units' => ['%', 'px', 'vw'],
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
'px' => [
'min' => 1,
'max' => 1000,
],
'vw' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .slick-slider button.slick-prev' => 'width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .slick-slider button.slick-next' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'carousel_height',
[
'label' => esc_html__('Height', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'default' => [
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
],
'mobile_default' => [
'unit' => '%',
],
'size_units' => ['%', 'px', 'vw'],
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
'px' => [
'min' => 1,
'max' => 1000,
],
'vw' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .slick-slider button.slick-prev' => 'height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .slick-slider button.slick-next' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'carousel_border_radius',
[
'label' => esc_html__('Border Radius', 'digitaz'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', '%'],
'selectors' => [
'{{WRAPPER}} .slick-slider button.slick-prev' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .slick-slider button.slick-next' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'color_button',
[
'label' => esc_html__('Color', 'digitaz'),
'type' => Controls_Manager::HEADING,
]
);
$this->start_controls_tabs('tabs_carousel_arrow_style');
$this->start_controls_tab(
'tab_carousel_arrow_normal',
[
'label' => esc_html__('Normal', 'digitaz'),
]
);
$this->add_control(
'carousel_arrow_color_icon',
[
'label' => esc_html__('Color icon', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .slick-slider button.slick-prev:before' => 'color: {{VALUE}};',
'{{WRAPPER}} .slick-slider button.slick-next:before' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'carousel_arrow_color_border',
[
'label' => esc_html__('Color Border', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .slick-slider button.slick-prev' => 'border-color: {{VALUE}};',
'{{WRAPPER}} .slick-slider button.slick-next' => 'border-color: {{VALUE}};',
],
]
);
$this->add_control(
'carousel_arrow_color_background',
[
'label' => esc_html__('Color background', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .slick-slider button.slick-prev' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .slick-slider button.slick-next' => 'background-color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_carousel_arrow_hover',
[
'label' => esc_html__('Hover', 'digitaz'),
]
);
$this->add_control(
'carousel_arrow_color_icon_hover',
[
'label' => esc_html__('Color icon', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .slick-slider button.slick-prev:hover:before' => 'color: {{VALUE}};',
'{{WRAPPER}} .slick-slider button.slick-next:hover:before' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'carousel_arrow_color_border_hover',
[
'label' => esc_html__('Color Border', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .slick-slider button.slick-prev:hover' => 'border-color: {{VALUE}};',
'{{WRAPPER}} .slick-slider button.slick-next:hover' => 'border-color: {{VALUE}};',
],
]
);
$this->add_control(
'carousel_arrow_color_background_hover',
[
'label' => esc_html__('Color background', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .slick-slider button.slick-prev:hover' => 'background-color: {{VALUE}};',
'{{WRAPPER}} .slick-slider button.slick-next:hover' => 'background-color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_control(
'next_heading',
[
'label' => esc_html__('Next button', 'digitaz'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'next_vertical',
[
'label' => esc_html__('Next Vertical', 'digitaz'),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'options' => [
'top' => [
'title' => esc_html__('Top', 'digitaz'),
'icon' => 'eicon-v-align-top',
],
'bottom' => [
'title' => esc_html__('Bottom', 'digitaz'),
'icon' => 'eicon-v-align-bottom',
],
]
]
);
$this->add_responsive_control(
'next_vertical_value',
[
'type' => Controls_Manager::SLIDER,
'show_label' => false,
'size_units' => ['px', '%'],
'range' => [
'px' => [
'min' => -1000,
'max' => 1000,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
],
],
'default' => [
'unit' => '%',
'size' => 50,
],
'selectors' => [
'{{WRAPPER}} .slick-next' => 'top: unset; bottom: unset; {{next_vertical.value}}: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_control(
'next_horizontal',
[
'label' => esc_html__('Next Horizontal', 'digitaz'),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'options' => [
'left' => [
'title' => esc_html__('Left', 'digitaz'),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => esc_html__('Right', 'digitaz'),
'icon' => 'eicon-h-align-right',
],
],
'defautl' => 'right'
]
);
$this->add_responsive_control(
'next_horizontal_value',
[
'type' => Controls_Manager::SLIDER,
'show_label' => false,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => -1000,
'max' => 1000,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => -45,
],
'selectors' => [
'{{WRAPPER}} .slick-next' => 'left: unset; right: unset;{{next_horizontal.value}}: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_control(
'prev_heading',
[
'label' => esc_html__('Prev button', 'digitaz'),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$this->add_control(
'prev_vertical',
[
'label' => esc_html__('Prev Vertical', 'digitaz'),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'options' => [
'top' => [
'title' => esc_html__('Top', 'digitaz'),
'icon' => 'eicon-v-align-top',
],
'bottom' => [
'title' => esc_html__('Bottom', 'digitaz'),
'icon' => 'eicon-v-align-bottom',
],
]
]
);
$this->add_responsive_control(
'prev_vertical_value',
[
'type' => Controls_Manager::SLIDER,
'show_label' => false,
'size_units' => ['px', '%'],
'range' => [
'px' => [
'min' => -1000,
'max' => 1000,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
],
],
'default' => [
'unit' => '%',
'size' => 50,
],
'selectors' => [
'{{WRAPPER}} .slick-prev' => 'top: unset; bottom: unset; {{prev_vertical.value}}: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_control(
'prev_horizontal',
[
'label' => esc_html__('Prev Horizontal', 'digitaz'),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'options' => [
'left' => [
'title' => esc_html__('Left', 'digitaz'),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => esc_html__('Right', 'digitaz'),
'icon' => 'eicon-h-align-right',
],
],
'defautl' => 'left'
]
);
$this->add_responsive_control(
'prev_horizontal_value',
[
'type' => Controls_Manager::SLIDER,
'show_label' => false,
'size_units' => ['px', 'em', '%'],
'range' => [
'px' => [
'min' => -1000,
'max' => 1000,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
],
],
'default' => [
'unit' => 'px',
'size' => -45,
],
'selectors' => [
'{{WRAPPER}} .slick-prev' => 'left: unset; right: unset; {{prev_horizontal.value}}: {{SIZE}}{{UNIT}};',
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'carousel_dots',
[
'label' => esc_html__('Carousel Dots', 'digitaz'),
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'enable_carousel',
'operator' => '==',
'value' => 'yes',
],
[
'name' => 'navigation',
'operator' => '!==',
'value' => 'none',
],
[
'name' => 'navigation',
'operator' => '!==',
'value' => 'arrows',
],
],
],
]
);
$this->start_controls_tabs('tabs_carousel_dots_style');
$this->start_controls_tab(
'tab_carousel_dots_normal',
[
'label' => esc_html__('Normal', 'digitaz'),
]
);
$this->add_control(
'carousel_dots_color',
[
'label' => esc_html__('Color', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .slick-dots li button:before' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'carousel_dots_opacity',
[
'label' => esc_html__('Opacity', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}} .slick-dots li button:before' => 'opacity: {{SIZE}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_carousel_dots_hover',
[
'label' => esc_html__('Hover', 'digitaz'),
]
);
$this->add_control(
'carousel_dots_color_hover',
[
'label' => esc_html__('Color Hover', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .slick-dots li button:hover:before' => 'color: {{VALUE}};',
'{{WRAPPER}} .slick-dots li button:focus:before' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'carousel_dots_opacity_hover',
[
'label' => esc_html__('Opacity', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}} .slick-dots li button:hover:before' => 'opacity: {{SIZE}};',
'{{WRAPPER}} .slick-dots li button:focus:before' => 'opacity: {{SIZE}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_carousel_dots_activate',
[
'label' => esc_html__('Activate', 'digitaz'),
]
);
$this->add_control(
'carousel_dots_color_activate',
[
'label' => esc_html__('Color', 'digitaz'),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .slick-dots li.slick-active button' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'carousel_dots_opacity_activate',
[
'label' => esc_html__('Opacity', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}} .slick-dots li.slick-active button:before' => 'opacity: {{SIZE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_responsive_control(
'dots_vertical_value',
[
'label' => esc_html__('Spacing', 'digitaz'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', '%'],
'range' => [
'px' => [
'min' => -1000,
'max' => 1000,
'step' => 1,
],
'%' => [
'min' => -100,
'max' => 100,
],
],
'default' => [
'unit' => '%',
'size' => '',
],
'selectors' => [
'{{WRAPPER}} .slick-dots' => 'bottom: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.dots-style-2 .slick-dots' => 'margin-top: {{SIZE}}{{UNIT}};',
]
]
);
$this->add_responsive_control(
'Alignment_text',
[
'label' => esc_html__('Alignment text', 'digitaz'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__('Left', 'digitaz'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__('Center', 'digitaz'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__('Right', 'digitaz'),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .slick-dots' => 'text-align: {{VALUE}};',
],
]
);
$this->end_controls_section();
}
protected function get_carousel_settings()
{
$settings = $this->get_settings_for_display();
$breakpoints = \Elementor\Plugin::$instance->breakpoints->get_breakpoints();
$tablet = isset($settings['column_tablet']) ? $settings['column_tablet'] : 2;
return array(
'navigation' => $settings['navigation'],
'autoplayHoverPause' => $settings['pause_on_hover'] === 'yes' ? true : false,
'autoplay' => $settings['autoplay'] === 'yes' ? true : false,
'autoplaySpeed' => $settings['autoplay_speed'],
'items' => $settings['column'],
'items_laptop' => isset($settings['column_laptop']) ? $settings['column_laptop'] : $settings['column'],
'items_tablet_extra' => isset($settings['column_tablet_extra']) ? $settings['column_tablet_extra'] : $settings['column'],
'items_tablet' => $tablet,
'items_mobile_extra' => isset($settings['column_mobile_extra']) ? $settings['column_mobile_extra'] : $tablet,
'items_mobile' => isset($settings['column_mobile']) ? $settings['column_mobile'] : 1,
'loop' => $settings['infinite'] === 'yes' ? true : false,
'breakpoint_laptop' => $breakpoints['laptop']->get_value(),
'breakpoint_tablet_extra' => $breakpoints['tablet_extra']->get_value(),
'breakpoint_tablet' => $breakpoints['tablet']->get_value(),
'breakpoint_mobile_extra' => $breakpoints['mobile_extra']->get_value(),
'breakpoint_mobile' => $breakpoints['mobile']->get_value(),
);
}
}
$widgets_manager->register(new Digitaz_Elementor_Products_Categories());