Adv_Accordion.php
2 months ago
Adv_Tabs.php
2 months ago
Advanced_Data_Table.php
2 weeks ago
Better_Payment.php
4 years ago
Betterdocs_Category_Box.php
3 months ago
Betterdocs_Category_Grid.php
3 months ago
Betterdocs_Search_Form.php
2 months ago
Breadcrumbs.php
2 months ago
Business_Reviews.php
6 days ago
Caldera_Forms.php
2 months ago
Career_Page.php
4 years ago
Code_Snippet.php
4 months ago
Contact_Form_7.php
2 months ago
Content_Ticker.php
4 months ago
Countdown.php
2 months ago
Creative_Button.php
1 month ago
Cta_Box.php
2 months ago
Data_Table.php
2 months ago
Dual_Color_Header.php
6 days ago
EmbedPress.php
4 years ago
Event_Calendar.php
1 week ago
Facebook_Feed.php
4 months ago
Fancy_Text.php
2 months ago
Feature_List.php
4 months ago
Filterable_Gallery.php
6 days ago
Flip_Box.php
2 months ago
FluentForm.php
2 months ago
Formstack.php
2 months ago
GravityForms.php
6 days ago
Image_Accordion.php
2 months ago
Info_Box.php
6 days ago
Interactive_Circle.php
2 months ago
Login_Register.php
6 days ago
NFT_Gallery.php
4 months ago
NinjaForms.php
2 months ago
Post_Grid.php
4 months ago
Post_Timeline.php
10 months ago
Pricing_Table.php
2 months ago
Product_Grid.php
3 weeks ago
Progress_Bar.php
2 months ago
SVG_Draw.php
4 months ago
Simple_Menu.php
6 days ago
Sticky_Video.php
4 months ago
Team_Member.php
4 months ago
Testimonial.php
2 months ago
Tooltip.php
2 months ago
Twitter_Feed.php
4 months ago
TypeForm.php
5 months ago
WeForms.php
1 year ago
Woo_Add_To_Cart.php
2 months ago
Woo_Cart.php
4 months ago
Woo_Checkout.php
4 months ago
Woo_Product_Carousel.php
1 month ago
Woo_Product_Compare.php
1 year ago
Woo_Product_Gallery.php
4 months ago
Woo_Product_Images.php
1 month ago
Woo_Product_List.php
2 months ago
Woo_Product_Price.php
2 months ago
Woo_Product_Rating.php
2 months ago
WpForms.php
2 months ago
index.php
3 years ago
Product_Grid.php
4150 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Essential_Addons_Elementor\Elements; |
| 4 | |
| 5 | use Elementor\Plugin; |
| 6 | |
| 7 | // If this file is called directly, abort. |
| 8 | if (!defined('ABSPATH')) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | use Elementor\Controls_Manager; |
| 13 | use Elementor\Group_Control_Background; |
| 14 | use Elementor\Group_Control_Border; |
| 15 | use Elementor\Group_Control_Box_Shadow; |
| 16 | use Elementor\Group_Control_Image_Size; |
| 17 | use Elementor\Group_Control_Typography; |
| 18 | use Elementor\Widget_Base; |
| 19 | use Essential_Addons_Elementor\Classes\Helper as HelperClass; |
| 20 | use Essential_Addons_Elementor\Template\Content\Product_Grid as Product_Grid_Trait; |
| 21 | use Essential_Addons_Elementor\Traits\Helper; |
| 22 | use Essential_Addons_Elementor\Traits\Woo_Product_Comparable; |
| 23 | |
| 24 | class Product_Grid extends Widget_Base |
| 25 | { |
| 26 | use Woo_Product_Comparable; |
| 27 | use Helper; |
| 28 | use Product_Grid_Trait; |
| 29 | |
| 30 | private $is_show_custom_add_to_cart = false; |
| 31 | private $simple_add_to_cart_button_text; |
| 32 | private $variable_add_to_cart_button_text; |
| 33 | private $grouped_add_to_cart_button_text; |
| 34 | private $external_add_to_cart_button_text; |
| 35 | private $default_add_to_cart_button_text; |
| 36 | /** |
| 37 | * @var int |
| 38 | */ |
| 39 | protected $page_id; |
| 40 | |
| 41 | public function __construct( $data = [], $args = null ) { |
| 42 | parent::__construct( $data, $args ); |
| 43 | |
| 44 | $is_type_instance = $this->is_type_instance(); |
| 45 | |
| 46 | if ( ! $is_type_instance && null === $args ) { |
| 47 | throw new \Exception( '`$args` argument is required when initializing a full widget instance.' ); |
| 48 | } |
| 49 | |
| 50 | if ( $is_type_instance && class_exists('woocommerce')) { |
| 51 | $this->load_quick_view_asset(); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | public function get_name() |
| 56 | { |
| 57 | return 'eicon-woocommerce'; |
| 58 | } |
| 59 | |
| 60 | public function get_title() |
| 61 | { |
| 62 | return esc_html__('Woo Product Grid', 'essential-addons-for-elementor-lite'); |
| 63 | } |
| 64 | |
| 65 | public function get_icon() |
| 66 | { |
| 67 | return 'eaicon-product-grid'; |
| 68 | } |
| 69 | |
| 70 | public function get_categories() { |
| 71 | return [ 'essential-addons-elementor', 'woocommerce-elements' ]; |
| 72 | } |
| 73 | |
| 74 | public function get_keywords() |
| 75 | { |
| 76 | return [ |
| 77 | 'woo', |
| 78 | 'woocommerce', |
| 79 | 'ea woocommerce', |
| 80 | 'ea woo product grid', |
| 81 | 'ea woocommerce product grid', |
| 82 | 'product gallery', |
| 83 | 'woocommerce grid', |
| 84 | 'gallery', |
| 85 | 'ea', |
| 86 | 'essential addons', |
| 87 | ]; |
| 88 | } |
| 89 | |
| 90 | public function has_widget_inner_wrapper(): bool { |
| 91 | return ! HelperClass::eael_e_optimized_markup(); |
| 92 | } |
| 93 | |
| 94 | public function get_custom_help_url() |
| 95 | { |
| 96 | return 'https://essential-addons.com/elementor/docs/woocommerce-product-grid/'; |
| 97 | } |
| 98 | |
| 99 | public function get_style_depends() |
| 100 | { |
| 101 | return [ |
| 102 | 'font-awesome-5-all', |
| 103 | 'font-awesome-4-shim', |
| 104 | ]; |
| 105 | } |
| 106 | |
| 107 | public function get_script_depends() |
| 108 | { |
| 109 | return [ |
| 110 | 'font-awesome-4-shim', |
| 111 | ]; |
| 112 | } |
| 113 | |
| 114 | public function add_to_cart_button_custom_text($default) |
| 115 | { |
| 116 | if ($this->is_show_custom_add_to_cart) { |
| 117 | global $product; |
| 118 | switch ($product->get_type()) { |
| 119 | case 'external': |
| 120 | return $this->external_add_to_cart_button_text; |
| 121 | case 'grouped': |
| 122 | return $this->grouped_add_to_cart_button_text; |
| 123 | case 'simple': |
| 124 | if ( ! $product->is_in_stock() ) { |
| 125 | return $this->default_add_to_cart_button_text; |
| 126 | } |
| 127 | return $this->simple_add_to_cart_button_text; |
| 128 | case 'variable': |
| 129 | return $this->variable_add_to_cart_button_text; |
| 130 | default: |
| 131 | return $this->default_add_to_cart_button_text; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | if( 'Read more' === $default ) { |
| 136 | return esc_html__( 'View More', 'essential-addons-for-elementor-lite' ); |
| 137 | } |
| 138 | |
| 139 | return $default; |
| 140 | } |
| 141 | |
| 142 | protected function eael_get_product_orderby_options() |
| 143 | { |
| 144 | return apply_filters('eael/product-grid/orderby-options', [ |
| 145 | 'ID' => __('Product ID', 'essential-addons-for-elementor-lite'), |
| 146 | 'title' => __('Product Title', 'essential-addons-for-elementor-lite'), |
| 147 | '_price' => __('Price', 'essential-addons-for-elementor-lite'), |
| 148 | '_sku' => __('SKU', 'essential-addons-for-elementor-lite'), |
| 149 | 'date' => __('Date', 'essential-addons-for-elementor-lite'), |
| 150 | 'modified' => __('Last Modified Date', 'essential-addons-for-elementor-lite'), |
| 151 | 'parent' => __('Parent Id', 'essential-addons-for-elementor-lite'), |
| 152 | 'rand' => __('Random', 'essential-addons-for-elementor-lite'), |
| 153 | 'menu_order' => __('Menu Order', 'essential-addons-for-elementor-lite'), |
| 154 | ]); |
| 155 | } |
| 156 | |
| 157 | protected function eael_get_product_filterby_options() |
| 158 | { |
| 159 | return apply_filters('eael/product-grid/filterby-options', [ |
| 160 | 'recent-products' => esc_html__('Recent Products', 'essential-addons-for-elementor-lite'), |
| 161 | 'featured-products' => esc_html__('Featured Products', 'essential-addons-for-elementor-lite'), |
| 162 | 'best-selling-products' => esc_html__('Best Selling Products', 'essential-addons-for-elementor-lite'), |
| 163 | 'sale-products' => esc_html__('Sale Products', 'essential-addons-for-elementor-lite'), |
| 164 | 'top-products' => esc_html__('Top Rated Products', 'essential-addons-for-elementor-lite'), |
| 165 | 'related-products' => esc_html__('Related Products', 'essential-addons-for-elementor-lite'), |
| 166 | 'manual' => esc_html__('Manual Selection', 'essential-addons-for-elementor-lite'), |
| 167 | ]); |
| 168 | } |
| 169 | |
| 170 | protected function register_controls() |
| 171 | { |
| 172 | $this->init_content_wc_notice_controls(); |
| 173 | if (!function_exists('WC')) { |
| 174 | return; |
| 175 | } |
| 176 | // Content Controls |
| 177 | $this->init_content_layout_controls(); |
| 178 | $this->init_content_product_settings_controls(); |
| 179 | $this->init_content_image_controls(); |
| 180 | $this->eael_product_badges(); |
| 181 | $this->init_content_addtocart_controls(); |
| 182 | $this->init_content_load_more_controls(); |
| 183 | $this->eael_product_pagination(); |
| 184 | // Product Compare |
| 185 | $this->init_content_product_compare_controls(); |
| 186 | $this->init_content_table_settings_controls(); |
| 187 | |
| 188 | // Style Controls--------------- |
| 189 | $this->init_style_product_controls(); |
| 190 | $this->init_style_color_typography_controls(); |
| 191 | $this->init_style_addtocart_controls(); |
| 192 | $this->sale_badge_style(); |
| 193 | $this->eael_product_action_buttons(); |
| 194 | $this->eael_product_action_buttons_style(); |
| 195 | /** |
| 196 | * Load More Button Style Controls! |
| 197 | */ |
| 198 | do_action('eael/controls/load_more_button_style', $this); |
| 199 | /** |
| 200 | * Pagination Style Controls! |
| 201 | */ |
| 202 | $this->eael_product_pagination_style(); |
| 203 | |
| 204 | /** |
| 205 | * Pagination Style Controls! |
| 206 | */ |
| 207 | $this->eael_product_view_popup_style(); |
| 208 | // Product Compare Table Style |
| 209 | $container_class = '.eael-wcpc-modal'; |
| 210 | $table = ".eael-wcpc-modal .eael-wcpc-wrapper table"; |
| 211 | $table_title = ".eael-wcpc-modal .eael-wcpc-wrapper .wcpc-title"; |
| 212 | $table_title_wrap = ".eael-wcpc-modal .eael-wcpc-wrapper .first-th"; |
| 213 | $compare_btn_condition = [ |
| 214 | 'eael_product_grid_style_preset!' => [ |
| 215 | 'eael-product-preset-5', |
| 216 | 'eael-product-preset-6', |
| 217 | 'eael-product-preset-7', |
| 218 | 'eael-product-preset-8', |
| 219 | ], |
| 220 | 'eael_product_grid_layout!' => 'list', |
| 221 | ]; |
| 222 | $this->init_style_compare_button_controls($compare_btn_condition); |
| 223 | $this->init_style_content_controls(compact('container_class')); |
| 224 | $this->init_style_table_controls(compact('table', 'table_title', 'table_title_wrap')); |
| 225 | $this->init_style_close_button_controls(); |
| 226 | } |
| 227 | |
| 228 | protected function init_content_layout_controls() |
| 229 | { |
| 230 | $this->start_controls_section( |
| 231 | 'eael_section_product_grid_layouts', |
| 232 | [ |
| 233 | 'label' => esc_html__('Layouts', 'essential-addons-for-elementor-lite'), |
| 234 | ] |
| 235 | ); |
| 236 | |
| 237 | $this->add_control( |
| 238 | 'eael_product_grid_layout', |
| 239 | [ |
| 240 | 'label' => __( 'Layout', 'essential-addons-for-elementor-lite' ), |
| 241 | 'type' => Controls_Manager::CHOOSE, |
| 242 | 'options' => [ |
| 243 | 'grid' => [ |
| 244 | 'title' => esc_html__( 'Grid', 'essential-addons-for-elementor-lite' ), |
| 245 | 'icon' => 'eicon-gallery-grid', |
| 246 | ], |
| 247 | 'masonry' => [ |
| 248 | 'title' => esc_html__( 'Masonry', 'essential-addons-for-elementor-lite' ), |
| 249 | 'icon' => 'eicon-gallery-masonry', |
| 250 | ], |
| 251 | 'list' => [ |
| 252 | 'title' => esc_html__( 'List', 'essential-addons-for-elementor-lite' ), |
| 253 | 'icon' => 'eicon-post-list', |
| 254 | ], |
| 255 | ], |
| 256 | 'default' => 'masonry', |
| 257 | 'toggle' => false, |
| 258 | ] |
| 259 | ); |
| 260 | |
| 261 | $image_path = EAEL_PLUGIN_URL . 'assets/admin/images/layout-previews/woo-product-grid-preset-'; |
| 262 | $this->add_control( |
| 263 | 'eael_product_grid_style_preset', |
| 264 | [ |
| 265 | 'label' => esc_html__( 'Style Preset', 'essential-addons-for-elementor-lite' ), |
| 266 | 'type' => Controls_Manager::CHOOSE, |
| 267 | 'options' => [ |
| 268 | 'eael-product-default' => [ |
| 269 | 'title' => esc_html__('Default', 'essential-addons-for-elementor-lite'), |
| 270 | 'image' => $image_path . 'default.png' |
| 271 | ], |
| 272 | 'eael-product-simple' => [ |
| 273 | 'title' => esc_html__('Simple Style', 'essential-addons-for-elementor-lite'), |
| 274 | 'image' => $image_path . 'simple.png' |
| 275 | ], |
| 276 | 'eael-product-reveal' => [ |
| 277 | 'title' => esc_html__('Reveal Style', 'essential-addons-for-elementor-lite'), |
| 278 | 'image' => $image_path . 'reveal.png' |
| 279 | ], |
| 280 | 'eael-product-overlay' => [ |
| 281 | 'title' => esc_html__('Overlay Style', 'essential-addons-for-elementor-lite'), |
| 282 | 'image' => $image_path . 'overlay.png' |
| 283 | ], |
| 284 | 'eael-product-preset-5' => [ |
| 285 | 'title' => esc_html__('Preset 5', 'essential-addons-for-elementor-lite'), |
| 286 | 'image' => $image_path . '5.png' |
| 287 | ], |
| 288 | 'eael-product-preset-6' => [ |
| 289 | 'title' => esc_html__('Preset 6', 'essential-addons-for-elementor-lite'), |
| 290 | 'image' => $image_path . '6.png' |
| 291 | ], |
| 292 | 'eael-product-preset-7' => [ |
| 293 | 'title' => esc_html__('Preset 7', 'essential-addons-for-elementor-lite'), |
| 294 | 'image' => $image_path . '7.png' |
| 295 | ], |
| 296 | 'eael-product-preset-8' => [ |
| 297 | 'title' => esc_html__('Preset 8', 'essential-addons-for-elementor-lite'), |
| 298 | 'image' => $image_path . '8.png' |
| 299 | ], |
| 300 | ], |
| 301 | 'default' => 'eael-product-simple', |
| 302 | 'label_block' => true, |
| 303 | 'toggle' => false, |
| 304 | 'image_choose'=> true, |
| 305 | 'condition' => [ |
| 306 | 'eael_product_grid_layout' => [ 'grid', 'masonry' ], |
| 307 | ], |
| 308 | ] |
| 309 | ); |
| 310 | |
| 311 | $this->add_control( |
| 312 | 'eael_product_grid_style_default_preset_notice', |
| 313 | [ |
| 314 | 'label' => '', |
| 315 | 'type' => Controls_Manager::RAW_HTML, |
| 316 | 'raw' => esc_html__( 'We do not recommend this preset, as it is rendered directly by WooCommerce functions. This may lead to broken styles and limited functionality for some controls.', 'essential-addons-for-elementor-lite' ), |
| 317 | 'content_classes' => 'eael-warning', |
| 318 | 'condition' => [ |
| 319 | 'eael_product_grid_layout' => [ 'grid', 'masonry' ], |
| 320 | 'eael_product_grid_style_preset' => 'eael-product-default', |
| 321 | ], |
| 322 | ] |
| 323 | ); |
| 324 | |
| 325 | $image_path = EAEL_PLUGIN_URL . 'assets/admin/images/layout-previews/woo-product-grid-list-preset-'; |
| 326 | $this->add_control( |
| 327 | 'eael_product_list_style_preset', |
| 328 | [ |
| 329 | 'label' => esc_html__( 'Style Preset', 'essential-addons-for-elementor-lite' ), |
| 330 | 'type' => Controls_Manager::CHOOSE, |
| 331 | 'options' => [ |
| 332 | 'eael-product-list-preset-1' => [ |
| 333 | 'title' => esc_html__('Preset 1', 'essential-addons-for-elementor-lite'), |
| 334 | 'image' => $image_path . '1.png' |
| 335 | ], |
| 336 | 'eael-product-list-preset-2' => [ |
| 337 | 'title' => esc_html__('Preset 2', 'essential-addons-for-elementor-lite'), |
| 338 | 'image' => $image_path . '2.png' |
| 339 | ], |
| 340 | 'eael-product-list-preset-3' => [ |
| 341 | 'title' => esc_html__('Preset 3', 'essential-addons-for-elementor-lite'), |
| 342 | 'image' => $image_path . '3.png' |
| 343 | ], |
| 344 | 'eael-product-list-preset-4' => [ |
| 345 | 'title' => esc_html__('Preset 4', 'essential-addons-for-elementor-lite'), |
| 346 | 'image' => $image_path . '4.png' |
| 347 | ], |
| 348 | ], |
| 349 | 'default' => 'eael-product-list-preset-1', |
| 350 | 'label_block' => true, |
| 351 | 'toggle' => false, |
| 352 | 'image_choose'=> true, |
| 353 | 'condition' => [ |
| 354 | 'eael_product_grid_layout' => [ 'list' ], |
| 355 | ], |
| 356 | ] |
| 357 | ); |
| 358 | |
| 359 | $this->add_responsive_control( |
| 360 | 'eael_product_grid_column', |
| 361 | [ |
| 362 | 'label' => esc_html__('Columns', 'essential-addons-for-elementor-lite'), |
| 363 | 'type' => Controls_Manager::CHOOSE, |
| 364 | 'label_block' => true, |
| 365 | 'default' => '4', |
| 366 | 'options' => [ |
| 367 | '1' => [ |
| 368 | 'title' => esc_html__( '1', 'essential-addons-for-elementor-lite' ), |
| 369 | 'text' => '1', |
| 370 | ], |
| 371 | '2' => [ |
| 372 | 'title' => esc_html__( '2', 'essential-addons-for-elementor-lite' ), |
| 373 | 'text' => '2', |
| 374 | ], |
| 375 | '3' => [ |
| 376 | 'title' => esc_html__( '3', 'essential-addons-for-elementor-lite' ), |
| 377 | 'text' => '3', |
| 378 | ], |
| 379 | '4' => [ |
| 380 | 'title' => esc_html__( '4', 'essential-addons-for-elementor-lite' ), |
| 381 | 'text' => '4', |
| 382 | ], |
| 383 | '5' => [ |
| 384 | 'title' => esc_html__( '5', 'essential-addons-for-elementor-lite' ), |
| 385 | 'text' => '5', |
| 386 | ], |
| 387 | '6' => [ |
| 388 | 'title' => esc_html__( '6', 'essential-addons-for-elementor-lite' ), |
| 389 | 'text' => '6', |
| 390 | ], |
| 391 | ], |
| 392 | 'toggle' => true, |
| 393 | 'prefix_class' => 'eael-product-grid-column%s-', |
| 394 | 'condition' => [ |
| 395 | 'eael_product_grid_layout!' => 'list', |
| 396 | ], |
| 397 | ] |
| 398 | ); |
| 399 | |
| 400 | $this->add_responsive_control( |
| 401 | 'eael_product_list_column', |
| 402 | [ |
| 403 | 'label' => esc_html__('Columns', 'essential-addons-for-elementor-lite'), |
| 404 | 'type' => Controls_Manager::SELECT, |
| 405 | 'default' => '2', |
| 406 | 'options' => [ |
| 407 | '1' => esc_html__('1', 'essential-addons-for-elementor-lite'), |
| 408 | '2' => esc_html__('2', 'essential-addons-for-elementor-lite'), |
| 409 | ], |
| 410 | 'toggle' => true, |
| 411 | 'prefix_class' => 'eael-product-list-column%s-', |
| 412 | 'condition' => [ |
| 413 | 'eael_product_grid_layout' => 'list', |
| 414 | ], |
| 415 | ] |
| 416 | ); |
| 417 | |
| 418 | $this->add_control( |
| 419 | 'eael_show_product_sale_badge', |
| 420 | [ |
| 421 | 'label' => esc_html__( 'Show Badge ?', 'essential-addons-for-elementor-lite' ), |
| 422 | 'type' => Controls_Manager::SWITCHER, |
| 423 | 'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ), |
| 424 | 'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 425 | 'return_value' => 'yes', |
| 426 | 'default' => 'yes', |
| 427 | ] |
| 428 | ); |
| 429 | |
| 430 | $this->add_control( |
| 431 | 'eael_wc_loop_hooks', |
| 432 | [ |
| 433 | 'label' => esc_html__( 'WooCommerce Loop Hooks', 'essential-addons-for-elementor-lite' ), |
| 434 | 'type' => Controls_Manager::SWITCHER, |
| 435 | 'label_on' => esc_html__( 'ON', 'essential-addons-for-elementor-lite' ), |
| 436 | 'label_off' => esc_html__( 'OFF', 'essential-addons-for-elementor-lite' ), |
| 437 | 'return_value' => 'yes', |
| 438 | 'separator' => 'before', |
| 439 | 'default' => '', |
| 440 | 'description' => __( 'This will enable WooCommerce loop Before and After hooks. It may break your layout.', 'essential-addons-for-elementor-lite' ) |
| 441 | ] |
| 442 | ); |
| 443 | |
| 444 | do_action( 'eael/product_grid/layout/controls', $this ); |
| 445 | |
| 446 | $this->end_controls_section(); |
| 447 | } |
| 448 | |
| 449 | protected function init_content_product_settings_controls() |
| 450 | { |
| 451 | $this->start_controls_section( |
| 452 | 'eael_section_product_grid_settings', |
| 453 | [ |
| 454 | 'label' => esc_html__('Query', 'essential-addons-for-elementor-lite'), |
| 455 | ]); |
| 456 | |
| 457 | $this->add_control( |
| 458 | 'post_type', |
| 459 | [ |
| 460 | 'label' => __( 'Source', 'essential-addons-for-elementor-lite' ), |
| 461 | 'type' => Controls_Manager::SELECT, |
| 462 | 'default' => 'product', |
| 463 | 'options' => [ |
| 464 | 'product' => esc_html__( 'Products', 'essential-addons-for-elementor-lite' ), |
| 465 | 'source_dynamic' => esc_html__( 'Dynamic', 'essential-addons-for-elementor-lite' ), |
| 466 | 'source_archive' => esc_html__( 'Archive', 'essential-addons-for-elementor-lite' ), |
| 467 | ], |
| 468 | ] |
| 469 | ); |
| 470 | |
| 471 | $this->add_control( |
| 472 | 'eael_global_dynamic_source_warning_text', |
| 473 | [ |
| 474 | 'type' => Controls_Manager::RAW_HTML, |
| 475 | 'raw' => __( 'This option will only affect in <strong>Archive page of Elementor Theme Builder</strong> dynamically.', 'essential-addons-for-elementor-lite' ), |
| 476 | 'content_classes' => 'eael-warning', |
| 477 | 'condition' => [ |
| 478 | 'post_type' => [ 'source_dynamic', 'source_archive' ], |
| 479 | ], |
| 480 | ] |
| 481 | ); |
| 482 | |
| 483 | if ( !apply_filters( 'eael/is_plugin_active', 'woocommerce/woocommerce.php' ) ) { |
| 484 | $this->add_control( |
| 485 | 'ea_product_grid_woo_required', |
| 486 | [ |
| 487 | 'type' => Controls_Manager::RAW_HTML, |
| 488 | 'raw' => __( '<strong>WooCommerce</strong> is not installed/activated on your site. Please install and activate <a href="plugin-install.php?s=woocommerce&tab=search&type=term" target="_blank">WooCommerce</a> first.', 'essential-addons-for-elementor-lite' ), |
| 489 | 'content_classes' => 'eael-warning', |
| 490 | ] |
| 491 | ); |
| 492 | } |
| 493 | |
| 494 | $this->add_control( |
| 495 | 'eael_product_grid_product_filter', |
| 496 | [ |
| 497 | 'label' => esc_html__('Filter By', 'essential-addons-for-elementor-lite'), |
| 498 | 'type' => Controls_Manager::SELECT, |
| 499 | 'default' => 'recent-products', |
| 500 | 'options' => $this->eael_get_product_filterby_options(), |
| 501 | 'condition' => [ |
| 502 | 'post_type' => 'product', |
| 503 | ], |
| 504 | ] |
| 505 | ); |
| 506 | |
| 507 | $this->add_control( |
| 508 | 'eael_global_related_products_warning_text', |
| 509 | [ |
| 510 | 'type' => Controls_Manager::RAW_HTML, |
| 511 | 'raw' => __( 'This filter will only affect in <strong>Single Product</strong> page of <strong>Elementor Theme Builder</strong> dynamically.', 'essential-addons-for-elementor-lite' ), |
| 512 | 'content_classes' => 'eael-warning', |
| 513 | 'condition' => [ |
| 514 | 'eael_product_grid_product_filter' => 'related-products', |
| 515 | ], |
| 516 | ] |
| 517 | ); |
| 518 | |
| 519 | $this->add_control('orderby', [ |
| 520 | 'label' => __('Order By', 'essential-addons-for-elementor-lite'), |
| 521 | 'type' => Controls_Manager::SELECT, |
| 522 | 'options' => $this->eael_get_product_orderby_options(), |
| 523 | 'default' => 'date', |
| 524 | 'condition' => [ |
| 525 | 'eael_product_grid_product_filter!' => [ 'best-selling-products', 'top-products' ], |
| 526 | 'post_type!' => 'source_archive', |
| 527 | ] |
| 528 | |
| 529 | ]); |
| 530 | |
| 531 | $this->add_control('order', [ |
| 532 | 'label' => __('Order', 'essential-addons-for-elementor-lite'), |
| 533 | 'type' => Controls_Manager::SELECT, |
| 534 | 'options' => [ |
| 535 | 'asc' => 'Ascending', |
| 536 | 'desc' => 'Descending', |
| 537 | ], |
| 538 | 'default' => 'desc', |
| 539 | 'condition' => [ |
| 540 | 'post_type!' => 'source_archive', |
| 541 | ] |
| 542 | |
| 543 | ]); |
| 544 | |
| 545 | $this->add_control('eael_product_grid_products_count', [ |
| 546 | 'label' => __('Products Count', 'essential-addons-for-elementor-lite'), |
| 547 | 'type' => Controls_Manager::NUMBER, |
| 548 | 'default' => 4, |
| 549 | 'min' => 1, |
| 550 | 'max' => 1000, |
| 551 | 'step' => 1, |
| 552 | 'condition' => [ |
| 553 | 'post_type!' => 'source_archive', |
| 554 | ] |
| 555 | ]); |
| 556 | |
| 557 | $this->add_control('product_offset', [ |
| 558 | 'label' => __('Offset', 'essential-addons-for-elementor-lite'), |
| 559 | 'type' => Controls_Manager::NUMBER, |
| 560 | 'default' => 0, |
| 561 | 'condition' => [ |
| 562 | 'eael_product_grid_product_filter!' => 'manual', |
| 563 | 'post_type!' => 'source_archive', |
| 564 | ] |
| 565 | ]); |
| 566 | |
| 567 | if ( current_user_can( 'administrator' ) ) { |
| 568 | $this->add_control( |
| 569 | 'eael_product_grid_products_status', |
| 570 | [ |
| 571 | 'label' => __( 'Product Status', 'essential-addons-for-elementor-lite' ), |
| 572 | 'type' => Controls_Manager::SELECT2, |
| 573 | 'label_block' => true, |
| 574 | 'multiple' => true, |
| 575 | 'default' => [ 'publish', 'pending', 'future' ], |
| 576 | 'options' => $this->eael_get_product_statuses(), |
| 577 | 'condition' => [ |
| 578 | 'eael_product_grid_product_filter!' => 'manual', |
| 579 | 'post_type!' => 'source_archive', |
| 580 | ] |
| 581 | ] |
| 582 | ); |
| 583 | } |
| 584 | |
| 585 | $this->add_control('eael_product_grid_categories', [ |
| 586 | 'label' => esc_html__('Product Categories', 'essential-addons-for-elementor-lite'), |
| 587 | 'type' => Controls_Manager::SELECT2, |
| 588 | 'label_block' => true, |
| 589 | 'multiple' => true, |
| 590 | 'options' => HelperClass::get_terms_list('product_cat', 'slug'), |
| 591 | 'condition' => [ |
| 592 | 'post_type' => 'product', |
| 593 | 'eael_product_grid_product_filter!' => [ 'manual' , 'related-products' ], |
| 594 | ], |
| 595 | ]); |
| 596 | |
| 597 | $this->add_control('eael_product_grid_tags', [ |
| 598 | 'label' => esc_html__('Product Tags', 'essential-addons-for-elementor-lite'), |
| 599 | 'type' => Controls_Manager::SELECT2, |
| 600 | 'label_block' => true, |
| 601 | 'multiple' => true, |
| 602 | 'options' => HelperClass::get_terms_list('product_tag', 'slug'), |
| 603 | 'condition' => [ |
| 604 | 'post_type!' => 'source_dynamic', |
| 605 | 'eael_product_grid_product_filter!' => [ 'manual' , 'related-products' ], |
| 606 | ], |
| 607 | ]); |
| 608 | |
| 609 | $this->add_control('eael_product_grid_products_in', [ |
| 610 | 'label' => esc_html__('Select Products', 'essential-addons-for-elementor-lite'), |
| 611 | 'type' => 'eael-select2', |
| 612 | 'label_block' => true, |
| 613 | 'multiple' => true, |
| 614 | 'source_name' => 'post_type', |
| 615 | 'source_type' => 'product', |
| 616 | 'condition' => [ |
| 617 | 'post_type!' => 'source_dynamic', |
| 618 | 'eael_product_grid_product_filter' => 'manual' |
| 619 | ], |
| 620 | ]); |
| 621 | |
| 622 | $this->add_control( |
| 623 | 'eael_product_not_in', |
| 624 | [ |
| 625 | 'label' => esc_html__('Exclude Products', 'essential-addons-for-elementor-lite'), |
| 626 | 'type' => 'eael-select2', |
| 627 | 'label_block' => true, |
| 628 | 'multiple' => true, |
| 629 | 'source_name' => 'post_type', |
| 630 | 'source_type' => 'product', |
| 631 | 'condition' => [ |
| 632 | 'post_type' => 'product', |
| 633 | 'eael_product_grid_product_filter!' => [ 'manual' , 'related-products' ], |
| 634 | ], |
| 635 | ]); |
| 636 | |
| 637 | $this->add_control( |
| 638 | 'eael_product_cat_not_in', |
| 639 | [ |
| 640 | 'label' => esc_html__('Exclude Categories', 'essential-addons-for-elementor-lite'), |
| 641 | 'type' => Controls_Manager::SELECT2, |
| 642 | 'label_block' => true, |
| 643 | 'multiple' => true, |
| 644 | 'options' => HelperClass::get_terms_list('product_cat', 'slug'), |
| 645 | 'condition' => [ |
| 646 | 'post_type' => 'product', |
| 647 | 'eael_product_grid_product_filter!' => [ 'manual' , 'related-products' ], |
| 648 | ], |
| 649 | ]); |
| 650 | |
| 651 | $wc_settings_url = admin_url( 'admin.php?page=wc-settings&tab=products§ion=inventory' ); |
| 652 | $this->add_control( |
| 653 | 'eael_product_show_stockout', |
| 654 | [ |
| 655 | 'label' => esc_html__( 'Out of Stock', 'essential-addons-for-elementor-lite' ), |
| 656 | 'type' => Controls_Manager::SWITCHER, |
| 657 | 'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ), |
| 658 | 'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 659 | 'return_value' => 'yes', |
| 660 | 'default' => 'yes', |
| 661 | 'description' => sprintf( |
| 662 | /* translators: %s: Link to WooCommerce "Out of stock visibility" settings. */ |
| 663 | __( 'Uncheck the WooCommerce Settings %s option. This will not work otherwise.', 'essential-addons-for-elementor-lite' ), |
| 664 | '<a href="' . esc_url( $wc_settings_url ) . '" target="_blank">' . esc_html__( 'Out of stock visibility', 'essential-addons-for-elementor-lite' ) . '</a>' |
| 665 | ), |
| 666 | ] |
| 667 | ); |
| 668 | |
| 669 | $this->add_control( |
| 670 | 'eael_product_grid_show_onsale', |
| 671 | [ |
| 672 | 'label' => esc_html__( 'On Sale', 'essential-addons-for-elementor-lite' ), |
| 673 | 'type' => Controls_Manager::SWITCHER, |
| 674 | 'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ), |
| 675 | 'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 676 | 'return_value' => 'yes', |
| 677 | 'default' => 'yes', |
| 678 | ] |
| 679 | ); |
| 680 | |
| 681 | $this->add_control('product_type_logged_users', [ |
| 682 | 'label' => __('Product Type', 'essential-addons-for-elementor-lite'), |
| 683 | 'type' => Controls_Manager::SELECT, |
| 684 | 'description' => __('For logged in users only!', 'essential-addons-for-elementor-lite'), |
| 685 | 'options' => [ |
| 686 | '' => __('Select', 'essential-addons-for-elementor-lite'), |
| 687 | 'purchased' => __('Purchased Only', 'essential-addons-for-elementor-lite'), |
| 688 | 'not-purchased' => __('Not Purchased Only', 'essential-addons-for-elementor-lite'), |
| 689 | ], |
| 690 | 'default' => '', |
| 691 | |
| 692 | ]); |
| 693 | |
| 694 | $this->add_control( |
| 695 | 'eael_product_grid_title_html_tag', |
| 696 | [ |
| 697 | 'label' => __( 'Title HTML Tag', 'essential-addons-for-elementor-lite' ), |
| 698 | 'label_block' => true, |
| 699 | 'type' => Controls_Manager::CHOOSE, |
| 700 | 'options' => [ |
| 701 | 'h1' => [ |
| 702 | 'title' => esc_html__( 'H1', 'essential-addons-for-elementor-lite' ), |
| 703 | 'icon' => 'eicon-editor-h1', |
| 704 | ], |
| 705 | 'h2' => [ |
| 706 | 'title' => esc_html__( 'H2', 'essential-addons-for-elementor-lite' ), |
| 707 | 'icon' => 'eicon-editor-h2', |
| 708 | ], |
| 709 | 'h3' => [ |
| 710 | 'title' => esc_html__( 'H3', 'essential-addons-for-elementor-lite' ), |
| 711 | 'icon' => 'eicon-editor-h3', |
| 712 | ], |
| 713 | 'h4' => [ |
| 714 | 'title' => esc_html__( 'H4', 'essential-addons-for-elementor-lite' ), |
| 715 | 'icon' => 'eicon-editor-h4', |
| 716 | ], |
| 717 | 'h5' => [ |
| 718 | 'title' => esc_html__( 'H5', 'essential-addons-for-elementor-lite' ), |
| 719 | 'icon' => 'eicon-editor-h5', |
| 720 | ], |
| 721 | 'h6' => [ |
| 722 | 'title' => esc_html__( 'H6', 'essential-addons-for-elementor-lite' ), |
| 723 | 'icon' => 'eicon-editor-h6', |
| 724 | ], |
| 725 | 'div' => [ |
| 726 | 'title' => esc_html__( 'Div', 'essential-addons-for-elementor-lite' ), |
| 727 | 'text' => 'div', |
| 728 | ], |
| 729 | 'span' => [ |
| 730 | 'title' => esc_html__( 'Span', 'essential-addons-for-elementor-lite' ), |
| 731 | 'text' => 'span', |
| 732 | ], |
| 733 | 'p' => [ |
| 734 | 'title' => esc_html__( 'P', 'essential-addons-for-elementor-lite' ), |
| 735 | 'text' => 'P', |
| 736 | ], |
| 737 | ], |
| 738 | 'default' => 'h2', |
| 739 | 'toggle' => false, |
| 740 | 'condition'=> [ |
| 741 | 'eael_product_grid_style_preset!' => 'eael-product-default' |
| 742 | ] |
| 743 | ] |
| 744 | ); |
| 745 | |
| 746 | $this->add_control( |
| 747 | 'eael_product_grid_rating', |
| 748 | [ |
| 749 | 'label' => esc_html__('Product Rating?', 'essential-addons-for-elementor-lite'), |
| 750 | 'type' => Controls_Manager::SWITCHER, |
| 751 | 'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ), |
| 752 | 'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 753 | 'return_value' => 'yes', |
| 754 | 'default' => 'yes', |
| 755 | 'condition' => [ |
| 756 | 'eael_product_grid_style_preset!' => ['eael-product-preset-8'], |
| 757 | ], |
| 758 | |
| 759 | ]); |
| 760 | |
| 761 | if ( apply_filters('eael/pro_enabled', false) ) { |
| 762 | $this->add_control( |
| 763 | 'eael_product_rating_type', |
| 764 | [ |
| 765 | 'label' => esc_html__( 'Type', 'essential-addons-for-elementor-lite' ), |
| 766 | 'type' => Controls_Manager::SELECT, |
| 767 | 'default' => 'stars', |
| 768 | 'options' => [ |
| 769 | 'stars' => esc_html__( '✭✭✭✭✫', 'essential-addons-for-elementor-lite' ), |
| 770 | 'stars-number' => esc_html__( '✭ 4.7', 'essential-addons-for-elementor-lite' ), |
| 771 | 'number' => esc_html__( '4.7/5', 'essential-addons-for-elementor-lite' ), |
| 772 | ], |
| 773 | 'condition' => [ |
| 774 | 'eael_product_grid_rating' => 'yes', |
| 775 | 'eael_product_grid_style_preset!' => [ 'eael-product-default', 'eael-product-preset-8' ], |
| 776 | ], |
| 777 | 'separator' => 'after' |
| 778 | ] |
| 779 | ); |
| 780 | } |
| 781 | |
| 782 | $this->add_control( |
| 783 | 'eael_product_sold_count', [ |
| 784 | 'label' => esc_html__( 'Show Sold Count?', 'essential-addons-for-elementor-lite' ), |
| 785 | 'type' => Controls_Manager::SWITCHER, |
| 786 | 'return_value' => 'yes', |
| 787 | 'default' => '', |
| 788 | 'condition' => [ |
| 789 | 'eael_product_grid_style_preset!' => 'eael-product-default' |
| 790 | ] |
| 791 | ] |
| 792 | ); |
| 793 | |
| 794 | $this->add_control( |
| 795 | 'eael_product_sold_count_type', |
| 796 | [ |
| 797 | 'label' => esc_html__( 'Type', 'essential-addons-for-elementor-lite' ), |
| 798 | 'type' => Controls_Manager::SELECT, |
| 799 | 'default' => 'number', |
| 800 | 'options' => [ |
| 801 | 'number' => esc_html__( 'Only Count', 'essential-addons-for-elementor-lite' ), |
| 802 | 'bar-number' => esc_html__( 'Count with Progress Bar', 'essential-addons-for-elementor-lite' ), |
| 803 | 'bar' => esc_html__( 'Only Progress Bar', 'essential-addons-for-elementor-lite' ), |
| 804 | ], |
| 805 | 'condition' => [ |
| 806 | 'eael_product_sold_count' => 'yes', |
| 807 | 'eael_product_grid_style_preset!' => 'eael-product-default' |
| 808 | ], |
| 809 | ] |
| 810 | ); |
| 811 | |
| 812 | $this->add_control( |
| 813 | 'eael_product_sold_count_bar_width', |
| 814 | [ |
| 815 | 'label' => esc_html__( 'Width', 'essential-addons-for-elementor-lite' ), |
| 816 | 'type' => Controls_Manager::SLIDER, |
| 817 | 'size_units' => [ '%' ], |
| 818 | 'range' => [ |
| 819 | '%' => [ |
| 820 | 'min' => 0, |
| 821 | 'max' => 100, |
| 822 | ], |
| 823 | ], |
| 824 | 'default' => [ |
| 825 | 'unit' => '%', |
| 826 | 'size' => 50, |
| 827 | ], |
| 828 | 'condition' => [ |
| 829 | 'eael_product_sold_count' => 'yes', |
| 830 | 'eael_product_sold_count_type!' => 'number', |
| 831 | 'eael_product_grid_style_preset!' => 'eael-product-default' |
| 832 | ], |
| 833 | 'description' => esc_html__( 'This width applied in progress bar for those products which stocks are not managed', 'essential-addons-for-elementor-lite' ), |
| 834 | ] |
| 835 | ); |
| 836 | |
| 837 | $this->add_control( |
| 838 | 'eael_product_sold_count_bar_height', |
| 839 | [ |
| 840 | 'label' => esc_html__( 'Height', 'essential-addons-for-elementor-lite' ), |
| 841 | 'type' => Controls_Manager::SLIDER, |
| 842 | 'size_units' => [ '%' ], |
| 843 | 'range' => [ |
| 844 | 'px' => [ |
| 845 | 'min' => 1, |
| 846 | 'max' => 100, |
| 847 | ], |
| 848 | ], |
| 849 | 'default' => [ |
| 850 | 'unit' => 'px', |
| 851 | 'size' => 10, |
| 852 | ], |
| 853 | 'selectors' => [ |
| 854 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products .product .eael-product-sold-count-progress-bar' => 'height: {{SIZE}}{{UNIT}};' |
| 855 | ], |
| 856 | 'condition' => [ |
| 857 | 'eael_product_sold_count' => 'yes', |
| 858 | 'eael_product_sold_count_type!' => 'number', |
| 859 | 'eael_product_grid_style_preset!' => 'eael-product-default' |
| 860 | ], |
| 861 | ] |
| 862 | ); |
| 863 | |
| 864 | $this->add_control( |
| 865 | 'eael_product_sold_count_text', |
| 866 | [ |
| 867 | 'label' => esc_html__( 'Text', 'essential-addons-for-elementor-lite' ), |
| 868 | 'type' => Controls_Manager::TEXTAREA, |
| 869 | 'default' => '[sold_count] Sold', |
| 870 | 'condition' => [ |
| 871 | 'eael_product_sold_count' => 'yes', |
| 872 | 'eael_product_sold_count_type!' => 'bar', |
| 873 | 'eael_product_grid_style_preset!' => 'eael-product-default' |
| 874 | ], |
| 875 | 'ai' => [ |
| 876 | 'active' => false |
| 877 | ], |
| 878 | 'description' => __( '<strong>[sold_count]</strong> Will be replaced with actual amount.', 'essential-addons-for-elementor-lite' ), |
| 879 | ] |
| 880 | ); |
| 881 | |
| 882 | $this->add_control( |
| 883 | 'eael_product_sold_count_text_align', |
| 884 | [ |
| 885 | 'label' => esc_html__( 'Alignment', 'essential-addons-for-elementor-lite' ), |
| 886 | 'type' => Controls_Manager::CHOOSE, |
| 887 | 'options' => [ |
| 888 | 'left' => [ |
| 889 | 'title' => esc_html__( 'Left', 'essential-addons-for-elementor-lite' ), |
| 890 | 'icon' => 'eicon-text-align-left', |
| 891 | ], |
| 892 | 'center' => [ |
| 893 | 'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite' ), |
| 894 | 'icon' => 'eicon-text-align-center', |
| 895 | ], |
| 896 | 'right' => [ |
| 897 | 'title' => esc_html__( 'Right', 'essential-addons-for-elementor-lite' ), |
| 898 | 'icon' => 'eicon-text-align-right', |
| 899 | ], |
| 900 | ], |
| 901 | 'condition' => [ |
| 902 | 'eael_product_sold_count' => 'yes', |
| 903 | 'eael_product_sold_count_type!' => 'bar', |
| 904 | 'eael_product_grid_style_preset!' => 'eael-product-default' |
| 905 | ], |
| 906 | 'selectors' => [ |
| 907 | '{{WRAPPER}} .eael-sold-count-number' => 'text-align: {{VALUE}};', |
| 908 | ], |
| 909 | ] |
| 910 | ); |
| 911 | |
| 912 | $this->add_control( |
| 913 | 'eael_product_grid_price', |
| 914 | [ |
| 915 | 'label' => esc_html__('Product Price?', 'essential-addons-for-elementor-lite'), |
| 916 | 'type' => Controls_Manager::SWITCHER, |
| 917 | 'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ), |
| 918 | 'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 919 | 'return_value' => 'yes', |
| 920 | 'separator' => 'before', |
| 921 | 'default' => 'yes', |
| 922 | 'condition' => [ |
| 923 | 'eael_product_grid_style_preset!' => 'eael-product-default', |
| 924 | ], |
| 925 | ] |
| 926 | ); |
| 927 | |
| 928 | $this->add_control( |
| 929 | 'eael_product_grid_excerpt', |
| 930 | [ |
| 931 | 'label' => esc_html__('Short Description?', 'essential-addons-for-elementor-lite'), |
| 932 | 'type' => Controls_Manager::SWITCHER, |
| 933 | 'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ), |
| 934 | 'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 935 | 'return_value' => 'yes', |
| 936 | 'default' => 'yes', |
| 937 | 'condition' => [ |
| 938 | 'eael_product_grid_layout' => 'list', |
| 939 | ], |
| 940 | ] |
| 941 | ); |
| 942 | $this->add_control( |
| 943 | 'eael_product_grid_excerpt_length', |
| 944 | [ |
| 945 | 'label' => __('Excerpt Words', 'essential-addons-for-elementor-lite'), |
| 946 | 'type' => Controls_Manager::NUMBER, |
| 947 | 'default' => '10', |
| 948 | 'condition' => [ |
| 949 | 'eael_product_grid_excerpt' => 'yes', |
| 950 | 'eael_product_grid_layout' => 'list', |
| 951 | ], |
| 952 | ] |
| 953 | ); |
| 954 | |
| 955 | $this->add_control( |
| 956 | 'eael_product_grid_excerpt_expanison_indicator', |
| 957 | [ |
| 958 | 'label' => esc_html__('Expansion Indicator', 'essential-addons-for-elementor-lite'), |
| 959 | 'type' => Controls_Manager::TEXT, |
| 960 | 'label_block' => false, |
| 961 | 'default' => '...', |
| 962 | 'condition' => [ |
| 963 | 'eael_product_grid_excerpt' => 'yes', |
| 964 | 'eael_product_grid_layout' => 'list', |
| 965 | ], |
| 966 | 'ai' => [ |
| 967 | 'active' => true, |
| 968 | ], |
| 969 | ] |
| 970 | ); |
| 971 | |
| 972 | $this->add_control('show_compare', [ |
| 973 | 'label' => esc_html__('Product Compare?', 'essential-addons-for-elementor-lite'), |
| 974 | 'type' => Controls_Manager::SWITCHER, |
| 975 | 'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ), |
| 976 | 'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 977 | ]); |
| 978 | |
| 979 | $this->add_control( |
| 980 | 'eael_product_grid_image_clickable', |
| 981 | [ |
| 982 | 'label' => esc_html__('Image Clickable?', 'essential-addons-for-elementor-lite'), |
| 983 | 'type' => Controls_Manager::SWITCHER, |
| 984 | 'return_value' => 'yes', |
| 985 | 'default' => 'no', |
| 986 | 'condition' => [ |
| 987 | 'eael_product_grid_style_preset!' => 'eael-product-default', |
| 988 | ], |
| 989 | ] |
| 990 | ); |
| 991 | |
| 992 | if ( function_exists( 'YITH_WCWL' ) ) { |
| 993 | $this->add_control( |
| 994 | 'eael_product_grid_wishlist', |
| 995 | [ |
| 996 | 'label' => esc_html__( 'Wishlist?', 'essential-addons-for-elementor-lite' ), |
| 997 | 'type' => Controls_Manager::SWITCHER, |
| 998 | 'label_on' => esc_html__( 'Show', 'essential-addons-for-elementor-lite' ), |
| 999 | 'label_off' => esc_html__( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 1000 | 'return_value' => 'yes', |
| 1001 | 'default' => 'no', |
| 1002 | ] |
| 1003 | ); |
| 1004 | } |
| 1005 | |
| 1006 | $this->end_controls_section(); |
| 1007 | } |
| 1008 | |
| 1009 | protected function init_content_image_controls() |
| 1010 | { |
| 1011 | $this->start_controls_section( |
| 1012 | 'eael_section_product_grid_image_settings', |
| 1013 | [ |
| 1014 | 'label' => esc_html__( 'Image', 'essential-addons-for-elementor-lite' ), |
| 1015 | ] |
| 1016 | ); |
| 1017 | |
| 1018 | $this->add_responsive_control( |
| 1019 | 'eael_product_grid_show_secondary_image', |
| 1020 | [ |
| 1021 | 'label' => __( 'Secondary Image on Hover', 'essential-addons-for-elementor-lite' ), |
| 1022 | 'type' => Controls_Manager::SWITCHER, |
| 1023 | 'default' => 'no', |
| 1024 | 'label_on' => __( 'Show', 'essential-addons-for-elementor-lite' ), |
| 1025 | 'label_off' => __( 'Hide', 'essential-addons-for-elementor-lite' ), |
| 1026 | 'return_value' => 'yes', |
| 1027 | 'description' => __( 'Enable to show a secondary image from the product gallery on hover.', 'essential-addons-for-elementor-lite' ), |
| 1028 | ] |
| 1029 | ); |
| 1030 | |
| 1031 | $this->add_group_control( |
| 1032 | Group_Control_Image_Size::get_type(), |
| 1033 | [ |
| 1034 | 'name' => 'eael_product_grid_image_size', |
| 1035 | 'exclude' => [ 'custom' ], |
| 1036 | 'default' => 'medium', |
| 1037 | 'label_block' => true, |
| 1038 | ] |
| 1039 | ); |
| 1040 | |
| 1041 | $this->add_control( |
| 1042 | 'eael_product_grid_image_height', |
| 1043 | [ |
| 1044 | 'label' => esc_html__( 'Height', 'essential-addons-for-elementor-lite' ), |
| 1045 | 'type' => Controls_Manager::SLIDER, |
| 1046 | 'range' => [ |
| 1047 | 'px' => [ |
| 1048 | 'min' => 0, |
| 1049 | 'max' => 1000, |
| 1050 | ], |
| 1051 | '%' => [ |
| 1052 | 'min' => 0, |
| 1053 | 'max' => 100, |
| 1054 | ], |
| 1055 | 'em' => [ |
| 1056 | 'min' => 0, |
| 1057 | 'max' => 100, |
| 1058 | ], |
| 1059 | ], |
| 1060 | 'selectors' => [ |
| 1061 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product img' => 'height: {{SIZE}}{{UNIT}};', |
| 1062 | ], |
| 1063 | ] |
| 1064 | ); |
| 1065 | |
| 1066 | $this->add_control( |
| 1067 | 'eael_product_grid_image_object_fitting', |
| 1068 | [ |
| 1069 | 'label' => esc_html__( 'Render Type', 'essential-addons-for-elementor-lite' ), |
| 1070 | 'type' => Controls_Manager::CHOOSE, |
| 1071 | 'options' => [ |
| 1072 | 'fill' => [ |
| 1073 | 'title' => esc_html__( 'Stretched', 'essential-addons-for-elementor-lite' ), |
| 1074 | 'icon' => 'eicon-image', |
| 1075 | ], |
| 1076 | 'cover' => [ |
| 1077 | 'title' => esc_html__( 'Cropped', 'essential-addons-for-elementor-lite' ), |
| 1078 | 'icon' => 'eicon-frame-expand', |
| 1079 | ], |
| 1080 | 'contain' => [ |
| 1081 | 'title' => esc_html__( 'Contain', 'essential-addons-for-elementor-lite' ), |
| 1082 | 'icon' => 'eicon-frame-minimize', |
| 1083 | ], |
| 1084 | ], |
| 1085 | 'default' => 'fill', |
| 1086 | 'toggle' => true, |
| 1087 | 'condition' => [ |
| 1088 | 'eael_product_grid_image_height[size]!' => '', |
| 1089 | ], |
| 1090 | 'selectors' => [ |
| 1091 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product img' => 'object-fit: {{VALUE}}', |
| 1092 | ], |
| 1093 | ] |
| 1094 | ); |
| 1095 | |
| 1096 | $this->add_control( |
| 1097 | 'eael_product_grid_image_object_position', |
| 1098 | [ |
| 1099 | 'label' => esc_html__( 'Position', 'essential-addons-for-elementor-lite' ), |
| 1100 | 'type' => Controls_Manager::CHOOSE, |
| 1101 | 'options' => [ |
| 1102 | 'top' => [ |
| 1103 | 'title' => esc_html__( 'Top', 'essential-addons-for-elementor-lite' ), |
| 1104 | 'icon' => 'eicon-v-align-top', |
| 1105 | ], |
| 1106 | 'center' => [ |
| 1107 | 'title' => esc_html__( 'Center', 'essential-addons-for-elementor-lite' ), |
| 1108 | 'icon' => 'eicon-v-align-middle', |
| 1109 | ], |
| 1110 | 'bottom' => [ |
| 1111 | 'title' => esc_html__( 'Bottom', 'essential-addons-for-elementor-lite' ), |
| 1112 | 'icon' => 'eicon-v-align-bottom', |
| 1113 | ], |
| 1114 | ], |
| 1115 | 'default' => 'center', |
| 1116 | 'toggle' => true, |
| 1117 | 'selectors' => [ |
| 1118 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product img' => 'object-position: {{VALUE}}', |
| 1119 | ], |
| 1120 | 'condition' => [ |
| 1121 | 'eael_product_grid_image_object_fitting' => 'cover', |
| 1122 | 'eael_product_grid_image_height[size]!' => '', |
| 1123 | ], |
| 1124 | ] |
| 1125 | ); |
| 1126 | |
| 1127 | $this->end_controls_section(); |
| 1128 | } |
| 1129 | |
| 1130 | protected function init_content_addtocart_controls() |
| 1131 | { |
| 1132 | $this->start_controls_section( |
| 1133 | 'eael_product_grid_add_to_cart_section', |
| 1134 | [ |
| 1135 | 'label' => esc_html__('Add To Cart', 'essential-addons-for-elementor-lite'), |
| 1136 | ] |
| 1137 | ); |
| 1138 | |
| 1139 | $this->add_control( |
| 1140 | 'show_add_to_cart_custom_text', |
| 1141 | [ |
| 1142 | 'label' => __('Custom text', 'essential-addons-for-elementor-lite'), |
| 1143 | 'type' => Controls_Manager::SWITCHER, |
| 1144 | 'return_value' => 'true', |
| 1145 | 'default' => '', |
| 1146 | ] |
| 1147 | ); |
| 1148 | |
| 1149 | $this->add_control( |
| 1150 | 'add_to_cart_simple_product_button_text', |
| 1151 | [ |
| 1152 | 'label' => esc_html__('Simple Product', 'essential-addons-for-elementor-lite'), |
| 1153 | 'type' => Controls_Manager::TEXT, |
| 1154 | 'dynamic' => ['active' => true], |
| 1155 | 'label_block' => false, |
| 1156 | 'default' => esc_html__('Buy Now', 'essential-addons-for-elementor-lite'), |
| 1157 | 'condition' => [ |
| 1158 | 'show_add_to_cart_custom_text' => 'true', |
| 1159 | ], |
| 1160 | 'ai' => [ |
| 1161 | 'active' => true, |
| 1162 | ], |
| 1163 | ] |
| 1164 | ); |
| 1165 | $this->add_control( |
| 1166 | 'add_to_cart_variable_product_button_text', |
| 1167 | [ |
| 1168 | 'label' => esc_html__('Variable Product', 'essential-addons-for-elementor-lite'), |
| 1169 | 'type' => Controls_Manager::TEXT, |
| 1170 | 'dynamic' => ['active' => true], |
| 1171 | 'label_block' => false, |
| 1172 | 'default' => esc_html__('Select options', 'essential-addons-for-elementor-lite'), |
| 1173 | 'condition' => [ |
| 1174 | 'show_add_to_cart_custom_text' => 'true', |
| 1175 | ], |
| 1176 | 'ai' => [ |
| 1177 | 'active' => true, |
| 1178 | ], |
| 1179 | ] |
| 1180 | ); |
| 1181 | $this->add_control( |
| 1182 | 'add_to_cart_grouped_product_button_text', |
| 1183 | [ |
| 1184 | 'label' => esc_html__('Grouped Product', 'essential-addons-for-elementor-lite'), |
| 1185 | 'type' => Controls_Manager::TEXT, |
| 1186 | 'dynamic' => ['active' => true], |
| 1187 | 'label_block' => false, |
| 1188 | 'default' => esc_html__('View products', 'essential-addons-for-elementor-lite'), |
| 1189 | 'condition' => [ |
| 1190 | 'show_add_to_cart_custom_text' => 'true', |
| 1191 | ], |
| 1192 | 'ai' => [ |
| 1193 | 'active' => true, |
| 1194 | ], |
| 1195 | ] |
| 1196 | ); |
| 1197 | $this->add_control( |
| 1198 | 'add_to_cart_external_product_button_text', |
| 1199 | [ |
| 1200 | 'label' => esc_html__('External Product', 'essential-addons-for-elementor-lite'), |
| 1201 | 'type' => Controls_Manager::TEXT, |
| 1202 | 'dynamic' => ['active' => true], |
| 1203 | 'label_block' => false, |
| 1204 | 'default' => esc_html__('Buy Now', 'essential-addons-for-elementor-lite'), |
| 1205 | 'condition' => [ |
| 1206 | 'show_add_to_cart_custom_text' => 'true', |
| 1207 | ], |
| 1208 | 'ai' => [ |
| 1209 | 'active' => true, |
| 1210 | ], |
| 1211 | ] |
| 1212 | ); |
| 1213 | $this->add_control( |
| 1214 | 'add_to_cart_default_product_button_text', |
| 1215 | [ |
| 1216 | 'label' => esc_html__('Default Product', 'essential-addons-for-elementor-lite'), |
| 1217 | 'type' => Controls_Manager::TEXT, |
| 1218 | 'dynamic' => ['active' => true], |
| 1219 | 'label_block' => false, |
| 1220 | 'default' => esc_html__('Read More', 'essential-addons-for-elementor-lite'), |
| 1221 | 'condition' => [ |
| 1222 | 'show_add_to_cart_custom_text' => 'true', |
| 1223 | ], |
| 1224 | 'ai' => [ |
| 1225 | 'active' => true, |
| 1226 | ], |
| 1227 | ] |
| 1228 | ); |
| 1229 | |
| 1230 | $this->end_controls_section(); # end of section 'add to cart' |
| 1231 | } |
| 1232 | |
| 1233 | protected function init_content_load_more_controls() |
| 1234 | { |
| 1235 | $this->start_controls_section('eael_product_grid_load_more_section', [ |
| 1236 | 'label' => esc_html__('Load More', 'essential-addons-for-elementor-lite'), |
| 1237 | 'conditions' => [ |
| 1238 | 'terms' => [ |
| 1239 | [ |
| 1240 | 'relation' => 'or', |
| 1241 | 'terms' => [ |
| 1242 | [ |
| 1243 | 'name' => 'eael_product_grid_layout', |
| 1244 | 'operator' => 'in', |
| 1245 | 'value' => [ 'masonry' ], |
| 1246 | ], |
| 1247 | [ |
| 1248 | 'name' => 'show_pagination', |
| 1249 | 'operator' => '!=', |
| 1250 | 'value' => 'true' |
| 1251 | ], |
| 1252 | ] |
| 1253 | ], |
| 1254 | [ |
| 1255 | 'name' => 'post_type', |
| 1256 | 'operator' => '!==', |
| 1257 | 'value' => 'source_archive' |
| 1258 | ] |
| 1259 | |
| 1260 | ], |
| 1261 | ], |
| 1262 | ]); |
| 1263 | |
| 1264 | $this->add_control( |
| 1265 | 'show_load_more', |
| 1266 | [ |
| 1267 | 'label' => esc_html__( 'Load More', 'essential-addons-for-elementor-lite' ), |
| 1268 | 'type' => Controls_Manager::CHOOSE, |
| 1269 | 'options' => [ |
| 1270 | 'no' => [ |
| 1271 | 'title' => esc_html__( 'Disable', 'essential-addons-for-elementor-lite' ), |
| 1272 | 'icon' => 'eicon-ban', |
| 1273 | ], |
| 1274 | 'true' => [ |
| 1275 | 'title' => esc_html__( 'Button', 'essential-addons-for-elementor-lite' ), |
| 1276 | 'icon' => 'eicon-button', |
| 1277 | ], |
| 1278 | 'infinity' => [ |
| 1279 | 'title' => esc_html__( 'Infinity Scroll', 'essential-addons-for-elementor-lite' ), |
| 1280 | 'icon' => 'eicon-image-box', |
| 1281 | ], |
| 1282 | ], |
| 1283 | 'default' => 'no', |
| 1284 | 'toggle' => false, |
| 1285 | ] |
| 1286 | ); |
| 1287 | |
| 1288 | $this->add_control( |
| 1289 | 'load_more_infinityscroll_offset', |
| 1290 | [ |
| 1291 | 'label' => esc_html__('Scroll Offset (px)', 'essential-addons-for-elementor-lite'), |
| 1292 | 'type' => Controls_Manager::NUMBER, |
| 1293 | 'dynamic' => [ 'active' => false ], |
| 1294 | 'label_block' => false, |
| 1295 | 'default' => '-200', |
| 1296 | 'description' => esc_html__('Set the position of loading to the viewport before it ends from view', 'essential-addons-for-elementor-lite'), |
| 1297 | 'condition' => [ |
| 1298 | 'show_load_more' => 'infinity', |
| 1299 | ], |
| 1300 | ] |
| 1301 | ); |
| 1302 | |
| 1303 | $this->add_control('show_load_more_text', [ |
| 1304 | 'label' => esc_html__('Label Text', 'essential-addons-for-elementor-lite'), |
| 1305 | 'type' => Controls_Manager::TEXT, |
| 1306 | 'label_block' => false, |
| 1307 | 'default' => esc_html__('Load More', 'essential-addons-for-elementor-lite'), |
| 1308 | 'ai' => [ 'active' => true ], |
| 1309 | 'condition' => [ |
| 1310 | 'show_load_more' => 'true', |
| 1311 | ], |
| 1312 | ]); |
| 1313 | |
| 1314 | $this->end_controls_section(); # end of section 'Load More' |
| 1315 | } |
| 1316 | |
| 1317 | protected function init_style_product_controls() |
| 1318 | { |
| 1319 | $this->start_controls_section( |
| 1320 | 'eael_product_grid_styles', |
| 1321 | [ |
| 1322 | 'label' => esc_html__('Products', 'essential-addons-for-elementor-lite'), |
| 1323 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1324 | ] |
| 1325 | ); |
| 1326 | |
| 1327 | $this->add_responsive_control( |
| 1328 | 'eael_product_grid_content_alignment', |
| 1329 | [ |
| 1330 | 'label' => __('Alignment', 'essential-addons-for-elementor-lite'), |
| 1331 | 'type' => Controls_Manager::CHOOSE, |
| 1332 | 'options' => [ |
| 1333 | 'left' => [ |
| 1334 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 1335 | 'icon' => 'eicon-text-align-left', |
| 1336 | ], |
| 1337 | 'center' => [ |
| 1338 | 'title' => __('Center', 'essential-addons-for-elementor-lite'), |
| 1339 | 'icon' => 'eicon-text-align-center', |
| 1340 | ], |
| 1341 | 'right' => [ |
| 1342 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 1343 | 'icon' => 'eicon-text-align-right', |
| 1344 | ], |
| 1345 | ], |
| 1346 | 'default' => 'center', |
| 1347 | 'toggle' => true, |
| 1348 | 'selectors' => [ |
| 1349 | '{{WRAPPER}} .eael-product-grid:not(.list) .woocommerce ul.products li.product' => 'text-align: {{VALUE}};', |
| 1350 | '{{WRAPPER}} .eael-product-grid:not(.list) .woocommerce ul.products li.product .star-rating' => 'margin-{{VALUE}}: 0;', |
| 1351 | ], |
| 1352 | 'conditions' => [ |
| 1353 | 'relation' => 'and', |
| 1354 | 'terms' => [ |
| 1355 | [ |
| 1356 | 'name' => 'eael_product_grid_layout', |
| 1357 | 'operator' => '!=', |
| 1358 | 'value' => [ |
| 1359 | 'list', |
| 1360 | ], |
| 1361 | ], |
| 1362 | [ |
| 1363 | 'name' => 'eael_product_grid_style_preset', |
| 1364 | 'operator' => 'in', |
| 1365 | 'value' => [ |
| 1366 | 'eael-product-default', |
| 1367 | 'eael-product-simple', |
| 1368 | 'eael-product-reveal', |
| 1369 | 'eael-product-overlay', |
| 1370 | ] |
| 1371 | ], |
| 1372 | ], |
| 1373 | ], |
| 1374 | ] |
| 1375 | ); |
| 1376 | |
| 1377 | $this->add_control( |
| 1378 | 'eael_product_grid_background_color', |
| 1379 | [ |
| 1380 | 'label' => esc_html__('Content Background Color', 'essential-addons-for-elementor-lite'), |
| 1381 | 'type' => Controls_Manager::COLOR, |
| 1382 | 'default' => '#fff', |
| 1383 | 'selectors' => [ |
| 1384 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product, {{WRAPPER}} .eael-product-grid .icons-wrap.block-box-style' => 'background-color: {{VALUE}};', |
| 1385 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product.eael-product-list-preset-4 .product-details-wrap' => 'background-color: {{VALUE}};', |
| 1386 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product.eael-product-list-preset-3, {{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product.eael-product-list-preset-4' |
| 1387 | => 'background-color: transparent;', |
| 1388 | ], |
| 1389 | 'conditions' => [ |
| 1390 | 'relation' => 'and', |
| 1391 | 'terms' => [ |
| 1392 | [ |
| 1393 | 'name' => 'eael_product_grid_layout', |
| 1394 | 'operator' => 'in', |
| 1395 | 'value' => [ |
| 1396 | 'grid', |
| 1397 | 'list', |
| 1398 | 'masonry', |
| 1399 | ], |
| 1400 | ], |
| 1401 | [ |
| 1402 | 'name' => 'eael_product_list_style_preset', |
| 1403 | 'operator' => '!=', |
| 1404 | 'value' => [ |
| 1405 | 'eael-product-list-preset-3', |
| 1406 | ] |
| 1407 | ], |
| 1408 | ], |
| 1409 | ], |
| 1410 | ] |
| 1411 | ); |
| 1412 | |
| 1413 | $this->add_control( |
| 1414 | 'eael_product_grid_border_color', |
| 1415 | [ |
| 1416 | 'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'), |
| 1417 | 'type' => Controls_Manager::COLOR, |
| 1418 | 'default' => '#ada8a8', |
| 1419 | 'selectors' => [ |
| 1420 | '{{WRAPPER}} .eael-product-grid .price-wrap, {{WRAPPER}} .eael-product-grid .title-wrap' => 'border-color: {{VALUE}};', |
| 1421 | ], |
| 1422 | 'conditions' => [ |
| 1423 | 'relation' => 'and', |
| 1424 | 'terms' => [ |
| 1425 | [ |
| 1426 | 'name' => 'eael_product_grid_layout', |
| 1427 | 'operator' => '!in', |
| 1428 | 'value' => [ |
| 1429 | 'grid', |
| 1430 | 'masonry', |
| 1431 | ], |
| 1432 | ], |
| 1433 | [ |
| 1434 | 'name' => 'eael_product_list_style_preset', |
| 1435 | 'operator' => '==', |
| 1436 | 'value' => 'eael-product-list-preset-3', |
| 1437 | ], |
| 1438 | ], |
| 1439 | ], |
| 1440 | ] |
| 1441 | ); |
| 1442 | |
| 1443 | $this->add_responsive_control( |
| 1444 | 'eael_peoduct_grid_padding', |
| 1445 | [ |
| 1446 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 1447 | 'type' => Controls_Manager::DIMENSIONS, |
| 1448 | 'size_units' => ['px', '%', 'em'], |
| 1449 | 'selectors' => [ |
| 1450 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1451 | ], |
| 1452 | 'conditions' => [ |
| 1453 | 'relation' => 'and', |
| 1454 | 'terms' => [ |
| 1455 | [ |
| 1456 | 'name' => 'eael_product_grid_layout', |
| 1457 | 'operator' => '!=', |
| 1458 | 'value' => [ |
| 1459 | 'list', |
| 1460 | ], |
| 1461 | ], |
| 1462 | [ |
| 1463 | 'name' => 'eael_product_grid_style_preset', |
| 1464 | 'operator' => 'in', |
| 1465 | 'value' => [ |
| 1466 | 'eael-product-default', |
| 1467 | 'eael-product-simple', |
| 1468 | 'eael-product-reveal', |
| 1469 | 'eael-product-overlay', |
| 1470 | ] |
| 1471 | ], |
| 1472 | ], |
| 1473 | ], |
| 1474 | ] |
| 1475 | ); |
| 1476 | |
| 1477 | $this->start_controls_tabs('eael_product_grid_tabs', [ |
| 1478 | 'conditions' => [ |
| 1479 | 'relation' => 'or', |
| 1480 | 'terms' => [ |
| 1481 | [ |
| 1482 | 'name' => 'eael_product_grid_layout', |
| 1483 | 'operator' => 'in', |
| 1484 | 'value' => [ |
| 1485 | 'grid', |
| 1486 | 'mesonry', |
| 1487 | ] |
| 1488 | ], |
| 1489 | [ |
| 1490 | 'name' => 'eael_product_list_style_preset', |
| 1491 | 'operator' => '!in', |
| 1492 | 'value' => [ |
| 1493 | 'eael-product-list-preset-3', |
| 1494 | 'eael-product-list-preset-4', |
| 1495 | ] |
| 1496 | ] |
| 1497 | ] |
| 1498 | ], |
| 1499 | ]); |
| 1500 | |
| 1501 | $this->start_controls_tab('eael_product_grid_tabs_normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]); |
| 1502 | |
| 1503 | $this->add_group_control( |
| 1504 | Group_Control_Border::get_type(), |
| 1505 | [ |
| 1506 | 'name' => 'eael_peoduct_grid_border', |
| 1507 | 'fields_options' => [ |
| 1508 | 'border' => [ |
| 1509 | 'default' => 'solid', |
| 1510 | ], |
| 1511 | 'width' => [ |
| 1512 | 'default' => [ |
| 1513 | 'top' => '1', |
| 1514 | 'right' => '1', |
| 1515 | 'bottom' => '1', |
| 1516 | 'left' => '1', |
| 1517 | 'isLinked' => false, |
| 1518 | ], |
| 1519 | ], |
| 1520 | 'color' => [ |
| 1521 | 'default' => '#eee', |
| 1522 | ], |
| 1523 | ], |
| 1524 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product', |
| 1525 | 'condition' => [ |
| 1526 | 'eael_product_grid_style_preset' => [ |
| 1527 | 'eael-product-default', |
| 1528 | 'eael-product-simple', |
| 1529 | 'eael-product-overlay', |
| 1530 | 'eael-product-preset-5', |
| 1531 | 'eael-product-preset-6', |
| 1532 | 'eael-product-preset-7', |
| 1533 | 'eael-product-preset-8', |
| 1534 | ] |
| 1535 | ], |
| 1536 | ] |
| 1537 | ); |
| 1538 | |
| 1539 | $this->add_group_control( |
| 1540 | Group_Control_Box_Shadow::get_type(), |
| 1541 | [ |
| 1542 | 'name' => 'eael_peoduct_grid_shadow', |
| 1543 | 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'), |
| 1544 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product', |
| 1545 | ] |
| 1546 | ); |
| 1547 | |
| 1548 | |
| 1549 | $this->end_controls_tab(); |
| 1550 | |
| 1551 | $this->start_controls_tab('eael_product_grid_hover_styles', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]); |
| 1552 | |
| 1553 | $this->add_control( |
| 1554 | 'eael_product_grid_hover_border_color', |
| 1555 | [ |
| 1556 | 'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'), |
| 1557 | 'type' => Controls_Manager::COLOR, |
| 1558 | 'default' => '', |
| 1559 | 'selectors' => [ |
| 1560 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product:hover' => 'border-color: {{VALUE}};', |
| 1561 | ], |
| 1562 | 'condition' => [ |
| 1563 | 'eael_peoduct_grid_border_border!' => '', |
| 1564 | ], |
| 1565 | ] |
| 1566 | ); |
| 1567 | $this->add_group_control( |
| 1568 | Group_Control_Box_Shadow::get_type(), |
| 1569 | [ |
| 1570 | 'name' => 'eael_product_grid_box_shadow_hover', |
| 1571 | 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'), |
| 1572 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product:hover', |
| 1573 | ] |
| 1574 | ); |
| 1575 | |
| 1576 | $this->end_controls_tab(); |
| 1577 | |
| 1578 | $this->end_controls_tabs(); |
| 1579 | |
| 1580 | $this->add_control( |
| 1581 | 'eael_peoduct_grid_border_radius', |
| 1582 | [ |
| 1583 | 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'), |
| 1584 | 'type' => Controls_Manager::DIMENSIONS, |
| 1585 | 'selectors' => [ |
| 1586 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', |
| 1587 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product woocommerce-loop-product__link img' => 'border-radius: {{TOP}}px {{RIGHT}}px 0 0;', |
| 1588 | '{{WRAPPER}} .eael-product-grid.list .woocommerce ul.products li.product .woocommerce-loop-product__link img' => 'border-radius: {{TOP}}px 0 0 {{LEFT}}px;', |
| 1589 | ], |
| 1590 | ] |
| 1591 | ); |
| 1592 | |
| 1593 | $this->add_responsive_control( |
| 1594 | 'eael_product_grid_image_width', |
| 1595 | [ |
| 1596 | 'label' => esc_html__('Image Width(%)', 'essential-addons-for-elementor-lite'), |
| 1597 | 'type' => Controls_Manager::SLIDER, |
| 1598 | 'range' => [ |
| 1599 | '%' => [ |
| 1600 | 'max' => 50, |
| 1601 | ], |
| 1602 | ], |
| 1603 | 'selectors' => [ |
| 1604 | '{{WRAPPER}} .eael-product-grid.list .eael-product-wrap .product-image-wrap' => 'width: {{SIZE}}%;', |
| 1605 | ], |
| 1606 | 'condition' => [ |
| 1607 | 'eael_product_grid_layout' => 'list', |
| 1608 | ], |
| 1609 | 'separator' => 'before', |
| 1610 | ] |
| 1611 | ); |
| 1612 | |
| 1613 | $this->add_control( |
| 1614 | 'eael_product_grid_details_heading', |
| 1615 | [ |
| 1616 | 'label' => __('Product Details', 'essential-addons-for-elementor-lite'), |
| 1617 | 'type' => Controls_Manager::HEADING, |
| 1618 | 'separator' => 'before', |
| 1619 | 'conditions' => [ |
| 1620 | 'relation' => 'and', |
| 1621 | 'terms' => [ |
| 1622 | [ |
| 1623 | 'name' => 'eael_product_grid_layout', |
| 1624 | 'operator' => 'in', |
| 1625 | 'value' => [ |
| 1626 | 'grid', |
| 1627 | 'list', |
| 1628 | 'masonry', |
| 1629 | ], |
| 1630 | ], |
| 1631 | [ |
| 1632 | 'name' => 'eael_product_grid_style_preset', |
| 1633 | 'operator' => '!in', |
| 1634 | 'value' => [ |
| 1635 | 'eael-product-default', |
| 1636 | 'eael-product-simple', |
| 1637 | 'eael-product-reveal', |
| 1638 | 'eael-product-overlay', |
| 1639 | ] |
| 1640 | ], |
| 1641 | ], |
| 1642 | ], |
| 1643 | ] |
| 1644 | ); |
| 1645 | |
| 1646 | $this->add_responsive_control( |
| 1647 | 'eael_product_grid_details_alignment', |
| 1648 | [ |
| 1649 | 'label' => __('Alignment', 'essential-addons-for-elementor-lite'), |
| 1650 | 'type' => Controls_Manager::CHOOSE, |
| 1651 | 'options' => [ |
| 1652 | 'left' => [ |
| 1653 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 1654 | 'icon' => 'eicon-text-align-left', |
| 1655 | ], |
| 1656 | 'center' => [ |
| 1657 | 'title' => __('Center', 'essential-addons-for-elementor-lite'), |
| 1658 | 'icon' => 'eicon-text-align-center', |
| 1659 | ], |
| 1660 | 'right' => [ |
| 1661 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 1662 | 'icon' => 'eicon-text-align-right', |
| 1663 | ], |
| 1664 | ], |
| 1665 | 'default' => 'center', |
| 1666 | 'selectors' => [ |
| 1667 | '{{WRAPPER}} .eael-product-grid .product-details-wrap' => 'text-align: {{VALUE}};', |
| 1668 | ], |
| 1669 | 'conditions' => [ |
| 1670 | 'relation' => 'and', |
| 1671 | 'terms' => [ |
| 1672 | [ |
| 1673 | 'name' => 'eael_product_grid_layout', |
| 1674 | 'operator' => '!=', |
| 1675 | 'value' => [ |
| 1676 | 'list', |
| 1677 | ], |
| 1678 | ], |
| 1679 | [ |
| 1680 | 'name' => 'eael_product_grid_style_preset', |
| 1681 | 'operator' => '!in', |
| 1682 | 'value' => [ |
| 1683 | 'eael-product-default', |
| 1684 | 'eael-product-simple', |
| 1685 | 'eael-product-reveal', |
| 1686 | 'eael-product-overlay', |
| 1687 | ] |
| 1688 | ], |
| 1689 | ], |
| 1690 | ], |
| 1691 | ] |
| 1692 | ); |
| 1693 | |
| 1694 | $this->add_responsive_control( |
| 1695 | 'eael_product_grid_inner_padding', |
| 1696 | [ |
| 1697 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 1698 | 'type' => Controls_Manager::DIMENSIONS, |
| 1699 | 'size_units' => ['px', '%'], |
| 1700 | 'range' => [ |
| 1701 | 'px' => [ |
| 1702 | 'min' => 0, |
| 1703 | 'max' => 100, |
| 1704 | 'step' => 1, |
| 1705 | ], |
| 1706 | '%' => [ |
| 1707 | 'min' => 0, |
| 1708 | 'max' => 100, |
| 1709 | ], |
| 1710 | ], |
| 1711 | 'default' => [ |
| 1712 | 'top' => '15', |
| 1713 | 'right' => '15', |
| 1714 | 'bottom' => '15', |
| 1715 | 'left' => '15', |
| 1716 | 'unit' => 'px', |
| 1717 | 'isLinked' => true, |
| 1718 | ], |
| 1719 | 'selectors' => [ |
| 1720 | '{{WRAPPER}} .eael-product-grid.grid .eael-product-wrap .product-details-wrap, {{WRAPPER}} .eael-product-grid.masonry .eael-product-wrap .product-details-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1721 | ], |
| 1722 | 'conditions' => [ |
| 1723 | 'relation' => 'and', |
| 1724 | 'terms' => [ |
| 1725 | [ |
| 1726 | 'name' => 'eael_product_grid_layout', |
| 1727 | 'operator' => '!=', |
| 1728 | 'value' => [ |
| 1729 | 'list', |
| 1730 | ], |
| 1731 | ], |
| 1732 | [ |
| 1733 | 'name' => 'eael_product_grid_style_preset', |
| 1734 | 'operator' => '!in', |
| 1735 | 'value' => [ |
| 1736 | 'eael-product-default', |
| 1737 | 'eael-product-simple', |
| 1738 | 'eael-product-reveal', |
| 1739 | 'eael-product-overlay', |
| 1740 | ] |
| 1741 | ], |
| 1742 | ], |
| 1743 | ], |
| 1744 | ] |
| 1745 | ); |
| 1746 | |
| 1747 | $this->add_responsive_control( |
| 1748 | 'eael_product_list_padding', |
| 1749 | [ |
| 1750 | 'label' => esc_html__('Padding (PX)', 'essential-addons-for-elementor-lite'), |
| 1751 | 'type' => Controls_Manager::SLIDER, |
| 1752 | 'range' => [ |
| 1753 | 'px' => [ |
| 1754 | 'max' => 100, |
| 1755 | ], |
| 1756 | ], |
| 1757 | 'selectors' => [ |
| 1758 | '{{WRAPPER}} .eael-product-grid.list .eael-product-list-preset-1 .eael-product-wrap .product-details-wrap, {{WRAPPER}} .eael-product-grid.list .eael-product-list-preset-4 .eael-product-wrap .product-details-wrap' => 'padding: {{SIZE}}px;', |
| 1759 | '{{WRAPPER}} .eael-product-grid.list .eael-product-list-preset-2 .eael-product-wrap' => 'padding: {{SIZE}}px;', |
| 1760 | '{{WRAPPER}} .eael-product-grid.list .eael-product-list-preset-2 .eael-product-wrap .product-details-wrap' => 'padding: 0 0 0 {{SIZE}}px;', |
| 1761 | '{{WRAPPER}} .eael-product-grid.list .eael-product-list-preset-3 .eael-product-wrap .product-details-wrap' => 'padding: 0 0 0 {{SIZE}}px;', |
| 1762 | ], |
| 1763 | 'condition' => [ |
| 1764 | 'eael_product_grid_layout' => 'list', |
| 1765 | ], |
| 1766 | ] |
| 1767 | ); |
| 1768 | |
| 1769 | $this->add_responsive_control( |
| 1770 | 'eael_product_list_content_width', |
| 1771 | [ |
| 1772 | 'label' => esc_html__('Width (%)', 'essential-addons-for-elementor-lite'), |
| 1773 | 'type' => Controls_Manager::SLIDER, |
| 1774 | 'range' => [ |
| 1775 | '%' => [ |
| 1776 | 'max' => 100, |
| 1777 | ], |
| 1778 | ], |
| 1779 | 'selectors' => [ |
| 1780 | '{{WRAPPER}} .eael-product-grid.list .eael-product-wrap .product-details-wrap' => 'width: {{SIZE}}%;', |
| 1781 | ], |
| 1782 | 'condition' => [ |
| 1783 | 'eael_product_grid_layout' => 'list', |
| 1784 | ], |
| 1785 | ] |
| 1786 | ); |
| 1787 | |
| 1788 | $this->end_controls_section(); |
| 1789 | } |
| 1790 | |
| 1791 | protected function init_style_color_typography_controls() |
| 1792 | { |
| 1793 | |
| 1794 | $this->start_controls_section( |
| 1795 | 'eael_section_product_grid_typography', |
| 1796 | [ |
| 1797 | 'label' => esc_html__('Color & Typography', 'essential-addons-for-elementor-lite'), |
| 1798 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1799 | ] |
| 1800 | ); |
| 1801 | |
| 1802 | $this->add_control( |
| 1803 | 'eael_product_grid_product_title_heading', |
| 1804 | [ |
| 1805 | 'label' => __('Product Title', 'essential-addons-for-elementor-lite'), |
| 1806 | 'type' => Controls_Manager::HEADING, |
| 1807 | ] |
| 1808 | ); |
| 1809 | |
| 1810 | $this->add_control( |
| 1811 | 'eael_product_grid_product_title_color', |
| 1812 | [ |
| 1813 | 'label' => esc_html__('Product Title Color', 'essential-addons-for-elementor-lite'), |
| 1814 | 'type' => Controls_Manager::COLOR, |
| 1815 | 'default' => '#272727', |
| 1816 | 'selectors' => [ |
| 1817 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title, {{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .eael-product-title h2' => 'color: {{VALUE}};', |
| 1818 | ], |
| 1819 | ] |
| 1820 | ); |
| 1821 | |
| 1822 | $this->add_group_control( |
| 1823 | Group_Control_Typography::get_type(), |
| 1824 | [ |
| 1825 | 'name' => 'eael_product_grid_product_title_typography', |
| 1826 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .woocommerce-loop-product__title, {{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .eael-product-title h2', |
| 1827 | ] |
| 1828 | ); |
| 1829 | |
| 1830 | $this->add_control( |
| 1831 | 'eael_product_grid_product_price_heading', |
| 1832 | [ |
| 1833 | 'label' => __('Product Price', 'essential-addons-for-elementor-lite'), |
| 1834 | 'type' => Controls_Manager::HEADING, |
| 1835 | ] |
| 1836 | ); |
| 1837 | |
| 1838 | $this->add_control( |
| 1839 | 'eael_product_grid_product_price_color', |
| 1840 | [ |
| 1841 | 'label' => esc_html__('Price Color', 'essential-addons-for-elementor-lite'), |
| 1842 | 'type' => Controls_Manager::COLOR, |
| 1843 | 'default' => '#272727', |
| 1844 | 'selectors' => [ |
| 1845 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price, {{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .eael-product-price' => 'color: {{VALUE}};', |
| 1846 | ], |
| 1847 | ] |
| 1848 | ); |
| 1849 | |
| 1850 | $this->add_control( |
| 1851 | 'eael_product_grid_product_sale_price_color', |
| 1852 | [ |
| 1853 | 'label' => esc_html__('Sale Price Color', 'essential-addons-for-elementor-lite'), |
| 1854 | 'type' => Controls_Manager::COLOR, |
| 1855 | 'selectors' => [ |
| 1856 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price ins, {{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .eael-product-price ins' => 'color: {{VALUE}};', |
| 1857 | ], |
| 1858 | ] |
| 1859 | ); |
| 1860 | |
| 1861 | $this->add_group_control( |
| 1862 | Group_Control_Typography::get_type(), |
| 1863 | [ |
| 1864 | 'name' => 'eael_product_grid_product_price_typography', |
| 1865 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .price,{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .eael-product-price', |
| 1866 | ] |
| 1867 | ); |
| 1868 | |
| 1869 | $this->add_control( |
| 1870 | 'eael_product_grid_product_rating_heading', |
| 1871 | [ |
| 1872 | 'label' => __('Star Rating', 'essential-addons-for-elementor-lite'), |
| 1873 | 'type' => Controls_Manager::HEADING, |
| 1874 | ] |
| 1875 | ); |
| 1876 | |
| 1877 | $this->add_control( |
| 1878 | 'eael_product_grid_product_rating_color', |
| 1879 | [ |
| 1880 | 'label' => esc_html__('Rating Color', 'essential-addons-for-elementor-lite'), |
| 1881 | 'type' => Controls_Manager::COLOR, |
| 1882 | 'default' => '#f2b01e', |
| 1883 | 'selectors' => [ |
| 1884 | '{{WRAPPER}} .eael-product-grid .woocommerce .star-rating::before' => 'color: {{VALUE}};', |
| 1885 | '{{WRAPPER}} .eael-product-grid .woocommerce .star-rating span::before' => 'color: {{VALUE}};', |
| 1886 | '{{WRAPPER}} .eael-product-grid .woocommerce .eael-star-rating' => 'color: {{VALUE}};', |
| 1887 | ], |
| 1888 | ] |
| 1889 | ); |
| 1890 | |
| 1891 | $this->add_group_control( |
| 1892 | Group_Control_Typography::get_type(), |
| 1893 | [ |
| 1894 | 'name' => 'eael_product_grid_product_rating_typography', |
| 1895 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .star-rating,{{WRAPPER}} .eael-product-grid .woocommerce .eael-star-rating', |
| 1896 | 'conditions' => [ |
| 1897 | 'relation' => 'or', |
| 1898 | 'terms' => [ |
| 1899 | [ |
| 1900 | 'name' => 'eael_product_grid_style_preset', |
| 1901 | 'operator' => '!in', |
| 1902 | 'value' => [ |
| 1903 | 'eael-product-preset-5', |
| 1904 | 'eael-product-preset-6', |
| 1905 | 'eael-product-preset-7', |
| 1906 | 'eael-product-preset-8', |
| 1907 | ], |
| 1908 | ], |
| 1909 | [ |
| 1910 | 'name' => 'eael_product_grid_layout', |
| 1911 | 'operator' => '!==', |
| 1912 | 'value' => 'list' |
| 1913 | ] |
| 1914 | ], |
| 1915 | ], |
| 1916 | ] |
| 1917 | ); |
| 1918 | |
| 1919 | $this->add_responsive_control( |
| 1920 | 'eael_product_grid_product_rating_size', |
| 1921 | [ |
| 1922 | 'label' => esc_html__('Icon Size', 'essential-addons-for-elementor-lite'), |
| 1923 | 'type' => Controls_Manager::SLIDER, |
| 1924 | 'range' => [ |
| 1925 | 'px' => [ |
| 1926 | 'max' => 50, |
| 1927 | ], |
| 1928 | ], |
| 1929 | 'default' => [ |
| 1930 | 'size' => 15, |
| 1931 | ], |
| 1932 | 'selectors' => [ |
| 1933 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .star-rating' => 'font-size: {{SIZE}}px!important;', |
| 1934 | ], |
| 1935 | 'conditions' => [ |
| 1936 | 'relation' => 'or', |
| 1937 | 'terms' => [ |
| 1938 | [ |
| 1939 | 'name' => 'eael_product_grid_style_preset', |
| 1940 | 'operator' => 'in', |
| 1941 | 'value' => [ |
| 1942 | 'eael-product-preset-5', |
| 1943 | 'eael-product-preset-6', |
| 1944 | 'eael-product-preset-7', |
| 1945 | ], |
| 1946 | ], |
| 1947 | [ |
| 1948 | 'name' => 'eael_product_grid_layout', |
| 1949 | 'operator' => '==', |
| 1950 | 'value' => 'list' |
| 1951 | ] |
| 1952 | ], |
| 1953 | ], |
| 1954 | ] |
| 1955 | ); |
| 1956 | |
| 1957 | $this->add_control( |
| 1958 | 'eael_product_grid_product_desc_heading', |
| 1959 | [ |
| 1960 | 'label' => __('Product Description', 'essential-addons-for-elementor-lite'), |
| 1961 | 'type' => Controls_Manager::HEADING, |
| 1962 | 'condition' => [ |
| 1963 | 'eael_product_grid_layout' => 'list', |
| 1964 | 'eael_product_grid_excerpt' => 'yes', |
| 1965 | ], |
| 1966 | ] |
| 1967 | ); |
| 1968 | |
| 1969 | $this->add_control( |
| 1970 | 'eael_product_grid_product_desc_color', |
| 1971 | [ |
| 1972 | 'label' => esc_html__('Color', 'essential-addons-for-elementor-lite'), |
| 1973 | 'type' => Controls_Manager::COLOR, |
| 1974 | 'default' => '#272727', |
| 1975 | 'selectors' => [ |
| 1976 | '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .eael-product-excerpt' => 'color: {{VALUE}};', |
| 1977 | ], |
| 1978 | 'condition' => [ |
| 1979 | 'eael_product_grid_layout' => 'list', |
| 1980 | 'eael_product_grid_excerpt' => 'yes', |
| 1981 | ], |
| 1982 | ] |
| 1983 | ); |
| 1984 | |
| 1985 | $this->add_group_control( |
| 1986 | Group_Control_Typography::get_type(), |
| 1987 | [ |
| 1988 | 'name' => 'eael_product_grid_product_desc_typography', |
| 1989 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce ul.products li.product .eael-product-excerpt', |
| 1990 | 'condition' => [ |
| 1991 | 'eael_product_grid_layout' => 'list', |
| 1992 | 'eael_product_grid_excerpt' => 'yes', |
| 1993 | ], |
| 1994 | ] |
| 1995 | ); |
| 1996 | |
| 1997 | do_action( 'eael/product_grid/style_settings/control/after_color_typography', $this ); |
| 1998 | |
| 1999 | $this->end_controls_section(); |
| 2000 | } |
| 2001 | |
| 2002 | protected function sale_badge_style(){ |
| 2003 | $this->start_controls_section( |
| 2004 | 'eael_section_product_grid_sale_badge_style', |
| 2005 | [ |
| 2006 | 'label' => esc_html__('Badges', 'essential-addons-for-elementor-lite'), |
| 2007 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2008 | 'condition' => [ |
| 2009 | 'eael_show_product_sale_badge' => 'yes' |
| 2010 | ] |
| 2011 | ] |
| 2012 | ); |
| 2013 | |
| 2014 | // stock out badge |
| 2015 | $this->add_control( |
| 2016 | 'eael_product_grid_sale_out_badge_heading', |
| 2017 | [ |
| 2018 | 'label' => __('Sale Badge', 'essential-addons-for-elementor-lite'), |
| 2019 | 'type' => Controls_Manager::HEADING, |
| 2020 | ] |
| 2021 | ); |
| 2022 | |
| 2023 | $this->add_control( |
| 2024 | 'eael_product_grid_sale_badge_color', |
| 2025 | [ |
| 2026 | 'label' => esc_html__('Color', 'essential-addons-for-elementor-lite'), |
| 2027 | 'type' => Controls_Manager::COLOR, |
| 2028 | 'default' => '#fff', |
| 2029 | 'selectors' => [ |
| 2030 | '{{WRAPPER}} .woocommerce ul.products li.product .onsale, {{WRAPPER}} .woocommerce ul.products li.product .eael-onsale' => 'color: {{VALUE}};', |
| 2031 | ], |
| 2032 | ] |
| 2033 | ); |
| 2034 | |
| 2035 | $this->add_control( |
| 2036 | 'eael_product_grid_sale_badge_background', |
| 2037 | [ |
| 2038 | 'label' => esc_html__('Background', 'essential-addons-for-elementor-lite'), |
| 2039 | 'type' => Controls_Manager::COLOR, |
| 2040 | 'default' => '#ff2a13', |
| 2041 | 'selectors' => [ |
| 2042 | '{{WRAPPER}} .woocommerce ul.products li.product .onsale, {{WRAPPER}} .woocommerce ul.products li.product .eael-onsale' => 'background-color: {{VALUE}};', |
| 2043 | '{{WRAPPER}} .woocommerce ul.products li.product .eael-onsale:not(.outofstock).sale-preset-4:after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}};', |
| 2044 | ], |
| 2045 | ] |
| 2046 | ); |
| 2047 | |
| 2048 | $this->add_group_control( |
| 2049 | Group_Control_Typography::get_type(), |
| 2050 | [ |
| 2051 | 'name' => 'eael_product_grid_sale_badge_typography', |
| 2052 | 'selector' => '{{WRAPPER}} .woocommerce ul.products li.product .onsale, {{WRAPPER}} .woocommerce ul.products li.product .eael-onsale:not(.outofstock)', |
| 2053 | ] |
| 2054 | ); |
| 2055 | |
| 2056 | // stock out badge |
| 2057 | $this->add_control( |
| 2058 | 'eael_product_grid_stock_out_badge_heading', |
| 2059 | [ |
| 2060 | 'label' => __('Stock Out', 'essential-addons-for-elementor-lite'), |
| 2061 | 'type' => Controls_Manager::HEADING, |
| 2062 | 'separator' => 'before' |
| 2063 | ] |
| 2064 | ); |
| 2065 | |
| 2066 | $this->add_control( |
| 2067 | 'eael_product_grid_stock_out_badge_color', |
| 2068 | [ |
| 2069 | 'label' => esc_html__('Color', 'essential-addons-for-elementor-lite'), |
| 2070 | 'type' => Controls_Manager::COLOR, |
| 2071 | 'default' => '#fff', |
| 2072 | 'selectors' => [ |
| 2073 | '{{WRAPPER}} .woocommerce ul.products li.product .outofstock-badge, {{WRAPPER}} .woocommerce ul.products li.product .eael-onsale.outofstock' => 'color: {{VALUE}};', |
| 2074 | ], |
| 2075 | ] |
| 2076 | ); |
| 2077 | |
| 2078 | $this->add_control( |
| 2079 | 'eael_product_grid_stock_out_badge_background', |
| 2080 | [ |
| 2081 | 'label' => esc_html__('Background', 'essential-addons-for-elementor-lite'), |
| 2082 | 'type' => Controls_Manager::COLOR, |
| 2083 | 'default' => '#ff2a13', |
| 2084 | 'selectors' => [ |
| 2085 | '{{WRAPPER}} .woocommerce ul.products li.product .outofstock-badge, {{WRAPPER}} .woocommerce ul.products li.product .eael-onsale.outofstock' => 'background-color: {{VALUE}};', |
| 2086 | '{{WRAPPER}} .woocommerce ul.products li.product .eael-onsale.outofstock.sale-preset-4:after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}};', |
| 2087 | ], |
| 2088 | ] |
| 2089 | ); |
| 2090 | |
| 2091 | $this->add_group_control( |
| 2092 | Group_Control_Typography::get_type(), |
| 2093 | [ |
| 2094 | 'name' => 'eael_product_grid_stock_out_badge_typography', |
| 2095 | 'selector' => '{{WRAPPER}} .woocommerce ul.products li.product .outofstock-badge, {{WRAPPER}} .woocommerce ul.products li.product .eael-onsale.outofstock', |
| 2096 | ] |
| 2097 | ); |
| 2098 | |
| 2099 | $this->end_controls_section(); |
| 2100 | } |
| 2101 | |
| 2102 | protected function init_style_addtocart_controls() |
| 2103 | { |
| 2104 | // add to cart button |
| 2105 | $this->start_controls_section( |
| 2106 | 'eael_section_product_grid_add_to_cart_styles', |
| 2107 | [ |
| 2108 | 'label' => esc_html__('Add To Cart', 'essential-addons-for-elementor-lite'), |
| 2109 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2110 | 'condition' => [ |
| 2111 | 'eael_product_grid_style_preset!' => [ |
| 2112 | 'eael-product-preset-5', |
| 2113 | 'eael-product-preset-6', |
| 2114 | 'eael-product-preset-7', |
| 2115 | 'eael-product-preset-8', |
| 2116 | ], |
| 2117 | 'eael_product_grid_layout!' => 'list', |
| 2118 | ], |
| 2119 | ] |
| 2120 | ); |
| 2121 | |
| 2122 | $this->add_control( |
| 2123 | 'eael_product_grid_add_to_cart_padding', |
| 2124 | [ |
| 2125 | 'label' => __('Padding', 'essential-addons-for-elementor-lite'), |
| 2126 | 'type' => Controls_Manager::DIMENSIONS, |
| 2127 | 'size_units' => ['px', '%', 'em'], |
| 2128 | 'selectors' => [ |
| 2129 | '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button, |
| 2130 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button, |
| 2131 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link, |
| 2132 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist, |
| 2133 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2134 | ], |
| 2135 | ] |
| 2136 | ); |
| 2137 | |
| 2138 | $this->add_control( |
| 2139 | 'eael_product_grid_add_to_cart_radius', |
| 2140 | [ |
| 2141 | 'label' => __('Radius', 'essential-addons-for-elementor-lite'), |
| 2142 | 'type' => Controls_Manager::DIMENSIONS, |
| 2143 | 'size_units' => ['px', '%', 'em'], |
| 2144 | 'selectors' => [ |
| 2145 | '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button, |
| 2146 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button, |
| 2147 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link, |
| 2148 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist, |
| 2149 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2150 | ], |
| 2151 | ] |
| 2152 | ); |
| 2153 | $this->add_control( |
| 2154 | 'eael_product_grid_add_to_cart_is_gradient_bg', |
| 2155 | [ |
| 2156 | 'label' => __('Use Gradient Background', 'essential-addons-for-elementor-lite'), |
| 2157 | 'type' => Controls_Manager::SWITCHER, |
| 2158 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 2159 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 2160 | 'return_value' => 'yes', |
| 2161 | ] |
| 2162 | ); |
| 2163 | |
| 2164 | $this->start_controls_tabs('eael_product_grid_add_to_cart_style_tabs'); |
| 2165 | |
| 2166 | $this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]); |
| 2167 | |
| 2168 | $this->add_control( |
| 2169 | 'eael_product_grid_add_to_cart_color', |
| 2170 | [ |
| 2171 | 'label' => esc_html__('Button Color', 'essential-addons-for-elementor-lite'), |
| 2172 | 'type' => Controls_Manager::COLOR, |
| 2173 | 'selectors' => [ |
| 2174 | '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button, |
| 2175 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'color: {{VALUE}};', |
| 2176 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'color: {{VALUE}};', |
| 2177 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'color: {{VALUE}};', |
| 2178 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist' => 'color: {{VALUE}};', |
| 2179 | ], |
| 2180 | ] |
| 2181 | ); |
| 2182 | |
| 2183 | $this->add_group_control( |
| 2184 | Group_Control_Background::get_type(), |
| 2185 | [ |
| 2186 | 'name' => 'eael_product_grid_add_to_cart_gradient_background', |
| 2187 | 'label' => __('Background', 'essential-addons-for-elementor-lite'), |
| 2188 | 'types' => ['classic', 'gradient'], |
| 2189 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button, |
| 2190 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button, |
| 2191 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link, |
| 2192 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist, |
| 2193 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart', |
| 2194 | 'condition' => [ |
| 2195 | 'eael_product_grid_add_to_cart_is_gradient_bg' => 'yes' |
| 2196 | ] |
| 2197 | ] |
| 2198 | ); |
| 2199 | |
| 2200 | $this->add_control( |
| 2201 | 'eael_product_grid_add_to_cart_background', |
| 2202 | [ |
| 2203 | 'label' => esc_html__('Background', 'essential-addons-for-elementor-lite'), |
| 2204 | 'type' => Controls_Manager::COLOR, |
| 2205 | 'default' => '#333', |
| 2206 | 'selectors' => [ |
| 2207 | '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button, |
| 2208 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button' => 'background-color: {{VALUE}};', |
| 2209 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link' => 'background-color: {{VALUE}};', |
| 2210 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart' => 'background-color: {{VALUE}};', |
| 2211 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist' => 'background-color: {{VALUE}};', |
| 2212 | ], |
| 2213 | 'condition' => [ |
| 2214 | 'eael_product_grid_add_to_cart_is_gradient_bg' => '' |
| 2215 | ] |
| 2216 | ] |
| 2217 | ); |
| 2218 | |
| 2219 | $this->add_group_control( |
| 2220 | Group_Control_Border::get_type(), |
| 2221 | [ |
| 2222 | 'name' => 'eael_product_grid_add_to_cart_border', |
| 2223 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button, |
| 2224 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button, |
| 2225 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link, |
| 2226 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist, |
| 2227 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart', |
| 2228 | ] |
| 2229 | ); |
| 2230 | |
| 2231 | $this->add_group_control( |
| 2232 | Group_Control_Typography::get_type(), |
| 2233 | [ |
| 2234 | 'name' => 'eael_product_grid_add_to_cart_typography', |
| 2235 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button, |
| 2236 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button', |
| 2237 | 'condition' => [ |
| 2238 | 'eael_product_grid_style_preset' => ['eael-product-default', 'eael-product-simple'], |
| 2239 | ], |
| 2240 | ] |
| 2241 | ); |
| 2242 | |
| 2243 | $this->end_controls_tab(); |
| 2244 | |
| 2245 | $this->start_controls_tab('eael_product_grid_add_to_cart_hover_styles', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]); |
| 2246 | |
| 2247 | $this->add_control( |
| 2248 | 'eael_product_grid_add_to_cart_hover_color', |
| 2249 | [ |
| 2250 | 'label' => esc_html__('Button Color', 'essential-addons-for-elementor-lite'), |
| 2251 | 'type' => Controls_Manager::COLOR, |
| 2252 | 'selectors' => [ |
| 2253 | '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button:hover, |
| 2254 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'color: {{VALUE}};', |
| 2255 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'color: {{VALUE}};', |
| 2256 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'color: {{VALUE}};', |
| 2257 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist:hover' => 'color: {{VALUE}};', |
| 2258 | ], |
| 2259 | ] |
| 2260 | ); |
| 2261 | $this->add_group_control( |
| 2262 | Group_Control_Background::get_type(), |
| 2263 | [ |
| 2264 | 'name' => 'eael_product_grid_add_to_cart_hover_gradient_background', |
| 2265 | 'label' => __('Background', 'essential-addons-for-elementor-lite'), |
| 2266 | 'types' => ['classic', 'gradient'], |
| 2267 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button:hover, |
| 2268 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover, |
| 2269 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover, |
| 2270 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist:hover, |
| 2271 | {{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover', |
| 2272 | 'condition' => [ |
| 2273 | 'eael_product_grid_add_to_cart_is_gradient_bg' => 'yes' |
| 2274 | ] |
| 2275 | ] |
| 2276 | ); |
| 2277 | $this->add_control( |
| 2278 | 'eael_product_grid_add_to_cart_hover_background', |
| 2279 | [ |
| 2280 | 'label' => esc_html__('Background', 'essential-addons-for-elementor-lite'), |
| 2281 | 'type' => Controls_Manager::COLOR, |
| 2282 | 'default' => '#333', |
| 2283 | 'selectors' => [ |
| 2284 | '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button:hover, |
| 2285 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'background-color: {{VALUE}};', |
| 2286 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'background-color: {{VALUE}};', |
| 2287 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'background-color: {{VALUE}};', |
| 2288 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist:hover' => 'background-color: {{VALUE}};', |
| 2289 | ], |
| 2290 | 'condition' => [ |
| 2291 | 'eael_product_grid_add_to_cart_is_gradient_bg' => '', |
| 2292 | ], |
| 2293 | ] |
| 2294 | ); |
| 2295 | |
| 2296 | $this->add_control( |
| 2297 | 'eael_product_grid_add_to_cart_hover_border_color', |
| 2298 | [ |
| 2299 | 'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'), |
| 2300 | 'type' => Controls_Manager::COLOR, |
| 2301 | 'default' => '', |
| 2302 | 'selectors' => [ |
| 2303 | '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button:hover, |
| 2304 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button:hover' => 'border-color: {{VALUE}};', |
| 2305 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .product-link:hover' => 'border-color: {{VALUE}};', |
| 2306 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .added_to_cart:hover' => 'border-color: {{VALUE}};', |
| 2307 | '{{WRAPPER}} .eael-product-grid.eael-product-overlay .woocommerce ul.products li.product .overlay .add_to_wishlist:hover' => 'border-color: {{VALUE}};', |
| 2308 | ], |
| 2309 | ] |
| 2310 | ); |
| 2311 | |
| 2312 | $this->end_controls_tab(); |
| 2313 | |
| 2314 | $this->end_controls_tabs(); |
| 2315 | |
| 2316 | $this->end_controls_section(); |
| 2317 | } |
| 2318 | |
| 2319 | protected function eael_product_badges() |
| 2320 | { |
| 2321 | $this->start_controls_section( |
| 2322 | 'eael_section_product_badges', |
| 2323 | [ |
| 2324 | 'label' => esc_html__('Sale / Stock Out Badge', 'essential-addons-for-elementor-lite'), |
| 2325 | 'condition' => [ |
| 2326 | 'eael_show_product_sale_badge' => 'yes' |
| 2327 | ] |
| 2328 | ] |
| 2329 | ); |
| 2330 | |
| 2331 | $this->add_control( |
| 2332 | 'eael_product_sale_badge_preset', |
| 2333 | [ |
| 2334 | 'label' => esc_html__('Style', 'essential-addons-for-elementor-lite'), |
| 2335 | 'type' => Controls_Manager::SELECT, |
| 2336 | 'default' => 'sale-preset-1', |
| 2337 | 'options' => [ |
| 2338 | 'sale-preset-1' => esc_html__('Preset 1', 'essential-addons-for-elementor-lite'), |
| 2339 | 'sale-preset-2' => esc_html__('Preset 2', 'essential-addons-for-elementor-lite'), |
| 2340 | 'sale-preset-3' => esc_html__('Preset 3', 'essential-addons-for-elementor-lite'), |
| 2341 | 'sale-preset-4' => esc_html__('Preset 4', 'essential-addons-for-elementor-lite'), |
| 2342 | 'sale-preset-5' => esc_html__('Preset 5', 'essential-addons-for-elementor-lite'), |
| 2343 | |
| 2344 | ], |
| 2345 | 'condition' => [ |
| 2346 | 'eael_product_grid_style_preset!' => 'eael-product-default', |
| 2347 | ], |
| 2348 | ] |
| 2349 | ); |
| 2350 | |
| 2351 | $this->add_control( |
| 2352 | 'eael_product_sale_badge_alignment', |
| 2353 | [ |
| 2354 | 'label' => __('Alignment', 'essential-addons-for-elementor-lite'), |
| 2355 | 'type' => Controls_Manager::CHOOSE, |
| 2356 | 'options' => [ |
| 2357 | 'left' => [ |
| 2358 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 2359 | 'icon' => 'eicon-text-align-left', |
| 2360 | ], |
| 2361 | 'right' => [ |
| 2362 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 2363 | 'icon' => 'eicon-text-align-right', |
| 2364 | ], |
| 2365 | ], |
| 2366 | 'condition' => [ |
| 2367 | 'eael_product_grid_layout!' => 'list', |
| 2368 | 'eael_product_grid_style_preset!' => 'eael-product-default', |
| 2369 | ], |
| 2370 | ] |
| 2371 | ); |
| 2372 | |
| 2373 | $this->add_control( |
| 2374 | 'eael_product_sale_text', |
| 2375 | [ |
| 2376 | 'label' => esc_html__( 'Sale Text', 'essential-addons-for-elementor-lite' ), |
| 2377 | 'type' => Controls_Manager::TEXT, |
| 2378 | 'separator' => 'before', |
| 2379 | 'ai' => [ |
| 2380 | 'active' => true, |
| 2381 | ], |
| 2382 | ] |
| 2383 | ); |
| 2384 | |
| 2385 | $this->add_control( |
| 2386 | 'eael_product_stockout_text', |
| 2387 | [ |
| 2388 | 'label' => esc_html__( 'Stock Out Text', 'essential-addons-for-elementor-lite' ), |
| 2389 | 'type' => Controls_Manager::TEXT, |
| 2390 | 'default' => esc_html__( 'Out of stock', 'essential-addons-for-elementor-lite' ), |
| 2391 | 'ai' => [ 'active' => true ], |
| 2392 | ] |
| 2393 | ); |
| 2394 | |
| 2395 | $this->end_controls_section(); |
| 2396 | } |
| 2397 | |
| 2398 | protected function eael_product_action_buttons() |
| 2399 | { |
| 2400 | $this->start_controls_section( |
| 2401 | 'eael_section_product_action_buttons', |
| 2402 | [ |
| 2403 | 'label' => esc_html__('Buttons', 'essential-addons-for-elementor-lite'), |
| 2404 | 'conditions' => [ |
| 2405 | 'relation' => 'or', |
| 2406 | 'terms' => [ |
| 2407 | [ |
| 2408 | 'name' => 'eael_product_grid_style_preset', |
| 2409 | 'operator' => 'in', |
| 2410 | 'value' => [ |
| 2411 | 'eael-product-preset-5', |
| 2412 | 'eael-product-preset-6', |
| 2413 | 'eael-product-preset-7', |
| 2414 | 'eael-product-preset-8', |
| 2415 | ], |
| 2416 | ], |
| 2417 | [ |
| 2418 | 'name' => 'eael_product_grid_layout', |
| 2419 | 'operator' => '==', |
| 2420 | 'value' => 'list' |
| 2421 | ] |
| 2422 | ], |
| 2423 | ], |
| 2424 | ] |
| 2425 | ); |
| 2426 | |
| 2427 | $this->add_control( |
| 2428 | 'eael_product_grid_quick_view', |
| 2429 | [ |
| 2430 | 'label' => esc_html__('Show Quick view?', 'essential-addons-for-elementor-lite'), |
| 2431 | 'type' => Controls_Manager::SWITCHER, |
| 2432 | 'return_value' => 'yes', |
| 2433 | 'default' => 'yes', |
| 2434 | ] |
| 2435 | ); |
| 2436 | |
| 2437 | $this->add_control( |
| 2438 | 'eael_product_quick_view_title_tag', |
| 2439 | [ |
| 2440 | 'label' => __('Quick view Title Tag', 'essential-addons-for-elementor-lite'), |
| 2441 | 'label_block' => true, |
| 2442 | 'type' => Controls_Manager::CHOOSE, |
| 2443 | 'options' => [ |
| 2444 | 'h1' => [ |
| 2445 | 'title' => esc_html__( 'H1', 'essential-addons-for-elementor-lite' ), |
| 2446 | 'icon' => 'eicon-editor-h1', |
| 2447 | ], |
| 2448 | 'h2' => [ |
| 2449 | 'title' => esc_html__( 'H2', 'essential-addons-for-elementor-lite' ), |
| 2450 | 'icon' => 'eicon-editor-h2', |
| 2451 | ], |
| 2452 | 'h3' => [ |
| 2453 | 'title' => esc_html__( 'H3', 'essential-addons-for-elementor-lite' ), |
| 2454 | 'icon' => 'eicon-editor-h3', |
| 2455 | ], |
| 2456 | 'h4' => [ |
| 2457 | 'title' => esc_html__( 'H4', 'essential-addons-for-elementor-lite' ), |
| 2458 | 'icon' => 'eicon-editor-h4', |
| 2459 | ], |
| 2460 | 'h5' => [ |
| 2461 | 'title' => esc_html__( 'H5', 'essential-addons-for-elementor-lite' ), |
| 2462 | 'icon' => 'eicon-editor-h5', |
| 2463 | ], |
| 2464 | 'h6' => [ |
| 2465 | 'title' => esc_html__( 'H6', 'essential-addons-for-elementor-lite' ), |
| 2466 | 'icon' => 'eicon-editor-h6', |
| 2467 | ], |
| 2468 | 'div' => [ |
| 2469 | 'title' => esc_html__( 'Div', 'essential-addons-for-elementor-lite' ), |
| 2470 | 'text' => 'div', |
| 2471 | ], |
| 2472 | 'span' => [ |
| 2473 | 'title' => esc_html__( 'Span', 'essential-addons-for-elementor-lite' ), |
| 2474 | 'text' => 'span', |
| 2475 | ], |
| 2476 | 'p' => [ |
| 2477 | 'title' => esc_html__( 'P', 'essential-addons-for-elementor-lite' ), |
| 2478 | 'text' => 'P', |
| 2479 | ], |
| 2480 | ], |
| 2481 | 'default' => 'h1', |
| 2482 | 'separator' => 'after', |
| 2483 | 'toggle' => false, |
| 2484 | 'condition' => [ |
| 2485 | 'eael_product_grid_quick_view' => 'yes', |
| 2486 | ], |
| 2487 | ] |
| 2488 | ); |
| 2489 | |
| 2490 | $this->add_control( |
| 2491 | 'eael_product_action_buttons_preset', |
| 2492 | [ |
| 2493 | 'label' => esc_html__('Style Preset', 'essential-addons-for-elementor-lite'), |
| 2494 | 'type' => Controls_Manager::SELECT, |
| 2495 | 'default' => 'details-block-style', |
| 2496 | 'options' => [ |
| 2497 | 'details-block-style' => esc_html__('Preset 1', 'essential-addons-for-elementor-lite'), |
| 2498 | 'details-block-style-2' => esc_html__('Preset 2', 'essential-addons-for-elementor-lite'), |
| 2499 | ], |
| 2500 | 'condition' => [ |
| 2501 | 'eael_product_grid_layout' => 'list', |
| 2502 | ], |
| 2503 | ] |
| 2504 | ); |
| 2505 | |
| 2506 | $this->end_controls_section(); |
| 2507 | } |
| 2508 | |
| 2509 | protected function eael_product_action_buttons_style() |
| 2510 | { |
| 2511 | $this->start_controls_section( |
| 2512 | 'eael_section_product_grid_buttons_styles', |
| 2513 | [ |
| 2514 | 'label' => esc_html__('Button', 'essential-addons-for-elementor-lite'), |
| 2515 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2516 | 'conditions' => [ |
| 2517 | 'relation' => 'or', |
| 2518 | 'terms' => [ |
| 2519 | [ |
| 2520 | 'name' => 'eael_product_grid_style_preset', |
| 2521 | 'operator' => 'in', |
| 2522 | 'value' => [ |
| 2523 | 'eael-product-preset-5', |
| 2524 | 'eael-product-preset-6', |
| 2525 | 'eael-product-preset-7', |
| 2526 | 'eael-product-preset-8', |
| 2527 | ], |
| 2528 | ], |
| 2529 | [ |
| 2530 | 'name' => 'eael_product_grid_layout', |
| 2531 | 'operator' => '==', |
| 2532 | 'value' => 'list' |
| 2533 | ] |
| 2534 | ], |
| 2535 | ], |
| 2536 | ] |
| 2537 | ); |
| 2538 | |
| 2539 | $this->add_control( |
| 2540 | 'eael_product_grid_buttons_preset5_background', |
| 2541 | [ |
| 2542 | 'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'), |
| 2543 | 'type' => Controls_Manager::COLOR, |
| 2544 | 'default' => '#8040FF', |
| 2545 | 'selectors' => [ |
| 2546 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap.block-style' => 'background: {{VALUE}};', |
| 2547 | ], |
| 2548 | 'conditions' => [ |
| 2549 | 'relation' => 'and', |
| 2550 | 'terms' => [ |
| 2551 | [ |
| 2552 | 'name' => 'eael_product_grid_layout', |
| 2553 | 'operator' => 'in', |
| 2554 | 'value' => [ |
| 2555 | 'grid', |
| 2556 | 'masonry', |
| 2557 | ], |
| 2558 | ], |
| 2559 | [ |
| 2560 | 'name' => 'eael_product_grid_style_preset', |
| 2561 | 'operator' => '==', |
| 2562 | 'value' => 'eael-product-preset-5', |
| 2563 | ], |
| 2564 | ], |
| 2565 | ], |
| 2566 | ] |
| 2567 | ); |
| 2568 | |
| 2569 | $this->add_control( |
| 2570 | 'eael_product_grid_buttons_icon_size', |
| 2571 | [ |
| 2572 | 'label' => esc_html__('Icons Size', 'essential-addons-for-elementor-lite'), |
| 2573 | 'type' => Controls_Manager::SLIDER, |
| 2574 | 'range' => [ |
| 2575 | 'px' => [ |
| 2576 | 'max' => 50, |
| 2577 | ], |
| 2578 | ], |
| 2579 | 'default' => [ |
| 2580 | 'size' => 18, |
| 2581 | ], |
| 2582 | 'selectors' => [ |
| 2583 | '{{WRAPPER}} .eael-product-grid.list .eael-product-wrap .icons-wrap li a i' => 'font-size: {{SIZE}}px;', |
| 2584 | ], |
| 2585 | 'condition' => [ |
| 2586 | 'eael_product_grid_layout' => 'list', |
| 2587 | ], |
| 2588 | ] |
| 2589 | ); |
| 2590 | |
| 2591 | |
| 2592 | $this->add_group_control( |
| 2593 | Group_Control_Typography::get_type(), |
| 2594 | [ |
| 2595 | 'name' => 'eael_product_grid_buttons_typography', |
| 2596 | 'selector' => '{{WRAPPER}} .eael-product-grid .icons-wrap li.add-to-cart a', |
| 2597 | ] |
| 2598 | ); |
| 2599 | |
| 2600 | $this->add_control( |
| 2601 | 'eael_product_grid_buttons_preset5_border_color', |
| 2602 | [ |
| 2603 | 'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'), |
| 2604 | 'type' => Controls_Manager::COLOR, |
| 2605 | 'default' => '#fff', |
| 2606 | 'selectors' => [ |
| 2607 | '{{WRAPPER}} .eael-product-grid .icons-wrap.block-style li' => 'border-color: {{VALUE}};', |
| 2608 | ], |
| 2609 | 'conditions' => [ |
| 2610 | 'relation' => 'and', |
| 2611 | 'terms' => [ |
| 2612 | [ |
| 2613 | 'name' => 'eael_product_grid_layout', |
| 2614 | 'operator' => 'in', |
| 2615 | 'value' => [ |
| 2616 | 'grid', |
| 2617 | 'masonry', |
| 2618 | ], |
| 2619 | ], |
| 2620 | [ |
| 2621 | 'name' => 'eael_product_grid_style_preset', |
| 2622 | 'operator' => '==', |
| 2623 | 'value' => 'eael-product-preset-5', |
| 2624 | ], |
| 2625 | ], |
| 2626 | ], |
| 2627 | ] |
| 2628 | ); |
| 2629 | |
| 2630 | $this->start_controls_tabs('eael_product_grid_buttons_style_tabs'); |
| 2631 | |
| 2632 | $this->start_controls_tab('eael_product_grid_buttons_style_tabs_normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]); |
| 2633 | |
| 2634 | $this->add_control( |
| 2635 | 'eael_product_grid_buttons_color', |
| 2636 | [ |
| 2637 | 'label' => esc_html__('Color', 'essential-addons-for-elementor-lite'), |
| 2638 | 'type' => Controls_Manager::COLOR, |
| 2639 | 'default' => '#fff', |
| 2640 | 'selectors' => [ |
| 2641 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap li a' => 'color: {{VALUE}};', |
| 2642 | '{{WRAPPER}} .eael-compare-icon' => 'fill: {{VALUE}};', |
| 2643 | ], |
| 2644 | ] |
| 2645 | ); |
| 2646 | |
| 2647 | $this->add_control( |
| 2648 | 'eael_product_grid_buttons_background', |
| 2649 | [ |
| 2650 | 'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'), |
| 2651 | 'type' => Controls_Manager::COLOR, |
| 2652 | 'default' => '#8040FF', |
| 2653 | 'selectors' => [ |
| 2654 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap li a' => 'background-color: {{VALUE}};', |
| 2655 | ], |
| 2656 | 'conditions' => [ |
| 2657 | 'relation' => 'or', |
| 2658 | 'terms' => [ |
| 2659 | [ |
| 2660 | 'name' => 'eael_product_grid_style_preset', |
| 2661 | 'operator' => '!==', |
| 2662 | 'value' => 'eael-product-preset-5' |
| 2663 | ], |
| 2664 | [ |
| 2665 | 'name' => 'eael_product_grid_layout', |
| 2666 | 'operator' => '==', |
| 2667 | 'value' => 'list' |
| 2668 | ] |
| 2669 | ], |
| 2670 | ], |
| 2671 | ] |
| 2672 | ); |
| 2673 | |
| 2674 | $this->add_group_control( |
| 2675 | Group_Control_Border::get_type(), |
| 2676 | [ |
| 2677 | 'name' => 'eael_product_grid_buttons_border', |
| 2678 | 'selector' => '{{WRAPPER}} .eael-product-grid .woocommerce li.product .button, |
| 2679 | {{WRAPPER}} .eael-product-grid .woocommerce li.product .button.add_to_cart_button, |
| 2680 | {{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap li a', |
| 2681 | 'conditions' => [ |
| 2682 | 'relation' => 'or', |
| 2683 | 'terms' => [ |
| 2684 | [ |
| 2685 | 'name' => 'eael_product_grid_style_preset', |
| 2686 | 'operator' => '!==', |
| 2687 | 'value' => 'eael-product-preset-5' |
| 2688 | ], |
| 2689 | [ |
| 2690 | 'name' => 'eael_product_action_buttons_preset', |
| 2691 | 'operator' => '==', |
| 2692 | 'value' => 'details-block-style-2' |
| 2693 | ] |
| 2694 | ], |
| 2695 | ], |
| 2696 | ] |
| 2697 | ); |
| 2698 | $this->add_control( |
| 2699 | 'eael_product_grid_buttons_border_radius', |
| 2700 | [ |
| 2701 | 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'), |
| 2702 | 'type' => Controls_Manager::SLIDER, |
| 2703 | 'range' => [ |
| 2704 | 'px' => [ |
| 2705 | 'max' => 100, |
| 2706 | ], |
| 2707 | ], |
| 2708 | 'default' => [ |
| 2709 | 'size' => 3, |
| 2710 | ], |
| 2711 | 'selectors' => [ |
| 2712 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap:not(.details-block-style-2) li a' => 'border-radius: {{SIZE}}px;', |
| 2713 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap.details-block-style-2 li:only-child a' => 'border-radius: {{SIZE}}px!important;', |
| 2714 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap.details-block-style-2 li:first-child a' => 'border-radius: {{SIZE}}px 0 0 {{SIZE}}px;', |
| 2715 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap.details-block-style-2 li:last-child a' => 'border-radius: 0 {{SIZE}}px {{SIZE}}px 0;', |
| 2716 | ], |
| 2717 | ] |
| 2718 | ); |
| 2719 | |
| 2720 | $this->add_control( |
| 2721 | 'eael_product_grid_buttons_top_spacing', |
| 2722 | [ |
| 2723 | 'label' => esc_html__('Top Spacing', 'essential-addons-for-elementor-lite'), |
| 2724 | 'type' => Controls_Manager::SLIDER, |
| 2725 | 'range' => [ |
| 2726 | 'px' => [ |
| 2727 | 'max' => 100, |
| 2728 | ], |
| 2729 | ], |
| 2730 | 'selectors' => [ |
| 2731 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap' => 'margin-top: {{SIZE}}px;', |
| 2732 | ], |
| 2733 | 'condition' => [ |
| 2734 | 'eael_product_grid_layout' => 'list', |
| 2735 | ], |
| 2736 | ] |
| 2737 | ); |
| 2738 | |
| 2739 | $this->end_controls_tab(); |
| 2740 | |
| 2741 | $this->start_controls_tab('eael_product_grid_buttons_hover_styles', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]); |
| 2742 | |
| 2743 | $this->add_control( |
| 2744 | 'eael_product_grid_buttons_hover_color', |
| 2745 | [ |
| 2746 | 'label' => esc_html__('Color', 'essential-addons-for-elementor-lite'), |
| 2747 | 'type' => Controls_Manager::COLOR, |
| 2748 | 'default' => '#F5EAFF', |
| 2749 | 'selectors' => [ |
| 2750 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap li a:hover' => 'color: {{VALUE}};', |
| 2751 | ], |
| 2752 | ] |
| 2753 | ); |
| 2754 | |
| 2755 | $this->add_control( |
| 2756 | 'eael_product_grid_buttons_hover_background', |
| 2757 | [ |
| 2758 | 'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'), |
| 2759 | 'type' => Controls_Manager::COLOR, |
| 2760 | 'default' => '#333', |
| 2761 | 'selectors' => [ |
| 2762 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap li a:hover' => 'background-color: {{VALUE}};', |
| 2763 | ], |
| 2764 | 'conditions' => [ |
| 2765 | 'relation' => 'or', |
| 2766 | 'terms' => [ |
| 2767 | [ |
| 2768 | 'name' => 'eael_product_grid_style_preset', |
| 2769 | 'operator' => '!==', |
| 2770 | 'value' => 'eael-product-preset-5' |
| 2771 | ], |
| 2772 | [ |
| 2773 | 'name' => 'eael_product_action_buttons_preset', |
| 2774 | 'operator' => '!==', |
| 2775 | 'value' => 'details-block-style-2' |
| 2776 | ] |
| 2777 | ] |
| 2778 | ], |
| 2779 | ] |
| 2780 | ); |
| 2781 | |
| 2782 | $this->add_control( |
| 2783 | 'eael_product_grid_buttons_hover_border_color', |
| 2784 | [ |
| 2785 | 'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'), |
| 2786 | 'type' => Controls_Manager::COLOR, |
| 2787 | 'default' => '', |
| 2788 | 'selectors' => [ |
| 2789 | '{{WRAPPER}} .eael-product-grid .eael-product-wrap .icons-wrap li a:hover' => 'border-color: {{VALUE}};', |
| 2790 | ], |
| 2791 | 'condition' => [ |
| 2792 | 'eael_product_grid_buttons_border_border!' => '', |
| 2793 | 'eael_product_grid_style_preset!' => 'eael-product-preset-5', |
| 2794 | ], |
| 2795 | ] |
| 2796 | ); |
| 2797 | |
| 2798 | $this->end_controls_tab(); |
| 2799 | |
| 2800 | $this->end_controls_tabs(); |
| 2801 | |
| 2802 | $this->end_controls_section(); |
| 2803 | } |
| 2804 | |
| 2805 | protected function eael_product_pagination() |
| 2806 | { |
| 2807 | |
| 2808 | $this->start_controls_section( |
| 2809 | 'eael_product_grid_pagination_section', |
| 2810 | [ |
| 2811 | 'label' => __('Pagination', 'essential-addons-for-elementor-lite'), |
| 2812 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 2813 | 'condition' => [ |
| 2814 | 'eael_product_grid_layout' => ['grid', 'list'], |
| 2815 | 'show_load_more!' => 'true', |
| 2816 | 'post_type!' => 'source_archive', |
| 2817 | ], |
| 2818 | ] |
| 2819 | ); |
| 2820 | |
| 2821 | $this->add_control( |
| 2822 | 'show_pagination', |
| 2823 | [ |
| 2824 | 'label' => __('pagination', 'essential-addons-for-elementor-lite'), |
| 2825 | 'type' => Controls_Manager::SWITCHER, |
| 2826 | 'label_on' => __('Show', 'essential-addons-for-elementor-lite'), |
| 2827 | 'label_off' => __('Hide', 'essential-addons-for-elementor-lite'), |
| 2828 | 'return_value' => 'true', |
| 2829 | 'default' => '', |
| 2830 | ] |
| 2831 | ); |
| 2832 | |
| 2833 | $this->add_control( |
| 2834 | 'pagination_prev_label', |
| 2835 | [ |
| 2836 | 'label' => __('Previous Label', 'essential-addons-for-elementor-lite'), |
| 2837 | 'default' => __('←', 'essential-addons-for-elementor-lite'), |
| 2838 | 'ai' => [ |
| 2839 | 'active' => false, |
| 2840 | ], |
| 2841 | 'condition' => [ |
| 2842 | 'show_pagination' => 'true', |
| 2843 | ] |
| 2844 | ] |
| 2845 | ); |
| 2846 | |
| 2847 | $this->add_control( |
| 2848 | 'pagination_next_label', |
| 2849 | [ |
| 2850 | 'label' => __('Next Label', 'essential-addons-for-elementor-lite'), |
| 2851 | 'default' => __('→', 'essential-addons-for-elementor-lite'), |
| 2852 | 'ai' => [ |
| 2853 | 'active' => false, |
| 2854 | ], |
| 2855 | 'condition' => [ |
| 2856 | 'show_pagination' => 'true', |
| 2857 | ] |
| 2858 | ] |
| 2859 | ); |
| 2860 | |
| 2861 | $this->end_controls_section(); |
| 2862 | } |
| 2863 | |
| 2864 | protected function eael_product_pagination_style() |
| 2865 | { |
| 2866 | $this->start_controls_section( |
| 2867 | 'eael_section_product_pagination_style', |
| 2868 | [ |
| 2869 | 'label' => __('Pagination', 'essential-addons-for-elementor-lite'), |
| 2870 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2871 | 'conditions' => [ |
| 2872 | 'relation' => 'or', |
| 2873 | 'terms' => [ |
| 2874 | [ |
| 2875 | 'terms' => [ |
| 2876 | [ |
| 2877 | 'name' => 'show_pagination', |
| 2878 | 'operator' => ' === ', |
| 2879 | 'value' => 'true' |
| 2880 | ], |
| 2881 | [ |
| 2882 | 'name' => 'eael_product_grid_layout', |
| 2883 | 'operator' => 'in', |
| 2884 | 'value' => ['grid', 'list'] |
| 2885 | ] |
| 2886 | ] |
| 2887 | ], |
| 2888 | [ |
| 2889 | 'name' => 'post_type', |
| 2890 | 'operator' => ' === ', |
| 2891 | 'value' => 'source_archive' |
| 2892 | ] |
| 2893 | |
| 2894 | ] |
| 2895 | ], |
| 2896 | ] |
| 2897 | ); |
| 2898 | |
| 2899 | $this->add_responsive_control( |
| 2900 | 'eael_product_grid_pagination_alignment', |
| 2901 | [ |
| 2902 | 'label' => __('Alignment', 'essential-addons-for-elementor-lite'), |
| 2903 | 'type' => Controls_Manager::CHOOSE, |
| 2904 | 'options' => [ |
| 2905 | 'left' => [ |
| 2906 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 2907 | 'icon' => 'eicon-text-align-left', |
| 2908 | ], |
| 2909 | 'center' => [ |
| 2910 | 'title' => __('Center', 'essential-addons-for-elementor-lite'), |
| 2911 | 'icon' => 'eicon-text-align-center', |
| 2912 | ], |
| 2913 | 'right' => [ |
| 2914 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 2915 | 'icon' => 'eicon-text-align-right', |
| 2916 | ], |
| 2917 | ], |
| 2918 | 'default' => 'center', |
| 2919 | 'selectors' => [ |
| 2920 | '{{WRAPPER}} .eael-woo-pagination' => 'text-align: {{VALUE}};', |
| 2921 | '{{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination' => 'text-align: {{VALUE}};', |
| 2922 | ], |
| 2923 | ] |
| 2924 | ); |
| 2925 | |
| 2926 | $this->add_responsive_control( |
| 2927 | 'eael_product_grid_pagination_top_spacing', |
| 2928 | [ |
| 2929 | 'label' => esc_html__('Top Spacing', 'essential-addons-for-elementor-lite'), |
| 2930 | 'type' => Controls_Manager::SLIDER, |
| 2931 | 'range' => [ |
| 2932 | 'px' => [ |
| 2933 | 'max' => 100, |
| 2934 | ], |
| 2935 | ], |
| 2936 | 'default' => [ |
| 2937 | 'size' => 15, |
| 2938 | ], |
| 2939 | 'selectors' => [ |
| 2940 | '{{WRAPPER}} .eael-woo-pagination' => 'margin-top: {{SIZE}}px;', |
| 2941 | '{{WRAPPER}} {{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination' => 'margin-top: {{SIZE}}px;', |
| 2942 | ], |
| 2943 | ] |
| 2944 | ); |
| 2945 | |
| 2946 | $this->add_group_control( |
| 2947 | Group_Control_Typography::get_type(), |
| 2948 | [ |
| 2949 | 'name' => 'eael_product_grid_pagination_typography', |
| 2950 | 'selector' => '{{WRAPPER}} .eael-woo-pagination, |
| 2951 | {{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination, |
| 2952 | {{WRAPPER}} .eael-woo-pagination ul li a', |
| 2953 | ] |
| 2954 | ); |
| 2955 | |
| 2956 | $this->start_controls_tabs('eael_product_grid_pagination_tabs'); |
| 2957 | |
| 2958 | // Normal State Tab |
| 2959 | $this->start_controls_tab('eael_product_grid_pagination_normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]); |
| 2960 | |
| 2961 | $this->add_control( |
| 2962 | 'eael_product_grid_pagination_normal_text_color', |
| 2963 | [ |
| 2964 | 'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'), |
| 2965 | 'type' => Controls_Manager::COLOR, |
| 2966 | 'default' => '#2F436C', |
| 2967 | 'selectors' => [ |
| 2968 | '{{WRAPPER}} .eael-woo-pagination a' => 'color: {{VALUE}};', |
| 2969 | '{{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination a' => 'color: {{VALUE}};', |
| 2970 | ], |
| 2971 | ] |
| 2972 | ); |
| 2973 | |
| 2974 | $this->add_control( |
| 2975 | 'eael_product_grid_pagination_normal_bg_color', |
| 2976 | [ |
| 2977 | 'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'), |
| 2978 | 'type' => Controls_Manager::COLOR, |
| 2979 | 'default' => '#fff', |
| 2980 | 'selectors' => [ |
| 2981 | '{{WRAPPER}} .eael-woo-pagination a' => 'background: {{VALUE}};', |
| 2982 | '{{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination a' => 'background: {{VALUE}};', |
| 2983 | ], |
| 2984 | ] |
| 2985 | ); |
| 2986 | |
| 2987 | $this->add_group_control( |
| 2988 | Group_Control_Border::get_type(), |
| 2989 | [ |
| 2990 | 'name' => 'eael_product_grid_pagination_normal_border', |
| 2991 | 'label' => esc_html__('Border', 'essential-addons-for-elementor-lite'), |
| 2992 | 'selector' => '{{WRAPPER}} .eael-woo-pagination a, {{WRAPPER}} .eael-woo-pagination span, |
| 2993 | {{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination a', |
| 2994 | ] |
| 2995 | ); |
| 2996 | |
| 2997 | $this->end_controls_tab(); |
| 2998 | |
| 2999 | // Hover State Tab |
| 3000 | $this->start_controls_tab('eael_product_grid_pagination_hover', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]); |
| 3001 | |
| 3002 | $this->add_control( |
| 3003 | 'eael_product_grid_pagination_hover_text_color', |
| 3004 | [ |
| 3005 | 'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'), |
| 3006 | 'type' => Controls_Manager::COLOR, |
| 3007 | 'default' => '#fff', |
| 3008 | 'selectors' => [ |
| 3009 | '{{WRAPPER}} .eael-woo-pagination a:hover' => 'color: {{VALUE}};', |
| 3010 | '{{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination a:hover' => 'color: {{VALUE}};', |
| 3011 | ], |
| 3012 | ] |
| 3013 | ); |
| 3014 | |
| 3015 | $this->add_control( |
| 3016 | 'eael_product_grid_pagination_hover_bg_color', |
| 3017 | [ |
| 3018 | 'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'), |
| 3019 | 'type' => Controls_Manager::COLOR, |
| 3020 | 'default' => '#8040FF', |
| 3021 | 'selectors' => [ |
| 3022 | '{{WRAPPER}} .eael-woo-pagination a:hover' => 'background: {{VALUE}};', |
| 3023 | '{{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination a:hover' => 'background: {{VALUE}};', |
| 3024 | ], |
| 3025 | ] |
| 3026 | ); |
| 3027 | |
| 3028 | $this->add_control( |
| 3029 | 'eael_product_grid_pagination_hover_border_color', |
| 3030 | [ |
| 3031 | 'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'), |
| 3032 | 'type' => Controls_Manager::COLOR, |
| 3033 | 'default' => '', |
| 3034 | 'selectors' => [ |
| 3035 | '{{WRAPPER}} .eael-woo-pagination a:hover' => 'border-color: {{VALUE}};', |
| 3036 | '{{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination a:hover' => 'border-color: {{VALUE}};', |
| 3037 | ], |
| 3038 | 'condition' => [ |
| 3039 | 'eael_product_grid_pagination_normal_border_border!' => '', |
| 3040 | ] |
| 3041 | ] |
| 3042 | |
| 3043 | ); |
| 3044 | $this->end_controls_tab(); |
| 3045 | |
| 3046 | // Active State Tab |
| 3047 | $this->start_controls_tab('eael_product_grid_pagination_active', ['label' => esc_html__('Active', 'essential-addons-for-elementor-lite')]); |
| 3048 | |
| 3049 | $this->add_control( |
| 3050 | 'eael_product_grid_pagination_hover_text_active', |
| 3051 | [ |
| 3052 | 'label' => esc_html__('Text Color', 'essential-addons-for-elementor-lite'), |
| 3053 | 'type' => Controls_Manager::COLOR, |
| 3054 | 'default' => '#fff', |
| 3055 | 'selectors' => [ |
| 3056 | '{{WRAPPER}} .eael-woo-pagination .current' => 'color: {{VALUE}};', |
| 3057 | '{{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination .current' => 'color: {{VALUE}};', |
| 3058 | ], |
| 3059 | ] |
| 3060 | ); |
| 3061 | |
| 3062 | $this->add_control( |
| 3063 | 'eael_product_grid_pagination_active_bg_color', |
| 3064 | [ |
| 3065 | 'label' => esc_html__('Background Color', 'essential-addons-for-elementor-lite'), |
| 3066 | 'type' => Controls_Manager::COLOR, |
| 3067 | 'default' => '#8040FF', |
| 3068 | 'selectors' => [ |
| 3069 | '{{WRAPPER}} .eael-woo-pagination .current' => 'background: {{VALUE}};', |
| 3070 | '{{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination .current' => 'background: {{VALUE}};', |
| 3071 | ], |
| 3072 | ] |
| 3073 | ); |
| 3074 | |
| 3075 | $this->add_control( |
| 3076 | 'eael_product_grid_pagination_active_border_color', |
| 3077 | [ |
| 3078 | 'label' => esc_html__('Border Color', 'essential-addons-for-elementor-lite'), |
| 3079 | 'type' => Controls_Manager::COLOR, |
| 3080 | 'default' => '', |
| 3081 | 'selectors' => [ |
| 3082 | '{{WRAPPER}} .eael-woo-pagination .current' => 'border-color: {{VALUE}};', |
| 3083 | '{{WRAPPER}} .eael-product-grid-pagination .woocommerce-pagination .current' => 'border-color: {{VALUE}};', |
| 3084 | ], |
| 3085 | 'condition' => [ |
| 3086 | 'eael_product_grid_pagination_normal_border_border!' => '', |
| 3087 | ] |
| 3088 | ] |
| 3089 | |
| 3090 | ); |
| 3091 | $this->end_controls_tab(); |
| 3092 | |
| 3093 | $this->end_controls_tabs(); |
| 3094 | |
| 3095 | $this->add_control( |
| 3096 | 'eael_product_grid_pagination_border_radius', |
| 3097 | [ |
| 3098 | 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'), |
| 3099 | 'type' => Controls_Manager::SLIDER, |
| 3100 | 'range' => [ |
| 3101 | 'px' => [ |
| 3102 | 'max' => 100, |
| 3103 | ], |
| 3104 | ], |
| 3105 | 'selectors' => [ |
| 3106 | '{{WRAPPER}} .eael-woo-pagination li > *' => 'border-radius: {{SIZE}}px;', |
| 3107 | ], |
| 3108 | ] |
| 3109 | ); |
| 3110 | |
| 3111 | // Pagination Loader |
| 3112 | $this->add_control( |
| 3113 | 'eael_product_pagination_loader', |
| 3114 | [ |
| 3115 | 'label' => __('Loader', 'essential-addons-for-elementor-lite'), |
| 3116 | 'type' => Controls_Manager::HEADING, |
| 3117 | 'separator' => 'before', |
| 3118 | ] |
| 3119 | ); |
| 3120 | |
| 3121 | $this->add_control( |
| 3122 | 'eael_product_pagination_loader_color', |
| 3123 | [ |
| 3124 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 3125 | 'type' => Controls_Manager::COLOR, |
| 3126 | 'default' => '#000', |
| 3127 | 'selectors' => [ |
| 3128 | '{{WRAPPER}}.eael-product-loader::after' => 'border-left-color: {{VALUE}};', |
| 3129 | ], |
| 3130 | ] |
| 3131 | ); |
| 3132 | |
| 3133 | $this->end_controls_section(); |
| 3134 | } |
| 3135 | |
| 3136 | protected function eael_product_view_popup_style() |
| 3137 | { |
| 3138 | $this->start_controls_section( |
| 3139 | 'eael_product_popup', |
| 3140 | [ |
| 3141 | 'label' => __('Popup', 'essential-addons-for-elementor-lite'), |
| 3142 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3143 | ] |
| 3144 | ); |
| 3145 | |
| 3146 | $this->add_control( |
| 3147 | 'eael_product_popup_title', |
| 3148 | [ |
| 3149 | 'label' => __('Title', 'essential-addons-for-elementor-lite'), |
| 3150 | 'type' => Controls_Manager::HEADING, |
| 3151 | ] |
| 3152 | ); |
| 3153 | |
| 3154 | $this->add_group_control( |
| 3155 | Group_Control_Typography::get_type(), |
| 3156 | [ |
| 3157 | 'name' => 'eael_product_popup_title_typography', |
| 3158 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 3159 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}} div.product .product_title', |
| 3160 | ] |
| 3161 | ); |
| 3162 | |
| 3163 | $this->add_control( |
| 3164 | 'eael_product_popup_title_color', |
| 3165 | [ |
| 3166 | 'label' => __('Title Color', 'essential-addons-for-elementor-lite'), |
| 3167 | 'type' => Controls_Manager::COLOR, |
| 3168 | 'default' => '#252525', |
| 3169 | 'selectors' => [ |
| 3170 | // '{{WRAPPER}} .eael-product-popup .eael-product-quick-view-title.product_title.entry-title' => 'color: {{VALUE}};', |
| 3171 | '.eael-popup-details-render .elementor-element-{{ID}} div.product .product_title' => 'color: {{VALUE}};', |
| 3172 | ], |
| 3173 | ] |
| 3174 | ); |
| 3175 | |
| 3176 | $this->add_control( |
| 3177 | 'eael_product_popup_price', |
| 3178 | [ |
| 3179 | 'label' => __('Price', 'essential-addons-for-elementor-lite'), |
| 3180 | 'type' => Controls_Manager::HEADING, |
| 3181 | 'separator' => 'before', |
| 3182 | ] |
| 3183 | ); |
| 3184 | |
| 3185 | $this->add_group_control( |
| 3186 | Group_Control_Typography::get_type(), |
| 3187 | [ |
| 3188 | 'name' => 'eael_product_popup_price_typography', |
| 3189 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 3190 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}} div.product .price', |
| 3191 | ] |
| 3192 | ); |
| 3193 | |
| 3194 | $this->add_control( |
| 3195 | 'eael_product_popup_price_color', |
| 3196 | [ |
| 3197 | 'label' => __('Price Color', 'essential-addons-for-elementor-lite'), |
| 3198 | 'type' => Controls_Manager::COLOR, |
| 3199 | 'default' => '#0242e4', |
| 3200 | 'selectors' => [ |
| 3201 | '.eael-popup-details-render .elementor-element-{{ID}} div.product .price' => 'color: {{VALUE}}!important;', |
| 3202 | ], |
| 3203 | ] |
| 3204 | ); |
| 3205 | |
| 3206 | $this->add_control( |
| 3207 | 'eael_product_popup_sale_price_color', |
| 3208 | [ |
| 3209 | 'label' => __('Sale Price Color', 'essential-addons-for-elementor-lite'), |
| 3210 | 'type' => Controls_Manager::COLOR, |
| 3211 | 'default' => '#ff2a13', |
| 3212 | 'selectors' => [ |
| 3213 | '.eael-popup-details-render .elementor-element-{{ID}} div.product .price ins' => 'color: {{VALUE}}!important;', |
| 3214 | ], |
| 3215 | ] |
| 3216 | ); |
| 3217 | |
| 3218 | $this->add_control( |
| 3219 | 'eael_product_popup_content', |
| 3220 | [ |
| 3221 | 'label' => __('Content', 'essential-addons-for-elementor-lite'), |
| 3222 | 'type' => Controls_Manager::HEADING, |
| 3223 | 'separator' => 'before', |
| 3224 | ] |
| 3225 | ); |
| 3226 | |
| 3227 | $this->add_group_control( |
| 3228 | Group_Control_Typography::get_type(), |
| 3229 | [ |
| 3230 | 'name' => 'eael_product_popup_content_typography', |
| 3231 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 3232 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}} div.product .woocommerce-product-details__short-description', |
| 3233 | ] |
| 3234 | ); |
| 3235 | |
| 3236 | $this->add_control( |
| 3237 | 'eael_product_popup_content_color', |
| 3238 | [ |
| 3239 | 'label' => __('Content Color', 'essential-addons-for-elementor-lite'), |
| 3240 | 'type' => Controls_Manager::COLOR, |
| 3241 | 'default' => '#707070', |
| 3242 | 'selectors' => [ |
| 3243 | '.eael-popup-details-render .elementor-element-{{ID}} .woocommerce-product-details__short-description' => 'color: {{VALUE}};', |
| 3244 | ], |
| 3245 | ] |
| 3246 | ); |
| 3247 | |
| 3248 | $this->add_control( |
| 3249 | 'eael_product_popup_review_link_color', |
| 3250 | [ |
| 3251 | 'label' => __('Review Link Color', 'essential-addons-for-elementor-lite'), |
| 3252 | 'type' => Controls_Manager::COLOR, |
| 3253 | 'default' => '#ccc', |
| 3254 | 'selectors' => [ |
| 3255 | '.eael-popup-details-render .elementor-element-{{ID}} .product_meta a.woocommerce-review-link, .eael-popup-details-render .elementor-element-{{ID}} .product_meta a' => 'color: {{VALUE}};', |
| 3256 | ], |
| 3257 | ] |
| 3258 | ); |
| 3259 | $this->add_control( |
| 3260 | 'eael_product_popup_review_link_hover', |
| 3261 | [ |
| 3262 | 'label' => __('Review Link Hover', 'essential-addons-for-elementor-lite'), |
| 3263 | 'type' => Controls_Manager::COLOR, |
| 3264 | 'default' => '#ccc', |
| 3265 | 'selectors' => [ |
| 3266 | '.eael-popup-details-render .elementor-element-{{ID}} a.woocommerce-review-link:hover, .eael-popup-details-render .elementor-element-{{ID}} .product_meta a:hover' => 'color: {{VALUE}};', |
| 3267 | ], |
| 3268 | ] |
| 3269 | ); |
| 3270 | |
| 3271 | $this->add_control( |
| 3272 | 'eael_product_popup_table_border_color', |
| 3273 | [ |
| 3274 | 'label' => __('Border Color', 'essential-addons-for-elementor-lite'), |
| 3275 | 'type' => Controls_Manager::COLOR, |
| 3276 | 'default' => '#ccc', |
| 3277 | 'selectors' => [ |
| 3278 | '.eael-popup-details-render .elementor-element-{{ID}} div.product table tbody tr, {{WRAPPER}} .eael-product-popup.woocommerce div.product .product_meta' => 'border-color: {{VALUE}};', |
| 3279 | ], |
| 3280 | ] |
| 3281 | ); |
| 3282 | |
| 3283 | // Sale |
| 3284 | $this->add_control( |
| 3285 | 'eael_product_popup_sale_style', |
| 3286 | [ |
| 3287 | 'label' => __('Sale', 'essential-addons-for-elementor-lite'), |
| 3288 | 'type' => Controls_Manager::HEADING, |
| 3289 | 'separator' => 'before', |
| 3290 | ] |
| 3291 | ); |
| 3292 | |
| 3293 | $this->add_group_control( |
| 3294 | Group_Control_Typography::get_type(), |
| 3295 | [ |
| 3296 | 'name' => 'eael_product_popup_sale_typo', |
| 3297 | 'label' => __( 'Typography', 'essential-addons-for-elementor-lite' ), |
| 3298 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}} .eael-onsale', |
| 3299 | ] |
| 3300 | ); |
| 3301 | |
| 3302 | $this->add_control( |
| 3303 | 'eael_product_popup_sale_color', |
| 3304 | [ |
| 3305 | 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ), |
| 3306 | 'type' => Controls_Manager::COLOR, |
| 3307 | 'selectors' => [ |
| 3308 | '.eael-popup-details-render .elementor-element-{{ID}} .eael-onsale' => 'color: {{VALUE}}!important;', |
| 3309 | ], |
| 3310 | ] |
| 3311 | ); |
| 3312 | $this->add_control( |
| 3313 | 'eael_product_popup_sale_bg_color', |
| 3314 | [ |
| 3315 | 'label' => __( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 3316 | 'type' => Controls_Manager::COLOR, |
| 3317 | 'selectors' => [ |
| 3318 | '.eael-popup-details-render .elementor-element-{{ID}} .eael-onsale' => 'background-color: {{VALUE}}!important;', |
| 3319 | '.eael-popup-details-render .elementor-element-{{ID}} .eael-onsale:not(.outofstock).sale-preset-4:after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}};', |
| 3320 | ], |
| 3321 | ] |
| 3322 | ); |
| 3323 | |
| 3324 | // Quantity |
| 3325 | $this->add_control( |
| 3326 | 'eael_product_popup_quantity', |
| 3327 | [ |
| 3328 | 'label' => __( 'Quantity', 'essential-addons-for-elementor-lite' ), |
| 3329 | 'type' => Controls_Manager::HEADING, |
| 3330 | 'separator' => 'before', |
| 3331 | ] |
| 3332 | ); |
| 3333 | |
| 3334 | $this->add_group_control( |
| 3335 | Group_Control_Typography::get_type(), |
| 3336 | [ |
| 3337 | 'name' => 'eael_product_popup_quantity_typo', |
| 3338 | 'label' => __( 'Typography', 'essential-addons-for-elementor-lite' ), |
| 3339 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}} div.product form.cart div.quantity .qty, {{WRAPPER}} .eael-product-popup.woocommerce div.product form.cart div.quantity > a', |
| 3340 | ] |
| 3341 | ); |
| 3342 | |
| 3343 | $this->add_control( |
| 3344 | 'eael_product_popup_quantity_color', |
| 3345 | [ |
| 3346 | 'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ), |
| 3347 | 'type' => Controls_Manager::COLOR, |
| 3348 | 'default' => '#000', |
| 3349 | 'selectors' => [ |
| 3350 | '.eael-popup-details-render .elementor-element-{{ID}} div.product form.cart div.quantity .qty, {{WRAPPER}} .eael-product-popup.woocommerce div.product form.cart div.quantity > a, {{WRAPPER}} .eael-product-popup.woocommerce div.product form.cart div.quantity > .button' => 'color: {{VALUE}};', |
| 3351 | ], |
| 3352 | ] |
| 3353 | ); |
| 3354 | |
| 3355 | $this->add_control( |
| 3356 | 'eael_product_popup_quantity_bg_color', |
| 3357 | [ |
| 3358 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 3359 | 'type' => Controls_Manager::COLOR, |
| 3360 | 'default' => '#fff', |
| 3361 | 'selectors' => [ |
| 3362 | '.eael-popup-details-render .elementor-element-{{ID}} div.product form.cart div.quantity .qty, {{WRAPPER}} .eael-product-popup.woocommerce div.product form.cart div.quantity > a, {{WRAPPER}} .eael-product-popup.woocommerce div.product form.cart div.quantity > .button' => 'background-color: {{VALUE}};', |
| 3363 | ], |
| 3364 | ] |
| 3365 | ); |
| 3366 | |
| 3367 | $this->add_control( |
| 3368 | 'eael_product_popup_quantity_border_color', |
| 3369 | [ |
| 3370 | 'label' => esc_html__( 'Border Color', 'essential-addons-for-elementor-lite' ), |
| 3371 | 'type' => Controls_Manager::COLOR, |
| 3372 | 'default' => '#000', |
| 3373 | 'selectors' => [ |
| 3374 | '.eael-popup-details-render .elementor-element-{{ID}} div.product form.cart div.quantity .qty, {{WRAPPER}} .eael-product-popup.woocommerce div.product form.cart div.quantity > a, {{WRAPPER}} .eael-product-popup.woocommerce div.product form.cart div.quantity > .button' => 'border-color: {{VALUE}};', |
| 3375 | // OceanWP |
| 3376 | '.eael-popup-details-render .elementor-element-{{ID}} div.product form.cart div.quantity .qty:focus' => 'border-color: {{VALUE}};', |
| 3377 | ], |
| 3378 | ] |
| 3379 | ); |
| 3380 | |
| 3381 | // Cart Button |
| 3382 | $this->add_control( |
| 3383 | 'eael_product_popup_cart_button', |
| 3384 | [ |
| 3385 | 'label' => __('Cart Button', 'essential-addons-for-elementor-lite'), |
| 3386 | 'type' => Controls_Manager::HEADING, |
| 3387 | 'separator' => 'before', |
| 3388 | ] |
| 3389 | ); |
| 3390 | |
| 3391 | $this->add_group_control( |
| 3392 | Group_Control_Typography::get_type(), |
| 3393 | [ |
| 3394 | 'name' => 'eael_product_popup_cart_button_typo', |
| 3395 | 'label' => __( 'Typography', 'essential-addons-for-elementor-lite' ), |
| 3396 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}} .button, .eael-popup-details-render .elementor-element-{{ID}} button.button.alt', |
| 3397 | ] |
| 3398 | ); |
| 3399 | |
| 3400 | $this->start_controls_tabs('eael_product_popup_cart_button_style_tabs'); |
| 3401 | |
| 3402 | $this->start_controls_tab('eael_product_popup_cart_button_style_tabs_normal', ['label' => esc_html__('Normal', 'essential-addons-for-elementor-lite')]); |
| 3403 | |
| 3404 | $this->add_control( |
| 3405 | 'eael_product_popup_cart_button_color', |
| 3406 | [ |
| 3407 | 'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ), |
| 3408 | 'type' => Controls_Manager::COLOR, |
| 3409 | 'default' => '#fff', |
| 3410 | 'selectors' => [ |
| 3411 | '.eael-popup-details-render .elementor-element-{{ID}} .button, .eael-popup-details-render .elementor-element-{{ID}} button.button.alt' => 'color: {{VALUE}};', |
| 3412 | ], |
| 3413 | ] |
| 3414 | ); |
| 3415 | |
| 3416 | $this->add_control( |
| 3417 | 'eael_product_popup_cart_button_background', |
| 3418 | [ |
| 3419 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 3420 | 'type' => Controls_Manager::COLOR, |
| 3421 | 'default' => '#8040FF', |
| 3422 | 'selectors' => [ |
| 3423 | '.eael-popup-details-render .elementor-element-{{ID}} .button, .eael-popup-details-render .elementor-element-{{ID}} button.button.alt' => 'background-color: {{VALUE}};', |
| 3424 | ], |
| 3425 | ] |
| 3426 | ); |
| 3427 | |
| 3428 | $this->add_group_control( |
| 3429 | Group_Control_Border::get_type(), |
| 3430 | [ |
| 3431 | 'name' => 'eael_product_popup_cart_button_border', |
| 3432 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}} .button, .eael-popup-details-render .elementor-element-{{ID}} button.button.alt', |
| 3433 | ] |
| 3434 | ); |
| 3435 | $this->add_control( |
| 3436 | 'eael_product_popup_cart_button_border_radius', |
| 3437 | [ |
| 3438 | 'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 3439 | 'type' => Controls_Manager::SLIDER, |
| 3440 | 'range' => [ |
| 3441 | 'px' => [ |
| 3442 | 'max' => 100, |
| 3443 | ], |
| 3444 | ], |
| 3445 | 'selectors' => [ |
| 3446 | '.eael-popup-details-render .elementor-element-{{ID}} .button, .eael-popup-details-render .elementor-element-{{ID}} button.button.alt' => 'border-radius: {{SIZE}}px;', |
| 3447 | ], |
| 3448 | ] |
| 3449 | ); |
| 3450 | |
| 3451 | $this->end_controls_tab(); |
| 3452 | |
| 3453 | $this->start_controls_tab('eael_product_popup_cart_button_hover_styles', ['label' => esc_html__('Hover', 'essential-addons-for-elementor-lite')]); |
| 3454 | |
| 3455 | $this->add_control( |
| 3456 | 'eael_product_popup_cart_button_hover_color', |
| 3457 | [ |
| 3458 | 'label' => esc_html__( 'Color', 'essential-addons-for-elementor-lite' ), |
| 3459 | 'type' => Controls_Manager::COLOR, |
| 3460 | 'default' => '#F5EAFF', |
| 3461 | 'selectors' => [ |
| 3462 | '.eael-popup-details-render .elementor-element-{{ID}} .button:hover, .eael-popup-details-render .elementor-element-{{ID}} button.button.alt:hover' => 'color: {{VALUE}};', |
| 3463 | ], |
| 3464 | ] |
| 3465 | ); |
| 3466 | |
| 3467 | $this->add_control( |
| 3468 | 'eael_product_popup_cart_button_hover_background', |
| 3469 | [ |
| 3470 | 'label' => esc_html__( 'Background Color', 'essential-addons-for-elementor-lite' ), |
| 3471 | 'type' => Controls_Manager::COLOR, |
| 3472 | 'default' => '#F12DE0', |
| 3473 | 'selectors' => [ |
| 3474 | '.eael-popup-details-render .elementor-element-{{ID}} .button:hover, .eael-popup-details-render .elementor-element-{{ID}} button.button.alt:hover' => 'background-color: {{VALUE}};', |
| 3475 | ], |
| 3476 | ] |
| 3477 | ); |
| 3478 | |
| 3479 | $this->add_control( |
| 3480 | 'eael_product_popup_cart_button_hover_border_color', |
| 3481 | [ |
| 3482 | 'label' => esc_html__( 'Border Color', 'essential-addons-for-elementor-lite' ), |
| 3483 | 'type' => Controls_Manager::COLOR, |
| 3484 | 'default' => '', |
| 3485 | 'selectors' => [ |
| 3486 | '.eael-popup-details-render .elementor-element-{{ID}} .button:hover, .eael-popup-details-render .elementor-element-{{ID}} button.button.alt:hover' => 'border-color: {{VALUE}};', |
| 3487 | ], |
| 3488 | 'condition' => [ |
| 3489 | 'eael_product_popup_cart_button_border_border!' => '', |
| 3490 | ], |
| 3491 | ] |
| 3492 | ); |
| 3493 | |
| 3494 | $this->end_controls_tab(); |
| 3495 | |
| 3496 | $this->end_controls_tabs(); |
| 3497 | |
| 3498 | // SKU |
| 3499 | $this->add_control( |
| 3500 | 'eael_product_popup_sku_style', |
| 3501 | [ |
| 3502 | 'label' => __('SKU', 'essential-addons-for-elementor-lite'), |
| 3503 | 'type' => Controls_Manager::HEADING, |
| 3504 | 'separator' => 'before', |
| 3505 | ] |
| 3506 | ); |
| 3507 | |
| 3508 | $this->add_group_control( |
| 3509 | Group_Control_Typography::get_type(), |
| 3510 | [ |
| 3511 | 'name' => 'eael_product_popup_sku_typo', |
| 3512 | 'label' => __( 'Typography', 'essential-addons-for-elementor-lite' ), |
| 3513 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}} .product_meta', |
| 3514 | ] |
| 3515 | ); |
| 3516 | |
| 3517 | |
| 3518 | $this->add_control( |
| 3519 | 'eael_product_popup_sku_title_color', |
| 3520 | [ |
| 3521 | 'label' => __( 'Title Color', 'essential-addons-for-elementor-lite' ), |
| 3522 | 'type' => Controls_Manager::COLOR, |
| 3523 | 'selectors' => [ |
| 3524 | '.eael-popup-details-render .elementor-element-{{ID}} .product_meta' => 'color: {{VALUE}};', |
| 3525 | ], |
| 3526 | ] |
| 3527 | ); |
| 3528 | |
| 3529 | $this->add_control( |
| 3530 | 'eael_product_popup_sku_content_color', |
| 3531 | [ |
| 3532 | 'label' => __( 'Content Color', 'essential-addons-for-elementor-lite' ), |
| 3533 | 'type' => Controls_Manager::COLOR, |
| 3534 | 'selectors' => [ |
| 3535 | '.eael-popup-details-render .elementor-element-{{ID}} .product_meta .sku, .eael-popup-details-render .elementor-element-{{ID}} .product_meta a' => 'color: {{VALUE}};', |
| 3536 | ], |
| 3537 | ] |
| 3538 | ); |
| 3539 | |
| 3540 | $this->add_control( |
| 3541 | 'eael_product_popup_sku_hover_color', |
| 3542 | [ |
| 3543 | 'label' => __( 'Hover Color', 'essential-addons-for-elementor-lite' ), |
| 3544 | 'type' => Controls_Manager::COLOR, |
| 3545 | 'selectors' => [ |
| 3546 | '.eael-popup-details-render .elementor-element-{{ID}} .product_meta a:hover' => 'color: {{VALUE}};', |
| 3547 | ], |
| 3548 | ] |
| 3549 | ); |
| 3550 | |
| 3551 | $this->add_control( |
| 3552 | 'eael_product_popup_close_button_style', |
| 3553 | [ |
| 3554 | 'label' => __( ' Close Button', 'essential-addons-for-elementor-lite' ), |
| 3555 | 'type' => Controls_Manager::HEADING, |
| 3556 | 'separator' => 'before', |
| 3557 | ] |
| 3558 | ); |
| 3559 | |
| 3560 | $this->add_responsive_control( |
| 3561 | 'eael_product_popup_close_button_icon_size', |
| 3562 | [ |
| 3563 | 'label' => __( 'Icon Size', 'essential-addons-for-elementor-lite' ), |
| 3564 | 'type' => Controls_Manager::SLIDER, |
| 3565 | 'size_units' => ['px', 'em', '%'], |
| 3566 | 'range' => [ |
| 3567 | 'px' => [ |
| 3568 | 'min' => 0, |
| 3569 | 'max' => 100, |
| 3570 | ], |
| 3571 | 'em' => [ |
| 3572 | 'min' => 0, |
| 3573 | 'max' => 100, |
| 3574 | ], |
| 3575 | '%' => [ |
| 3576 | 'min' => 0, |
| 3577 | 'max' => 100, |
| 3578 | ], |
| 3579 | ], |
| 3580 | 'selectors' => [ |
| 3581 | '.eael-popup-details-render .elementor-element-{{ID}} button.eael-product-popup-close' => 'font-size: {{SIZE}}{{UNIT}};', |
| 3582 | ], |
| 3583 | ] |
| 3584 | ); |
| 3585 | |
| 3586 | $this->add_responsive_control( |
| 3587 | 'eael_product_popup_close_button_size', |
| 3588 | [ |
| 3589 | 'label' => __( 'Button Size', 'essential-addons-for-elementor-lite' ), |
| 3590 | 'type' => Controls_Manager::SLIDER, |
| 3591 | 'size_units' => ['px', 'em', '%'], |
| 3592 | 'range' => [ |
| 3593 | 'px' => [ |
| 3594 | 'min' => 0, |
| 3595 | 'max' => 100, |
| 3596 | ], |
| 3597 | 'em' => [ |
| 3598 | 'min' => 0, |
| 3599 | 'max' => 100, |
| 3600 | ], |
| 3601 | '%' => [ |
| 3602 | 'min' => 0, |
| 3603 | 'max' => 100, |
| 3604 | ], |
| 3605 | ], |
| 3606 | 'selectors' => [ |
| 3607 | '.eael-popup-details-render .elementor-element-{{ID}} button.eael-product-popup-close' => 'max-width: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; min-height: {{SIZE}}{{UNIT}}', |
| 3608 | ], |
| 3609 | ] |
| 3610 | ); |
| 3611 | |
| 3612 | $this->add_control( |
| 3613 | 'eael_product_popup_close_button_color', |
| 3614 | [ |
| 3615 | 'label' => __( 'Color', 'essential-addons-for-elementor-lite' ), |
| 3616 | 'type' => Controls_Manager::COLOR, |
| 3617 | 'selectors' => [ |
| 3618 | '.eael-popup-details-render .elementor-element-{{ID}} button.eael-product-popup-close' => 'color: {{VALUE}}!important;', |
| 3619 | ], |
| 3620 | ] |
| 3621 | ); |
| 3622 | |
| 3623 | $this->add_control( |
| 3624 | 'eael_product_popup_close_button_bg', |
| 3625 | [ |
| 3626 | 'label' => __( 'Background', 'essential-addons-for-elementor-lite' ), |
| 3627 | 'type' => Controls_Manager::COLOR, |
| 3628 | 'selectors' => [ |
| 3629 | '.eael-popup-details-render .elementor-element-{{ID}} button.eael-product-popup-close' => 'background-color: {{VALUE}}!important;', |
| 3630 | ], |
| 3631 | ] |
| 3632 | ); |
| 3633 | |
| 3634 | $this->add_control( |
| 3635 | 'eael_product_popup_close_button_border_radius', |
| 3636 | [ |
| 3637 | 'label' => __( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 3638 | 'type' => Controls_Manager::SLIDER, |
| 3639 | 'size_units' => ['px', '%'], |
| 3640 | 'range' => [ |
| 3641 | 'px' => [ |
| 3642 | 'min' => 0, |
| 3643 | 'max' => 100, |
| 3644 | 'step' => 1, |
| 3645 | ], |
| 3646 | '%' => [ |
| 3647 | 'min' => 0, |
| 3648 | 'max' => 100, |
| 3649 | ], |
| 3650 | ], |
| 3651 | 'selectors' => [ |
| 3652 | '.eael-popup-details-render .elementor-element-{{ID}} button.eael-product-popup-close' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 3653 | ], |
| 3654 | ] |
| 3655 | ); |
| 3656 | |
| 3657 | $this->add_group_control( |
| 3658 | Group_Control_Box_Shadow::get_type(), |
| 3659 | [ |
| 3660 | 'name' => 'eael_product_popup_close_button_box_shadow', |
| 3661 | 'label' => __( 'Box Shadow', 'essential-addons-for-elementor-lite' ), |
| 3662 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}} button.eael-product-popup-close', |
| 3663 | ] |
| 3664 | ); |
| 3665 | |
| 3666 | $this->add_responsive_control( |
| 3667 | 'eael_product_popup_border_radius', |
| 3668 | [ |
| 3669 | 'label' => esc_html__( 'Border Radius', 'essential-addons-for-elementor-lite' ), |
| 3670 | 'type' => Controls_Manager::DIMENSIONS, |
| 3671 | 'size_units' => ['px', '%'], |
| 3672 | 'selectors' => [ |
| 3673 | '.eael-popup-details-render .elementor-element-{{ID}}.eael-product-popup-details' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3674 | ], |
| 3675 | 'separator' => 'before', |
| 3676 | ] |
| 3677 | ); |
| 3678 | |
| 3679 | $this->add_group_control( |
| 3680 | Group_Control_Background::get_type(), |
| 3681 | [ |
| 3682 | 'name' => 'eael_product_popup_background', |
| 3683 | 'label' => __( 'Background', 'essential-addons-for-elementor-lite' ), |
| 3684 | 'types' => ['classic', 'gradient'], |
| 3685 | 'selector' => '.eael-popup-details-render .elementor-element-{{ID}}.eael-product-popup-details', |
| 3686 | 'exclude' => [ |
| 3687 | 'image', |
| 3688 | ], |
| 3689 | ] |
| 3690 | ); |
| 3691 | |
| 3692 | $this->add_group_control( |
| 3693 | Group_Control_Box_Shadow::get_type(), |
| 3694 | [ |
| 3695 | 'name' => 'eael_product_popup_box_shadow', |
| 3696 | 'label' => __('Box Shadow', 'essential-addons-for-elementor-lite'), |
| 3697 | 'selector' => '{{WRAPPER}} .eael-product-popup .eael-product-popup-details', |
| 3698 | ] |
| 3699 | ); |
| 3700 | |
| 3701 | $this->end_controls_section(); |
| 3702 | } |
| 3703 | |
| 3704 | function eael_customize_woo_prod_thumbnail_size( $size ) { |
| 3705 | $settings = $this->get_settings_for_display(); |
| 3706 | |
| 3707 | return $settings['eael_product_grid_image_size_size']; |
| 3708 | } |
| 3709 | |
| 3710 | protected function render() |
| 3711 | { |
| 3712 | if (!function_exists('WC')) { |
| 3713 | return; |
| 3714 | } |
| 3715 | |
| 3716 | $settings = $this->get_settings_for_display(); |
| 3717 | |
| 3718 | // normalize for load more fix |
| 3719 | $settings['layout_mode'] = $settings["eael_product_grid_layout"]; |
| 3720 | $widget_id = esc_attr( $this->get_id() ); |
| 3721 | $settings['eael_widget_id'] = $widget_id; |
| 3722 | $is_product_archive = is_product_tag() || is_product_category() || is_shop() || is_product_taxonomy(); |
| 3723 | |
| 3724 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 3725 | if ( $settings['post_type'] === 'source_dynamic' && is_archive() || ! empty( $_REQUEST['post_type'] ) ) { |
| 3726 | $settings['posts_per_page'] = $settings['eael_product_grid_products_count'] ?: 4; |
| 3727 | $settings['offset'] = $settings['product_offset']; |
| 3728 | $args = HelperClass::get_query_args( $settings ); |
| 3729 | $args = HelperClass::get_dynamic_args( $settings, $args ); |
| 3730 | } else { |
| 3731 | $args = $this->build_product_query( $settings ); |
| 3732 | } |
| 3733 | |
| 3734 | $no_products_found = 0; |
| 3735 | |
| 3736 | if ( is_user_logged_in() ) { |
| 3737 | $product_purchase_type = ! empty( $settings['product_type_logged_users'] ) ? sanitize_text_field( $settings['product_type_logged_users'] ) : ''; |
| 3738 | |
| 3739 | if ( in_array( $product_purchase_type, ['purchased', 'not-purchased'] ) ) { |
| 3740 | $user_ordered_products = HelperClass::eael_get_all_user_ordered_products(); |
| 3741 | $no_products_found = empty( $user_ordered_products ) && 'purchased' === $product_purchase_type ? 1 : 0; |
| 3742 | |
| 3743 | if ( ! empty( $user_ordered_products ) && 'purchased' === $product_purchase_type ){ |
| 3744 | $args['post__in'] = $user_ordered_products; |
| 3745 | } |
| 3746 | |
| 3747 | if ( ! empty( $user_ordered_products ) && 'not-purchased' === $product_purchase_type ){ |
| 3748 | if ( ! empty( $args['post__not_in'] ) ) { |
| 3749 | $args['post__not_in'] = array_merge( $args['post__not_in'], $user_ordered_products ); |
| 3750 | } else { |
| 3751 | $args['post__not_in'] = $user_ordered_products; |
| 3752 | } |
| 3753 | } |
| 3754 | } |
| 3755 | } |
| 3756 | |
| 3757 | if ( ! empty( $settings['eael_product_not_in'] ) ) { |
| 3758 | if ( ! empty( $args['post__not_in'] ) ) { |
| 3759 | $exclude = array_merge( $args['post__not_in'], $settings['eael_product_not_in'] ); |
| 3760 | $args['post__not_in'] = $exclude; |
| 3761 | } else { |
| 3762 | $args['post__not_in'] = $settings['eael_product_not_in']; |
| 3763 | } |
| 3764 | } |
| 3765 | |
| 3766 | $this->is_show_custom_add_to_cart = boolval( $settings['show_add_to_cart_custom_text'] ); |
| 3767 | $this->simple_add_to_cart_button_text = $settings['add_to_cart_simple_product_button_text']; |
| 3768 | $this->variable_add_to_cart_button_text = $settings['add_to_cart_variable_product_button_text']; |
| 3769 | $this->grouped_add_to_cart_button_text = $settings['add_to_cart_grouped_product_button_text']; |
| 3770 | $this->external_add_to_cart_button_text = $settings['add_to_cart_external_product_button_text']; |
| 3771 | $this->default_add_to_cart_button_text = $settings['add_to_cart_default_product_button_text']; |
| 3772 | |
| 3773 | if ( Plugin::$instance->documents->get_current() ) { |
| 3774 | $this->page_id = Plugin::$instance->documents->get_current()->get_main_id(); |
| 3775 | } |
| 3776 | // render dom |
| 3777 | $this->add_render_attribute( 'wrap', [ |
| 3778 | 'class' => [ |
| 3779 | "eael-product-grid", |
| 3780 | $settings['eael_product_grid_style_preset'], |
| 3781 | $settings['eael_product_grid_layout'] |
| 3782 | ], |
| 3783 | 'id' => 'eael-product-grid', |
| 3784 | 'data-widget-id' => $widget_id, |
| 3785 | 'data-page-id' => $this->page_id, |
| 3786 | 'data-nonce' => wp_create_nonce( 'eael_product_grid' ), |
| 3787 | ] ); |
| 3788 | |
| 3789 | add_filter( 'woocommerce_product_add_to_cart_text', [ |
| 3790 | $this, |
| 3791 | 'add_to_cart_button_custom_text', |
| 3792 | ] ); |
| 3793 | ?> |
| 3794 | |
| 3795 | <div <?php $this->print_render_attribute_string('wrap'); ?> > |
| 3796 | <div class="woocommerce"> |
| 3797 | <?php |
| 3798 | do_action( 'eael_woo_before_product_loop', $settings['eael_product_grid_style_preset'] ); |
| 3799 | |
| 3800 | $template_name = ! empty( $settings['eael_product_grid_style_preset'] ) ? $settings['eael_product_grid_style_preset'] : 'eael-product-simple'; |
| 3801 | |
| 3802 | |
| 3803 | if ( 'list' === $settings['eael_product_grid_layout'] ) { |
| 3804 | $template_name = $settings['eael_product_list_style_preset']; |
| 3805 | } |
| 3806 | |
| 3807 | if ( strpos( $template_name, 'eael-product-' ) === 0 ) { |
| 3808 | $template_name = str_replace( 'eael-product-', '', $template_name ); |
| 3809 | } |
| 3810 | |
| 3811 | $template = $this->get_template( $template_name ); |
| 3812 | $settings['loadable_file_name'] = $this->get_filename_only( $template ); |
| 3813 | $dir_name = $this->get_temp_dir_name( $settings['loadable_file_name'] ); |
| 3814 | $found_posts = 0; |
| 3815 | $post_offset = isset( $settings['product_offset'] ) ? absint( $settings['product_offset'] ) : 0; |
| 3816 | |
| 3817 | if ( file_exists( $template ) ) { |
| 3818 | $settings['eael_page_id'] = $this->page_id ? $this->page_id : get_the_ID(); |
| 3819 | |
| 3820 | if( $settings['post_type'] === 'source_archive' && ( ( is_archive() && $is_product_archive ) || is_search() ) ){ |
| 3821 | global $wp_query; |
| 3822 | $query = $wp_query; |
| 3823 | $args = $wp_query->query; |
| 3824 | $found_posts = $query->found_posts; |
| 3825 | } else { |
| 3826 | $args = apply_filters( 'eael_wc_product_query_args', $args, $this->get_name() ); |
| 3827 | $query = new \WP_Query( $args ); |
| 3828 | $found_posts = $query->found_posts; |
| 3829 | } |
| 3830 | |
| 3831 | if ( $query->have_posts() && ! $no_products_found ) { |
| 3832 | $found_posts = $found_posts - $post_offset; |
| 3833 | $max_page = ceil( $found_posts / absint( $args['posts_per_page'] ?? 4 ) ); |
| 3834 | $args['max_page'] = $max_page; |
| 3835 | $args['total_post'] = $found_posts; |
| 3836 | |
| 3837 | // Add secondary image data attributes |
| 3838 | $this->add_render_attribute( 'eael-post-appender', 'class', [ 'products', 'eael-post-appender', 'eael-post-appender-' . $this->get_id() ] ); |
| 3839 | if ( isset( $settings['eael_product_grid_show_secondary_image'] ) ) { |
| 3840 | $this->add_render_attribute( 'eael-post-appender', 'data-ssi-desktop' , esc_attr( $settings['eael_product_grid_show_secondary_image'] ) ); |
| 3841 | $this->add_render_attribute( 'eael-post-appender', 'data-ssi-tablet' , esc_attr( $settings['eael_product_grid_show_secondary_image_tablet'] ?? $settings['eael_product_grid_show_secondary_image'] ) ); |
| 3842 | $this->add_render_attribute( 'eael-post-appender', 'data-ssi-mobile' , esc_attr( $settings['eael_product_grid_show_secondary_image_mobile'] ?? $settings['eael_product_grid_show_secondary_image'] ) ); |
| 3843 | } |
| 3844 | |
| 3845 | $this->add_render_attribute( 'eael-post-appender', 'data-layout-mode' , esc_attr( $settings['eael_product_grid_layout'] ) ); |
| 3846 | echo '<ul '; $this->print_render_attribute_string( 'eael-post-appender' ); echo '>'; |
| 3847 | while ( $query->have_posts() ) { |
| 3848 | $query->the_post(); |
| 3849 | include( realpath( $template ) ); |
| 3850 | } |
| 3851 | wp_reset_postdata(); |
| 3852 | |
| 3853 | echo '</ul>'; |
| 3854 | do_action( 'eael_woo_after_product_loop' ); |
| 3855 | |
| 3856 | } else { |
| 3857 | echo '<p class="no-posts-found">' . esc_html__( 'No posts found!', 'essential-addons-for-elementor-lite' ) . '</p>'; |
| 3858 | } |
| 3859 | |
| 3860 | } else { |
| 3861 | echo '<p class="no-posts-found">' . esc_html__( 'No layout found!', 'essential-addons-for-elementor-lite' ) . '</p>'; |
| 3862 | } |
| 3863 | |
| 3864 | if ( 'true' == $settings['show_pagination'] && 'source_archive' !== $settings['post_type'] ) { |
| 3865 | $settings['eael_widget_name'] = $this->get_name(); |
| 3866 | $settings['eael_product_grid_template'] = $template_name; |
| 3867 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 3868 | echo HelperClass::eael_pagination( $args, $settings ); |
| 3869 | } |
| 3870 | |
| 3871 | if( 'source_archive' === $settings['post_type'] ){ |
| 3872 | echo "<div class='eael-product-grid-pagination' >"; |
| 3873 | woocommerce_pagination(); |
| 3874 | echo "</div>"; |
| 3875 | } |
| 3876 | |
| 3877 | if ( $found_posts > $args['posts_per_page'] && 'source_archive' !== $settings['post_type'] ) { |
| 3878 | $this->print_load_more_button( $settings, $args, $dir_name ); |
| 3879 | } |
| 3880 | |
| 3881 | do_action( 'eael_woo_after_product_loop', $settings['eael_product_grid_style_preset'] ); |
| 3882 | ?> |
| 3883 | </div> |
| 3884 | </div> |
| 3885 | |
| 3886 | <script type="text/javascript"> |
| 3887 | jQuery(document).ready(function($) { |
| 3888 | var $scope = jQuery(".elementor-element-<?php echo esc_js( $this->get_id() ); ?>"); |
| 3889 | var $products = $('.products', $scope); |
| 3890 | var $layout_mode = $products.data('layout-mode'); |
| 3891 | |
| 3892 | if ( $layout_mode === 'masonry' ) { |
| 3893 | // init isotope |
| 3894 | var $isotope_products = $products.isotope({ |
| 3895 | itemSelector: "li.product", |
| 3896 | layoutMode: $layout_mode, |
| 3897 | percentPosition: true |
| 3898 | }); |
| 3899 | |
| 3900 | $isotope_products.imagesLoaded().progress( function() { |
| 3901 | $isotope_products.isotope('layout'); |
| 3902 | }) |
| 3903 | |
| 3904 | } |
| 3905 | }); |
| 3906 | </script> |
| 3907 | <?php |
| 3908 | remove_filter('woocommerce_product_add_to_cart_text', [ |
| 3909 | $this, |
| 3910 | 'add_to_cart_button_custom_text', |
| 3911 | ]); |
| 3912 | remove_filter( 'single_product_archive_thumbnail_size', [ $this, 'eael_customize_woo_prod_thumbnail_size' ] ); |
| 3913 | } |
| 3914 | |
| 3915 | /** |
| 3916 | * build_product_query |
| 3917 | * @param $settings |
| 3918 | * @return array |
| 3919 | */ |
| 3920 | public function build_product_query( $settings ) { |
| 3921 | |
| 3922 | $args = [ |
| 3923 | 'post_type' => 'product', |
| 3924 | 'post_status' => ! empty( $settings['eael_product_grid_products_status'] ) |
| 3925 | ? $settings['eael_product_grid_products_status'] |
| 3926 | : [ 'publish', 'pending', 'future' ], |
| 3927 | 'posts_per_page' => ! empty( $settings['eael_product_grid_products_count'] ) |
| 3928 | ? (int) $settings['eael_product_grid_products_count'] |
| 3929 | : 4, |
| 3930 | 'order' => isset( $settings['order'] ) ? $settings['order'] : 'DESC', |
| 3931 | 'offset' => ! empty( $settings['product_offset'] ) ? (int) $settings['product_offset'] : 0, |
| 3932 | 'tax_query' => [ |
| 3933 | 'relation' => 'AND', |
| 3934 | [ |
| 3935 | 'taxonomy' => 'product_visibility', |
| 3936 | 'field' => 'name', |
| 3937 | 'terms' => [ 'exclude-from-search', 'exclude-from-catalog' ], |
| 3938 | 'operator' => 'NOT IN', |
| 3939 | ], |
| 3940 | ], |
| 3941 | 'meta_query' => [ 'relation' => 'AND' ], |
| 3942 | ]; |
| 3943 | |
| 3944 | // Exclude current product |
| 3945 | if ( is_singular( 'product' ) ) { |
| 3946 | $args['post__not_in'] = [ get_the_ID() ]; |
| 3947 | } |
| 3948 | |
| 3949 | /* |
| 3950 | * ---------------------------------------- |
| 3951 | * ORDER BY |
| 3952 | * ---------------------------------------- |
| 3953 | */ |
| 3954 | if ( isset( $settings['orderby'] ) && '_price' === $settings['orderby'] ) { |
| 3955 | $args['orderby'] = 'meta_value_num'; |
| 3956 | $args['meta_key'] = '_price'; |
| 3957 | } elseif ( isset( $settings['orderby'] ) && '_sku' === $settings['orderby'] ) { |
| 3958 | $args['orderby'] = 'meta_value'; |
| 3959 | $args['meta_key'] = '_sku'; |
| 3960 | } else { |
| 3961 | $args['orderby'] = isset( $settings['orderby'] ) ? $settings['orderby'] : 'date'; |
| 3962 | } |
| 3963 | |
| 3964 | /* |
| 3965 | * ---------------------------------------- |
| 3966 | * CATEGORY INCLUDE / EXCLUDE |
| 3967 | * ---------------------------------------- |
| 3968 | */ |
| 3969 | if ( ! empty( $settings['eael_product_grid_categories'] ) ) { |
| 3970 | $args['tax_query'][] = [ |
| 3971 | 'taxonomy' => 'product_cat', |
| 3972 | 'field' => 'slug', |
| 3973 | 'terms' => $settings['eael_product_grid_categories'], |
| 3974 | 'operator' => 'IN', |
| 3975 | ]; |
| 3976 | } |
| 3977 | |
| 3978 | if ( ! empty( $settings['eael_product_cat_not_in'] ) ) { |
| 3979 | $args['tax_query'][] = [ |
| 3980 | 'taxonomy' => 'product_cat', |
| 3981 | 'field' => 'slug', |
| 3982 | 'terms' => $settings['eael_product_cat_not_in'], |
| 3983 | 'operator' => 'NOT IN', |
| 3984 | ]; |
| 3985 | } |
| 3986 | |
| 3987 | /* |
| 3988 | * ---------------------------------------- |
| 3989 | * TAG FILTER |
| 3990 | * ---------------------------------------- |
| 3991 | */ |
| 3992 | if ( ! empty( $settings['eael_product_grid_tags'] ) ) { |
| 3993 | $args['tax_query'][] = [ |
| 3994 | 'taxonomy' => 'product_tag', |
| 3995 | 'field' => 'slug', |
| 3996 | 'terms' => $settings['eael_product_grid_tags'], |
| 3997 | 'operator' => 'IN', |
| 3998 | ]; |
| 3999 | } |
| 4000 | |
| 4001 | /* |
| 4002 | * ---------------------------------------- |
| 4003 | * STOCK VISIBILITY |
| 4004 | * ---------------------------------------- |
| 4005 | */ |
| 4006 | if ( |
| 4007 | get_option( 'woocommerce_hide_out_of_stock_items' ) === 'yes' |
| 4008 | || 'yes' !== $settings['eael_product_show_stockout'] |
| 4009 | ) { |
| 4010 | $args['meta_query'][] = [ |
| 4011 | 'key' => '_stock_status', |
| 4012 | 'value' => 'instock', |
| 4013 | ]; |
| 4014 | } |
| 4015 | |
| 4016 | /* |
| 4017 | * ---------------------------------------- |
| 4018 | * EXCLUDE ON-SALE PRODUCTS |
| 4019 | * ---------------------------------------- |
| 4020 | */ |
| 4021 | if ( 'yes' !== $settings['eael_product_grid_show_onsale'] ) { |
| 4022 | $on_sale_ids = wc_get_product_ids_on_sale(); |
| 4023 | if ( ! empty( $on_sale_ids ) ) { |
| 4024 | $args['post__not_in'] = array_merge( |
| 4025 | $args['post__not_in'] ?? [], |
| 4026 | $on_sale_ids |
| 4027 | ); |
| 4028 | } |
| 4029 | } |
| 4030 | |
| 4031 | /* |
| 4032 | * ---------------------------------------- |
| 4033 | * PRODUCT FILTER TYPES |
| 4034 | * ---------------------------------------- |
| 4035 | */ |
| 4036 | switch ( $settings['eael_product_grid_product_filter'] ) { |
| 4037 | |
| 4038 | case 'featured-products': |
| 4039 | $args['tax_query'][] = [ |
| 4040 | 'taxonomy' => 'product_visibility', |
| 4041 | 'field' => 'name', |
| 4042 | 'terms' => [ 'featured' ], |
| 4043 | ]; |
| 4044 | break; |
| 4045 | |
| 4046 | case 'best-selling-products': |
| 4047 | $args['meta_key'] = 'total_sales'; |
| 4048 | $args['orderby'] = 'meta_value_num'; |
| 4049 | $args['order'] = 'DESC'; |
| 4050 | break; |
| 4051 | |
| 4052 | case 'sale-products': |
| 4053 | $args['post__in'] = array_merge( [ 0 ], wc_get_product_ids_on_sale() ); |
| 4054 | break; |
| 4055 | |
| 4056 | case 'top-products': |
| 4057 | $args['meta_key'] = '_wc_average_rating'; |
| 4058 | $args['orderby'] = 'meta_value_num'; |
| 4059 | $args['order'] = 'DESC'; |
| 4060 | break; |
| 4061 | |
| 4062 | case 'related-products': |
| 4063 | |
| 4064 | $product_id = get_the_ID(); |
| 4065 | |
| 4066 | $cat_ids = wp_get_post_terms( |
| 4067 | $product_id, |
| 4068 | 'product_cat', |
| 4069 | [ 'fields' => 'ids' ] |
| 4070 | ); |
| 4071 | |
| 4072 | $tag_names = wp_get_post_terms( |
| 4073 | $product_id, |
| 4074 | 'product_tag', |
| 4075 | [ 'fields' => 'names' ] |
| 4076 | ); |
| 4077 | |
| 4078 | $args['tax_query'][] = [ |
| 4079 | 'relation' => 'OR', |
| 4080 | [ |
| 4081 | 'taxonomy' => 'product_cat', |
| 4082 | 'field' => 'term_id', |
| 4083 | 'terms' => $cat_ids, |
| 4084 | ], |
| 4085 | [ |
| 4086 | 'taxonomy' => 'product_tag', |
| 4087 | 'field' => 'name', |
| 4088 | 'terms' => $tag_names, |
| 4089 | ], |
| 4090 | ]; |
| 4091 | break; |
| 4092 | |
| 4093 | case 'manual': |
| 4094 | $args['post__in'] = ! empty( $settings['eael_product_grid_products_in'] ) |
| 4095 | ? $settings['eael_product_grid_products_in'] |
| 4096 | : [ 0 ]; |
| 4097 | break; |
| 4098 | } |
| 4099 | |
| 4100 | /* |
| 4101 | * ---------------------------------------- |
| 4102 | * WHOLESALE / THIRD-PARTY FILTERS |
| 4103 | * ---------------------------------------- |
| 4104 | */ |
| 4105 | if ( function_exists( 'whols_lite' ) ) { |
| 4106 | $args['meta_query'] = array_filter( |
| 4107 | apply_filters( |
| 4108 | 'woocommerce_product_query_meta_query', |
| 4109 | $args['meta_query'], |
| 4110 | new \WC_Query() |
| 4111 | ) |
| 4112 | ); |
| 4113 | } |
| 4114 | |
| 4115 | return $args; |
| 4116 | } |
| 4117 | |
| 4118 | protected function eael_get_product_statuses() { |
| 4119 | return apply_filters( 'eael/woo-product-grid/product-statuses', [ |
| 4120 | 'publish' => esc_html__( 'Publish', 'essential-addons-for-elementor-lite' ), |
| 4121 | 'draft' => esc_html__( 'Draft', 'essential-addons-for-elementor-lite' ), |
| 4122 | 'pending' => esc_html__( 'Pending Review', 'essential-addons-for-elementor-lite' ), |
| 4123 | 'future' => esc_html__( 'Schedule', 'essential-addons-for-elementor-lite' ), |
| 4124 | ] ); |
| 4125 | } |
| 4126 | |
| 4127 | public function load_quick_view_asset(){ |
| 4128 | add_action('wp_footer',function (){ |
| 4129 | if ( version_compare( WC()->version, '3.0.0', '>=' ) ) { |
| 4130 | if ( current_theme_supports( 'wc-product-gallery-zoom' ) ) { |
| 4131 | wp_enqueue_script( 'zoom' ); |
| 4132 | } |
| 4133 | if ( current_theme_supports( 'wc-product-gallery-slider' ) ) { |
| 4134 | wp_enqueue_script( 'flexslider' ); |
| 4135 | } |
| 4136 | |
| 4137 | if ( current_theme_supports( 'wc-product-gallery-lightbox' ) ) { |
| 4138 | wp_enqueue_script( 'photoswipe-ui-default' ); |
| 4139 | wp_enqueue_style( 'photoswipe-default-skin' ); |
| 4140 | if ( ! Plugin::$instance->editor->is_edit_mode() && has_action( 'wp_footer', 'woocommerce_photoswipe' ) === false ) { |
| 4141 | add_action( 'wp_footer', 'woocommerce_photoswipe', 15 ); |
| 4142 | } |
| 4143 | } |
| 4144 | wp_enqueue_script( 'wc-add-to-cart-variation' ); |
| 4145 | wp_enqueue_script( 'wc-single-product' ); |
| 4146 | } |
| 4147 | }); |
| 4148 | } |
| 4149 | } |
| 4150 |