| 1 |
<?php |
| 2 |
|
| 3 |
namespace UltimateStoreKit\Modules\ShowcaseSlider\Widgets; |
| 4 |
|
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Group_Control_Background; |
| 7 |
use Elementor\Group_Control_Border; |
| 8 |
use Elementor\Group_Control_Box_Shadow; |
| 9 |
use Elementor\Group_Control_Image_Size; |
| 10 |
use Elementor\Group_Control_Typography; |
| 11 |
use Elementor\Plugin; |
| 12 |
use UltimateStoreKit\Base\Module_Base; |
| 13 |
use UltimateStoreKit\Includes\Controls\GroupQuery\Group_Control_Query; |
| 14 |
use UltimateStoreKit\traits\Global_Widget_Controls; |
| 15 |
use UltimateStoreKit\traits\Global_Widget_Template; |
| 16 |
use WP_Query; |
| 17 |
|
| 18 |
if (!defined('ABSPATH')) { |
| 19 |
exit; |
| 20 |
} |
| 21 |
|
| 22 |
// Exit if accessed directly |
| 23 |
|
| 24 |
class Showcase_Slider extends Module_Base { |
| 25 |
use Global_Widget_Controls; |
| 26 |
use Global_Widget_Template; |
| 27 |
use Group_Control_Query; |
| 28 |
|
| 29 |
/** |
| 30 |
* @var \WP_Query |
| 31 |
*/ |
| 32 |
private $_query = null; |
| 33 |
public function get_name() { |
| 34 |
return 'usk-showcase-slider'; |
| 35 |
} |
| 36 |
|
| 37 |
public function get_title() { |
| 38 |
return esc_html__('Showcase Slider', 'ultimate-store-kit'); |
| 39 |
} |
| 40 |
|
| 41 |
public function get_icon() { |
| 42 |
return 'usk-widget-icon usk-icon-showcase-slider'; |
| 43 |
} |
| 44 |
|
| 45 |
public function get_categories() { |
| 46 |
return ['ultimate-store-kit']; |
| 47 |
} |
| 48 |
|
| 49 |
public function get_keywords() { |
| 50 |
return ['product', 'product slider', 'showcase slider', 'wc', 'carousel']; |
| 51 |
} |
| 52 |
|
| 53 |
public function get_script_depends() { |
| 54 |
return ['micromodal']; |
| 55 |
} |
| 56 |
|
| 57 |
public function get_style_depends() { |
| 58 |
if ($this->usk_is_edit_mode()) { |
| 59 |
return ['usk-all-styles']; |
| 60 |
} else { |
| 61 |
return ['usk-font', 'usk-showcase-slider']; |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
// public function get_custom_help_url() { |
| 66 |
// return 'https://youtu.be/3VkvEpVaNAM'; |
| 67 |
// } |
| 68 |
public function get_query() { |
| 69 |
return $this->_query; |
| 70 |
} |
| 71 |
|
| 72 |
protected function register_controls() { |
| 73 |
$this->start_controls_section( |
| 74 |
'section_woocommerce_layout', |
| 75 |
[ |
| 76 |
'label' => esc_html__('Layout', 'ultimate-store-kit'), |
| 77 |
] |
| 78 |
); |
| 79 |
// $this->add_responsive_control( |
| 80 |
// 'items_height', |
| 81 |
// [ |
| 82 |
// 'label' => esc_html__('Image Height', 'ultimate-store-kit'), |
| 83 |
// 'type' => Controls_Manager::SLIDER, |
| 84 |
// 'default' => [ |
| 85 |
// 'size' => 500, |
| 86 |
// ], |
| 87 |
// 'range' => [ |
| 88 |
// 'px' => [ |
| 89 |
// 'min' => 200, |
| 90 |
// 'max' => 800, |
| 91 |
// ], |
| 92 |
// ], |
| 93 |
// 'tablet_default' => [ |
| 94 |
// 'size' => 380, |
| 95 |
// ], |
| 96 |
// 'mobile_default' => [ |
| 97 |
// 'size' => 300, |
| 98 |
// ], |
| 99 |
// 'selectors' => [ |
| 100 |
// '{{WRAPPER}} .usk-showcase-slider .usk-showcase-slider-wrapper .usk-item .usk-image-wrap' => 'height: {{SIZE}}{{UNIT}}', |
| 101 |
// ], |
| 102 |
// ] |
| 103 |
// ); |
| 104 |
$this->add_responsive_control( |
| 105 |
'items_gap', |
| 106 |
[ |
| 107 |
'label' => esc_html__('Item Gap', 'ultimate-store-kit'), |
| 108 |
'type' => Controls_Manager::SLIDER, |
| 109 |
'default' => [ |
| 110 |
'size' => 120, |
| 111 |
], |
| 112 |
'range' => [ |
| 113 |
'px' => [ |
| 114 |
'min' => 0, |
| 115 |
'max' => 200, |
| 116 |
], |
| 117 |
], |
| 118 |
'tablet_default' => [ |
| 119 |
'size' => 80, |
| 120 |
], |
| 121 |
'mobile_default' => [ |
| 122 |
'size' => 0, |
| 123 |
], |
| 124 |
] |
| 125 |
); |
| 126 |
$this->add_control( |
| 127 |
'title_tags', |
| 128 |
[ |
| 129 |
'label' => esc_html__('Title HTML Tag', 'ultimate-store-kit'), |
| 130 |
'type' => Controls_Manager::SELECT, |
| 131 |
'default' => 'h3', |
| 132 |
'options' => ultimate_store_kit_title_tags(), |
| 133 |
] |
| 134 |
); |
| 135 |
|
| 136 |
$this->add_group_control( |
| 137 |
Group_Control_Image_Size::get_type(), |
| 138 |
[ |
| 139 |
'name' => 'image', |
| 140 |
'label' => esc_html__('Image Size', 'ultimate-store-kit'), |
| 141 |
'exclude' => ['custom'], |
| 142 |
'default' => 'full', |
| 143 |
] |
| 144 |
); |
| 145 |
|
| 146 |
$this->end_controls_section(); |
| 147 |
$this->start_controls_section( |
| 148 |
'section_post_query_builder', |
| 149 |
[ |
| 150 |
'label' => __('Query', 'ultimate-store-kit'), |
| 151 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 152 |
] |
| 153 |
); |
| 154 |
$this->register_query_builder_controls(); |
| 155 |
$this->register_controls_wc_additional(); |
| 156 |
$this->end_controls_section(); |
| 157 |
$this->start_controls_section( |
| 158 |
'section_woocommerce_additional', |
| 159 |
[ |
| 160 |
'label' => esc_html__('Additional', 'ultimate-store-kit'), |
| 161 |
] |
| 162 |
); |
| 163 |
$this->start_controls_tabs( |
| 164 |
'tabs_show_hide_content' |
| 165 |
); |
| 166 |
$this->start_controls_tab( |
| 167 |
'show_content_tab', |
| 168 |
[ |
| 169 |
'label' => esc_html__('Content', 'ultimate-store-kit'), |
| 170 |
] |
| 171 |
); |
| 172 |
$this->add_control( |
| 173 |
'show_title', |
| 174 |
[ |
| 175 |
'label' => esc_html__('Title', 'ultimate-store-kit'), |
| 176 |
'type' => Controls_Manager::SWITCHER, |
| 177 |
'default' => 'yes', |
| 178 |
] |
| 179 |
); |
| 180 |
$this->add_control( |
| 181 |
'show_category', |
| 182 |
[ |
| 183 |
'label' => esc_html__('Category', 'ultimate-store-kit'), |
| 184 |
'type' => Controls_Manager::SWITCHER, |
| 185 |
'default' => 'yes', |
| 186 |
] |
| 187 |
); |
| 188 |
$this->add_control( |
| 189 |
'show_rating', |
| 190 |
[ |
| 191 |
'label' => esc_html__('Rating', 'ultimate-store-kit'), |
| 192 |
'type' => Controls_Manager::SWITCHER, |
| 193 |
'default' => 'yes', |
| 194 |
] |
| 195 |
); |
| 196 |
$this->add_control( |
| 197 |
'hide_customer_review', |
| 198 |
[ |
| 199 |
'label' => esc_html__('Hide Review Text', 'ultimate-store-kit'), |
| 200 |
'type' => Controls_Manager::SWITCHER, |
| 201 |
'label_on' => esc_html__('Yes', 'product-grid'), |
| 202 |
'label_off' => esc_html__('No', 'product-grid'), |
| 203 |
// 'return_value' => 'yes', |
| 204 |
'default' => 'yes', |
| 205 |
'condition' => [ |
| 206 |
'show_rating' => 'yes', |
| 207 |
], |
| 208 |
'selectors' => [ |
| 209 |
'{{WRAPPER}} .usk-showcase-slider .usk-rating .woocommerce-review-link' => 'display:none', |
| 210 |
], |
| 211 |
] |
| 212 |
); |
| 213 |
$this->add_control( |
| 214 |
'show_button', |
| 215 |
[ |
| 216 |
'label' => esc_html__('Button', 'ultimate-store-kit'), |
| 217 |
'type' => Controls_Manager::SWITCHER, |
| 218 |
'default' => 'yes', |
| 219 |
] |
| 220 |
); |
| 221 |
$this->add_control( |
| 222 |
'show_price', |
| 223 |
[ |
| 224 |
'label' => esc_html__('Price', 'ultimate-store-kit'), |
| 225 |
'type' => Controls_Manager::SWITCHER, |
| 226 |
'default' => 'yes', |
| 227 |
] |
| 228 |
); |
| 229 |
|
| 230 |
$this->end_controls_tab(); |
| 231 |
$this->start_controls_tab( |
| 232 |
'show_sale_badge_tab', |
| 233 |
[ |
| 234 |
'label' => esc_html__('Badge', 'ultimate-store-kit'), |
| 235 |
] |
| 236 |
); |
| 237 |
$this->add_control( |
| 238 |
'show_sale_badge', |
| 239 |
[ |
| 240 |
'label' => esc_html__('Sale', 'ultimate-store-kit'), |
| 241 |
'type' => Controls_Manager::SWITCHER, |
| 242 |
'default' => 'yes', |
| 243 |
] |
| 244 |
); |
| 245 |
$this->add_control( |
| 246 |
'show_discount_badge', |
| 247 |
[ |
| 248 |
'label' => esc_html__('Percentage', 'ultimate-store-kit'), |
| 249 |
'type' => Controls_Manager::SWITCHER, |
| 250 |
'default' => 'yes', |
| 251 |
] |
| 252 |
); |
| 253 |
$this->add_control( |
| 254 |
'show_stock_status', |
| 255 |
[ |
| 256 |
'label' => esc_html__('Stock Status', 'ultimate-store-kit'), |
| 257 |
'type' => Controls_Manager::SWITCHER, |
| 258 |
'default' => 'yes', |
| 259 |
] |
| 260 |
); |
| 261 |
$this->add_control( |
| 262 |
'show_trending_badge', |
| 263 |
[ |
| 264 |
'label' => esc_html__('Trending', 'ultimate-store-kit'), |
| 265 |
'type' => Controls_Manager::SWITCHER, |
| 266 |
'default' => 'yes', |
| 267 |
] |
| 268 |
); |
| 269 |
$this->add_control( |
| 270 |
'show_new_badge', |
| 271 |
[ |
| 272 |
'label' => esc_html__('New', 'ultimate-store-kit'), |
| 273 |
'type' => Controls_Manager::SWITCHER, |
| 274 |
'default' => 'yes', |
| 275 |
] |
| 276 |
); |
| 277 |
$this->add_control( |
| 278 |
'newness_days', |
| 279 |
[ |
| 280 |
'label' => esc_html__('Newness Days', 'ultimate-store-kit'), |
| 281 |
'type' => Controls_Manager::NUMBER, |
| 282 |
'default' => 30, |
| 283 |
'condition' => [ |
| 284 |
'show_new_badge' => 'yes', |
| 285 |
], |
| 286 |
] |
| 287 |
); |
| 288 |
$this->end_controls_tab(); |
| 289 |
$this->start_controls_tab( |
| 290 |
'show_action_btn_tab', |
| 291 |
[ |
| 292 |
'label' => esc_html__('Action btn', 'ultimate-store-kit'), |
| 293 |
] |
| 294 |
); |
| 295 |
$this->add_control( |
| 296 |
'show_cart', |
| 297 |
[ |
| 298 |
'label' => esc_html__('Add to Cart', 'ultimate-store-kit'), |
| 299 |
'type' => Controls_Manager::SWITCHER, |
| 300 |
'default' => 'yes', |
| 301 |
] |
| 302 |
); |
| 303 |
|
| 304 |
$this->add_control( |
| 305 |
'show_wishlist', |
| 306 |
[ |
| 307 |
'label' => esc_html__('Wishlist', 'ultimate-store-kit'), |
| 308 |
'type' => Controls_Manager::SWITCHER, |
| 309 |
'default' => 'yes', |
| 310 |
] |
| 311 |
); |
| 312 |
$this->add_control( |
| 313 |
'show_compare', |
| 314 |
[ |
| 315 |
'label' => esc_html__('Compare', 'ultimate-store-kit'), |
| 316 |
'type' => Controls_Manager::SWITCHER, |
| 317 |
'default' => 'yes', |
| 318 |
] |
| 319 |
); |
| 320 |
$this->add_control( |
| 321 |
'show_quick_view', |
| 322 |
[ |
| 323 |
'label' => esc_html__('Quick View', 'ultimate-store-kit'), |
| 324 |
'type' => Controls_Manager::SWITCHER, |
| 325 |
'default' => 'yes', |
| 326 |
] |
| 327 |
); |
| 328 |
$this->end_controls_tab(); |
| 329 |
$this->end_controls_tabs(); |
| 330 |
$this->end_controls_section(); |
| 331 |
$this->register_global_controls_carousel_navigation(); |
| 332 |
$this->start_controls_section( |
| 333 |
'section_carousel_settings', |
| 334 |
[ |
| 335 |
'label' => __('Carousel Settings', 'ultimate-store-kit'), |
| 336 |
] |
| 337 |
); |
| 338 |
$this->add_control( |
| 339 |
'coverflow_toggle', |
| 340 |
[ |
| 341 |
'label' => __('Coverflow Effect', 'ultimate-store-kit'), |
| 342 |
'type' => Controls_Manager::POPOVER_TOGGLE, |
| 343 |
'return_value' => 'yes', |
| 344 |
] |
| 345 |
); |
| 346 |
|
| 347 |
$this->start_popover(); |
| 348 |
|
| 349 |
$this->add_control( |
| 350 |
'coverflow_rotate', |
| 351 |
[ |
| 352 |
'label' => esc_html__('Rotate', 'ultimate-store-kit'), |
| 353 |
'type' => Controls_Manager::SLIDER, |
| 354 |
'default' => [ |
| 355 |
'size' => 50, |
| 356 |
], |
| 357 |
'range' => [ |
| 358 |
'px' => [ |
| 359 |
'min' => -360, |
| 360 |
'max' => 360, |
| 361 |
'step' => 5, |
| 362 |
], |
| 363 |
], |
| 364 |
'render_type' => 'template', |
| 365 |
] |
| 366 |
); |
| 367 |
|
| 368 |
$this->add_control( |
| 369 |
'coverflow_stretch', |
| 370 |
[ |
| 371 |
'label' => __('Stretch', 'ultimate-store-kit'), |
| 372 |
'type' => Controls_Manager::SLIDER, |
| 373 |
'default' => [ |
| 374 |
'size' => 0, |
| 375 |
], |
| 376 |
'range' => [ |
| 377 |
'px' => [ |
| 378 |
'min' => 0, |
| 379 |
'step' => 10, |
| 380 |
'max' => 100, |
| 381 |
], |
| 382 |
], |
| 383 |
'render_type' => 'template', |
| 384 |
] |
| 385 |
); |
| 386 |
|
| 387 |
$this->add_control( |
| 388 |
'coverflow_modifier', |
| 389 |
[ |
| 390 |
'label' => __('Modifier', 'ultimate-store-kit'), |
| 391 |
'type' => Controls_Manager::SLIDER, |
| 392 |
'default' => [ |
| 393 |
'size' => 1, |
| 394 |
], |
| 395 |
'range' => [ |
| 396 |
'px' => [ |
| 397 |
'min' => 1, |
| 398 |
'step' => 1, |
| 399 |
'max' => 10, |
| 400 |
], |
| 401 |
], |
| 402 |
'render_type' => 'template', |
| 403 |
] |
| 404 |
); |
| 405 |
|
| 406 |
$this->add_control( |
| 407 |
'coverflow_depth', |
| 408 |
[ |
| 409 |
'label' => __('Depth', 'ultimate-store-kit'), |
| 410 |
'type' => Controls_Manager::SLIDER, |
| 411 |
'default' => [ |
| 412 |
'size' => 100, |
| 413 |
], |
| 414 |
'range' => [ |
| 415 |
'px' => [ |
| 416 |
'min' => 0, |
| 417 |
'step' => 10, |
| 418 |
'max' => 1000, |
| 419 |
], |
| 420 |
], |
| 421 |
'render_type' => 'template', |
| 422 |
] |
| 423 |
); |
| 424 |
|
| 425 |
$this->end_popover(); |
| 426 |
|
| 427 |
$this->add_control( |
| 428 |
'hr_005', |
| 429 |
[ |
| 430 |
'type' => Controls_Manager::DIVIDER, |
| 431 |
] |
| 432 |
); |
| 433 |
|
| 434 |
$this->add_control( |
| 435 |
'autoplay', |
| 436 |
[ |
| 437 |
'label' => __('Autoplay', 'ultimate-store-kit'), |
| 438 |
'type' => Controls_Manager::SWITCHER, |
| 439 |
'default' => 'yes', |
| 440 |
|
| 441 |
] |
| 442 |
); |
| 443 |
|
| 444 |
$this->add_control( |
| 445 |
'autoplay_speed', |
| 446 |
[ |
| 447 |
'label' => esc_html__('Autoplay Speed', 'ultimate-store-kit'), |
| 448 |
'type' => Controls_Manager::NUMBER, |
| 449 |
'default' => 5000, |
| 450 |
'condition' => [ |
| 451 |
'autoplay' => 'yes', |
| 452 |
], |
| 453 |
] |
| 454 |
); |
| 455 |
|
| 456 |
$this->add_control( |
| 457 |
'pauseonhover', |
| 458 |
[ |
| 459 |
'label' => esc_html__('Pause on Hover', 'ultimate-store-kit'), |
| 460 |
'type' => Controls_Manager::SWITCHER, |
| 461 |
] |
| 462 |
); |
| 463 |
|
| 464 |
$this->add_responsive_control( |
| 465 |
'slides_to_scroll', |
| 466 |
[ |
| 467 |
'type' => Controls_Manager::SELECT, |
| 468 |
'label' => esc_html__('Slides to Scroll', 'ultimate-store-kit'), |
| 469 |
'default' => 1, |
| 470 |
'tablet_default' => 1, |
| 471 |
'mobile_default' => 1, |
| 472 |
'options' => [ |
| 473 |
1 => '1', |
| 474 |
2 => '2', |
| 475 |
3 => '3', |
| 476 |
4 => '4', |
| 477 |
5 => '5', |
| 478 |
6 => '6', |
| 479 |
], |
| 480 |
] |
| 481 |
); |
| 482 |
|
| 483 |
$this->add_control( |
| 484 |
'centered_slides', |
| 485 |
[ |
| 486 |
'label' => __('Center Slide', 'ultimate-store-kit'), |
| 487 |
'description' => __('Use even items from Layout > Columns settings for better preview.', 'ultimate-store-kit'), |
| 488 |
'type' => Controls_Manager::SWITCHER, |
| 489 |
] |
| 490 |
); |
| 491 |
|
| 492 |
$this->add_control( |
| 493 |
'grab_cursor', |
| 494 |
[ |
| 495 |
'label' => __('Grab Cursor', 'ultimate-store-kit'), |
| 496 |
'type' => Controls_Manager::SWITCHER, |
| 497 |
] |
| 498 |
); |
| 499 |
|
| 500 |
$this->add_control( |
| 501 |
'loop', |
| 502 |
[ |
| 503 |
'label' => __('Loop', 'ultimate-store-kit'), |
| 504 |
'type' => Controls_Manager::SWITCHER, |
| 505 |
'default' => 'yes', |
| 506 |
|
| 507 |
] |
| 508 |
); |
| 509 |
|
| 510 |
$this->add_control( |
| 511 |
'speed', |
| 512 |
[ |
| 513 |
'label' => __('Animation Speed (ms)', 'ultimate-store-kit'), |
| 514 |
'type' => Controls_Manager::SLIDER, |
| 515 |
'default' => [ |
| 516 |
'size' => 800, |
| 517 |
], |
| 518 |
'range' => [ |
| 519 |
'px' => [ |
| 520 |
'min' => 100, |
| 521 |
'max' => 5000, |
| 522 |
'step' => 50, |
| 523 |
], |
| 524 |
], |
| 525 |
] |
| 526 |
); |
| 527 |
|
| 528 |
$this->add_control( |
| 529 |
'observer', |
| 530 |
[ |
| 531 |
'label' => __('Observer', 'ultimate-store-kit'), |
| 532 |
'description' => __('When you use carousel in any hidden place (in tabs, accordion etc) keep it yes.', 'ultimate-store-kit'), |
| 533 |
'type' => Controls_Manager::SWITCHER, |
| 534 |
] |
| 535 |
); |
| 536 |
|
| 537 |
$this->add_responsive_control( |
| 538 |
'item_shadow_padding', |
| 539 |
[ |
| 540 |
'label' => __('Match Padding', 'ultimate-store-kit'), |
| 541 |
'description' => __('You have to add padding for matching overlaping normal/hover box shadow when you used Box Shadow option.', 'ultimate-store-kit'), |
| 542 |
'type' => Controls_Manager::SLIDER, |
| 543 |
'range' => [ |
| 544 |
'px' => [ |
| 545 |
'min' => 0, |
| 546 |
'step' => 1, |
| 547 |
'max' => 50, |
| 548 |
] |
| 549 |
], |
| 550 |
'default' => [ |
| 551 |
'size' => 10 |
| 552 |
], |
| 553 |
'selectors' => [ |
| 554 |
'{{WRAPPER}} .swiper-carousel' => 'padding: {{SIZE}}{{UNIT}}; margin: 0 -{{SIZE}}{{UNIT}};' |
| 555 |
], |
| 556 |
] |
| 557 |
); |
| 558 |
|
| 559 |
$this->end_controls_section(); |
| 560 |
|
| 561 |
$this->start_controls_section( |
| 562 |
'section_style_content', |
| 563 |
[ |
| 564 |
'label' => esc_html__('Item', 'ultimate-store-kit'), |
| 565 |
'tab' => Controls_Manager::TAB_STYLE, |
| 566 |
] |
| 567 |
); |
| 568 |
|
| 569 |
$this->start_controls_tabs('tabs_content_style'); |
| 570 |
|
| 571 |
$this->start_controls_tab( |
| 572 |
'tab_content_normal', |
| 573 |
[ |
| 574 |
'label' => esc_html__('Normal', 'ultimate-store-kit'), |
| 575 |
] |
| 576 |
); |
| 577 |
$this->add_group_control( |
| 578 |
Group_Control_Background::get_type(), |
| 579 |
[ |
| 580 |
'name' => 'content_background', |
| 581 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 582 |
'types' => ['classic', 'gradient'], |
| 583 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item', |
| 584 |
] |
| 585 |
); |
| 586 |
|
| 587 |
$this->add_group_control( |
| 588 |
Group_Control_Border::get_type(), |
| 589 |
[ |
| 590 |
'name' => 'content_border', |
| 591 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item', |
| 592 |
'separator' => 'before', |
| 593 |
] |
| 594 |
); |
| 595 |
|
| 596 |
$this->add_responsive_control( |
| 597 |
'content_radius', |
| 598 |
[ |
| 599 |
'label' => esc_html__('Border Radius', 'ultimate-store-kit'), |
| 600 |
'type' => Controls_Manager::DIMENSIONS, |
| 601 |
'size_units' => ['px'], |
| 602 |
'selectors' => [ |
| 603 |
'{{WRAPPER}} .usk-showcase-slider .usk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;', |
| 604 |
], |
| 605 |
] |
| 606 |
); |
| 607 |
$this->add_responsive_control( |
| 608 |
'content_padding', |
| 609 |
[ |
| 610 |
'label' => esc_html__('Padding', 'ultimate-store-kit'), |
| 611 |
'type' => Controls_Manager::DIMENSIONS, |
| 612 |
'separator' => 'after', |
| 613 |
'size_units' => [ |
| 614 |
'px', 'em', '%', |
| 615 |
], |
| 616 |
'selectors' => [ |
| 617 |
'{{WRAPPER}} .usk-showcase-slider .usk-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 618 |
], |
| 619 |
] |
| 620 |
); |
| 621 |
$this->add_responsive_control( |
| 622 |
'content_box_padding', |
| 623 |
[ |
| 624 |
'label' => esc_html__('Content Padding', 'ultimate-store-kit'), |
| 625 |
'type' => Controls_Manager::DIMENSIONS, |
| 626 |
'size_units' => [ |
| 627 |
'px', 'em', '%', |
| 628 |
], |
| 629 |
'selectors' => [ |
| 630 |
'{{WRAPPER}} .usk-showcase-slider .usk-item-box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 631 |
], |
| 632 |
] |
| 633 |
); |
| 634 |
$this->add_group_control( |
| 635 |
Group_Control_Box_Shadow::get_type(), |
| 636 |
[ |
| 637 |
'name' => 'content_shadow', |
| 638 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item', |
| 639 |
|
| 640 |
] |
| 641 |
); |
| 642 |
$this->end_controls_tab(); |
| 643 |
|
| 644 |
$this->start_controls_tab( |
| 645 |
'tab_content_hover', |
| 646 |
[ |
| 647 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 648 |
] |
| 649 |
); |
| 650 |
$this->add_group_control( |
| 651 |
Group_Control_Background::get_type(), |
| 652 |
[ |
| 653 |
'name' => 'content_hover_background', |
| 654 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 655 |
'types' => ['classic', 'gradient'], |
| 656 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item:hover', |
| 657 |
] |
| 658 |
); |
| 659 |
$this->add_control( |
| 660 |
'content_hover_border_color', |
| 661 |
[ |
| 662 |
'label' => esc_html__('Border Color', 'ultimate-store-kit'), |
| 663 |
'type' => Controls_Manager::COLOR, |
| 664 |
'condition' => [ |
| 665 |
'content_border_border!' => '', |
| 666 |
], |
| 667 |
'selectors' => [ |
| 668 |
'{{WRAPPER}} .usk-showcase-slider .usk-item:hover' => 'border-color: {{VALUE}};', |
| 669 |
], |
| 670 |
] |
| 671 |
); |
| 672 |
$this->add_group_control( |
| 673 |
Group_Control_Box_Shadow::get_type(), |
| 674 |
[ |
| 675 |
'name' => 'content_hover_shadow', |
| 676 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-item:hover', |
| 677 |
] |
| 678 |
); |
| 679 |
$this->end_controls_tab(); |
| 680 |
$this->end_controls_tabs(); |
| 681 |
$this->end_controls_section(); |
| 682 |
|
| 683 |
$this->register_global_controls_title(); |
| 684 |
$this->register_global_controls_category(); |
| 685 |
$this->register_global_controls_price(); |
| 686 |
|
| 687 |
$this->start_controls_section( |
| 688 |
'section_style_button', |
| 689 |
[ |
| 690 |
'label' => esc_html__('Add to Cart', 'ultimate-store-kit'), |
| 691 |
'tab' => Controls_Manager::TAB_STYLE, |
| 692 |
'condition' => [ |
| 693 |
'show_cart' => 'yes', |
| 694 |
], |
| 695 |
] |
| 696 |
); |
| 697 |
|
| 698 |
$this->start_controls_tabs('tabs_button_style'); |
| 699 |
|
| 700 |
$this->start_controls_tab( |
| 701 |
'tab_button_normal', |
| 702 |
[ |
| 703 |
'label' => esc_html__('Normal', 'ultimate-store-kit'), |
| 704 |
] |
| 705 |
); |
| 706 |
|
| 707 |
$this->add_control( |
| 708 |
'button_text_color', |
| 709 |
[ |
| 710 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 711 |
'type' => Controls_Manager::COLOR, |
| 712 |
'default' => '', |
| 713 |
'selectors' => [ |
| 714 |
'{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'color: {{VALUE}};', |
| 715 |
], |
| 716 |
] |
| 717 |
); |
| 718 |
$this->add_group_control( |
| 719 |
Group_Control_Background::get_type(), |
| 720 |
[ |
| 721 |
'name' => 'btn_background_color', |
| 722 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 723 |
'types' => ['classic', 'gradient'], |
| 724 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart', |
| 725 |
] |
| 726 |
); |
| 727 |
$this->add_group_control( |
| 728 |
Group_Control_Border::get_type(), |
| 729 |
[ |
| 730 |
'name' => 'btn_border', |
| 731 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart', |
| 732 |
'separator' => 'before', |
| 733 |
] |
| 734 |
); |
| 735 |
|
| 736 |
$this->add_responsive_control( |
| 737 |
'btn_border_radius', |
| 738 |
[ |
| 739 |
'label' => esc_html__('Border Radius', 'ultimate-store-kit'), |
| 740 |
'type' => Controls_Manager::DIMENSIONS, |
| 741 |
'size_units' => ['px', '%'], |
| 742 |
'selectors' => [ |
| 743 |
'{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 744 |
], |
| 745 |
] |
| 746 |
); |
| 747 |
$this->add_responsive_control( |
| 748 |
'button_spacing', |
| 749 |
[ |
| 750 |
'label' => esc_html__('Right Spacing', 'ultimate-store-kit'), |
| 751 |
'type' => Controls_Manager::SLIDER, |
| 752 |
'size_units' => ['px', 'em'], |
| 753 |
'selectors' => [ |
| 754 |
'{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'right: {{SIZE}}{{UNIT}};', |
| 755 |
], |
| 756 |
] |
| 757 |
); |
| 758 |
$this->add_control( |
| 759 |
'btn_size_toggle', |
| 760 |
[ |
| 761 |
'label' => esc_html__('Size', 'ultimate-store-kit'), |
| 762 |
'type' => Controls_Manager::POPOVER_TOGGLE, |
| 763 |
] |
| 764 |
); |
| 765 |
$this->start_popover(); |
| 766 |
$this->add_responsive_control( |
| 767 |
'btn_height', |
| 768 |
[ |
| 769 |
'label' => esc_html__('Height', 'ultimate-store-kit'), |
| 770 |
'type' => Controls_Manager::SLIDER, |
| 771 |
'size_units' => ['px', 'em'], |
| 772 |
'range' => [ |
| 773 |
'px' => [ |
| 774 |
'min' => 0, |
| 775 |
'max' => 100, |
| 776 |
], |
| 777 |
'em' => [ |
| 778 |
'min' => 0, |
| 779 |
'max' => 10, |
| 780 |
'step' => 0.1, |
| 781 |
], |
| 782 |
], |
| 783 |
'selectors' => [ |
| 784 |
'{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'height: {{SIZE}}{{UNIT}};', |
| 785 |
], |
| 786 |
'condition' => [ |
| 787 |
'btn_size_toggle' => 'yes', |
| 788 |
], |
| 789 |
] |
| 790 |
); |
| 791 |
$this->add_responsive_control( |
| 792 |
'btn_width', |
| 793 |
[ |
| 794 |
'label' => esc_html__('Width', 'ultimate-store-kit'), |
| 795 |
'type' => Controls_Manager::SLIDER, |
| 796 |
'size_units' => ['px', 'em', '%'], |
| 797 |
'range' => [ |
| 798 |
'px' => [ |
| 799 |
'min' => 0, |
| 800 |
'max' => 500, |
| 801 |
], |
| 802 |
'em' => [ |
| 803 |
'min' => 0, |
| 804 |
'max' => 50, |
| 805 |
], |
| 806 |
'%' => [ |
| 807 |
'min' => 0, |
| 808 |
'max' => 100, |
| 809 |
], |
| 810 |
], |
| 811 |
'selectors' => [ |
| 812 |
'{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart' => 'width: {{SIZE}}{{UNIT}};', |
| 813 |
], |
| 814 |
'condition' => [ |
| 815 |
'btn_size_toggle' => 'yes', |
| 816 |
], |
| 817 |
] |
| 818 |
); |
| 819 |
$this->end_popover(); |
| 820 |
|
| 821 |
$this->add_group_control( |
| 822 |
Group_Control_Box_Shadow::get_type(), |
| 823 |
[ |
| 824 |
'name' => 'button_shadow', |
| 825 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart', |
| 826 |
] |
| 827 |
); |
| 828 |
|
| 829 |
$this->add_group_control( |
| 830 |
Group_Control_Typography::get_type(), |
| 831 |
[ |
| 832 |
'name' => 'button_typography', |
| 833 |
'label' => esc_html__('Typography', 'ultimate-store-kit'), |
| 834 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button, {{WRAPPER}} .usk-showcase-slider .added_to_cart', |
| 835 |
] |
| 836 |
); |
| 837 |
$this->end_controls_tab(); |
| 838 |
|
| 839 |
$this->start_controls_tab( |
| 840 |
'tab_button_hover', |
| 841 |
[ |
| 842 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 843 |
] |
| 844 |
); |
| 845 |
$this->add_control( |
| 846 |
'hover_color', |
| 847 |
[ |
| 848 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 849 |
'type' => Controls_Manager::COLOR, |
| 850 |
'selectors' => [ |
| 851 |
'{{WRAPPER}} .usk-showcase-slider .usk-button:hover, {{WRAPPER}} .usk-showcase-slider .added_to_cart:hover' => 'color: {{VALUE}};', |
| 852 |
], |
| 853 |
] |
| 854 |
); |
| 855 |
|
| 856 |
$this->add_group_control( |
| 857 |
Group_Control_Background::get_type(), |
| 858 |
[ |
| 859 |
'name' => 'btn_hover_bg', |
| 860 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 861 |
'types' => ['classic', 'gradient'], |
| 862 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button:hover, {{WRAPPER}} .usk-showcase-slider .added_to_cart:hover', |
| 863 |
] |
| 864 |
); |
| 865 |
|
| 866 |
$this->add_control( |
| 867 |
'button_hover_border_color', |
| 868 |
[ |
| 869 |
'label' => esc_html__('Border Color', 'ultimate-store-kit'), |
| 870 |
'type' => Controls_Manager::COLOR, |
| 871 |
'condition' => [ |
| 872 |
'btn_border_border!' => '', |
| 873 |
], |
| 874 |
'selectors' => [ |
| 875 |
'{{WRAPPER}} .usk-showcase-slider .usk-button:hover, {{WRAPPER}} .usk-showcase-slider .added_to_cart:hover' => 'border-color: {{VALUE}};', |
| 876 |
], |
| 877 |
] |
| 878 |
); |
| 879 |
$this->add_group_control( |
| 880 |
Group_Control_Box_Shadow::get_type(), |
| 881 |
[ |
| 882 |
'name' => 'button_hover_shadow', |
| 883 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-button:hover, {{WRAPPER}} .usk-showcase-slider .added_to_cart:hover', |
| 884 |
] |
| 885 |
); |
| 886 |
|
| 887 |
$this->end_controls_tab(); |
| 888 |
$this->end_controls_tabs(); |
| 889 |
$this->end_controls_section(); |
| 890 |
$this->register_global_controls_badge(); |
| 891 |
$this->register_global_controls_rating(); |
| 892 |
$this->start_controls_section( |
| 893 |
'style_action_btn', |
| 894 |
[ |
| 895 |
'label' => esc_html__('Action Button', 'ultimate-store-kit'), |
| 896 |
'tab' => Controls_Manager::TAB_STYLE, |
| 897 |
] |
| 898 |
); |
| 899 |
$this->add_group_control( |
| 900 |
Group_Control_Border::get_type(), |
| 901 |
[ |
| 902 |
'name' => 'action_btn_border', |
| 903 |
'label' => esc_html__('Border', 'ultimate-store-kit'), |
| 904 |
'selector' => '{{WRAPPER}} .usk-showcase-slider .usk-action-btn', |
| 905 |
] |
| 906 |
); |
| 907 |
$this->add_responsive_control( |
| 908 |
'action_btn_radius', |
| 909 |
[ |
| 910 |
'label' => esc_html__('Border Radius', 'ultimate-store-kit'), |
| 911 |
'type' => Controls_Manager::DIMENSIONS, |
| 912 |
'size_units' => ['px', '%', 'em'], |
| 913 |
'selectors' => [ |
| 914 |
'{{WRAPPER}} .usk-showcase-slider .usk-action-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 915 |
], |
| 916 |
] |
| 917 |
); |
| 918 |
$this->add_responsive_control( |
| 919 |
'action_btn_padding', |
| 920 |
[ |
| 921 |
'label' => esc_html__('Padding', 'ultimate-store-kit'), |
| 922 |
'type' => Controls_Manager::DIMENSIONS, |
| 923 |
'size_units' => ['px', '%', 'em'], |
| 924 |
'selectors' => [ |
| 925 |
'{{WRAPPER}} .usk-showcase-slider .usk-action-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 926 |
], |
| 927 |
] |
| 928 |
); |
| 929 |
|
| 930 |
$this->add_responsive_control( |
| 931 |
'action_btn_gap', |
| 932 |
[ |
| 933 |
'label' => esc_html__('Gap', 'ultimate-store-kit'), |
| 934 |
'type' => Controls_Manager::SLIDER, |
| 935 |
'size_units' => ['px', 'em'], |
| 936 |
'selectors' => [ |
| 937 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping' => 'gap: {{SIZE}}{{UNIT}};', |
| 938 |
], |
| 939 |
] |
| 940 |
); |
| 941 |
|
| 942 |
$this->add_responsive_control( |
| 943 |
'action_btn_icon_size', |
| 944 |
[ |
| 945 |
'label' => esc_html__('Icon Size', 'ultimate-store-kit'), |
| 946 |
'type' => Controls_Manager::SLIDER, |
| 947 |
'size_units' => ['px', 'em'], |
| 948 |
'selectors' => [ |
| 949 |
'{{WRAPPER}} .usk-showcase-slider .usk-action-btn' => 'font-size: {{SIZE}}{{UNIT}};', |
| 950 |
], |
| 951 |
] |
| 952 |
); |
| 953 |
|
| 954 |
$this->add_control( |
| 955 |
'font_family', |
| 956 |
[ |
| 957 |
'label' => esc_html__('Tooltip Font', 'font family'), |
| 958 |
'type' => Controls_Manager::FONT, |
| 959 |
'selectors' => [ |
| 960 |
'{{WRAPPER}} .usk-shoping a' => 'font-family: {{VALUE}}', |
| 961 |
], |
| 962 |
] |
| 963 |
); |
| 964 |
|
| 965 |
$this->start_controls_tabs( |
| 966 |
'action_btn_tabs' |
| 967 |
); |
| 968 |
$this->start_controls_tab( |
| 969 |
'wishlist_tab', |
| 970 |
[ |
| 971 |
'label' => esc_html__('Wishlist', 'ultimate-store-kit'), |
| 972 |
'condition' => [ |
| 973 |
'show_wishlist' => 'yes', |
| 974 |
], |
| 975 |
] |
| 976 |
); |
| 977 |
$this->add_control( |
| 978 |
'wishlist_normal_color', |
| 979 |
[ |
| 980 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 981 |
'type' => Controls_Manager::COLOR, |
| 982 |
'selectors' => [ |
| 983 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist' => 'color: {{VALUE}}', |
| 984 |
], |
| 985 |
] |
| 986 |
); |
| 987 |
$this->add_control( |
| 988 |
'wishlist_icon_bg', |
| 989 |
[ |
| 990 |
'label' => esc_html__('Background Color', 'ultimate-store-kit'), |
| 991 |
'type' => Controls_Manager::COLOR, |
| 992 |
'selectors' => [ |
| 993 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist' => 'background: {{VALUE}}', |
| 994 |
], |
| 995 |
] |
| 996 |
); |
| 997 |
$this->add_control( |
| 998 |
'heading_wishlist_hover', |
| 999 |
[ |
| 1000 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 1001 |
'type' => Controls_Manager::HEADING, |
| 1002 |
'separator' => 'before', |
| 1003 |
] |
| 1004 |
); |
| 1005 |
$this->add_control( |
| 1006 |
'wishlist_hover_color', |
| 1007 |
[ |
| 1008 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 1009 |
'type' => Controls_Manager::COLOR, |
| 1010 |
'selectors' => [ |
| 1011 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist:hover' => 'color: {{VALUE}}', |
| 1012 |
], |
| 1013 |
] |
| 1014 |
); |
| 1015 |
$this->add_control( |
| 1016 |
'wishlist_icon_hover_bg', |
| 1017 |
[ |
| 1018 |
'label' => esc_html__('Background Color', 'ultimate-store-kit'), |
| 1019 |
'type' => Controls_Manager::COLOR, |
| 1020 |
'selectors' => [ |
| 1021 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist:hover' => 'background: {{VALUE}}', |
| 1022 |
], |
| 1023 |
] |
| 1024 |
); |
| 1025 |
$this->add_control( |
| 1026 |
'heading_wishlist_active', |
| 1027 |
[ |
| 1028 |
'label' => esc_html__('Active', 'ultimate-store-kit'), |
| 1029 |
'type' => Controls_Manager::HEADING, |
| 1030 |
'separator' => 'before', |
| 1031 |
] |
| 1032 |
); |
| 1033 |
$this->add_control( |
| 1034 |
'wishlist_active_color', |
| 1035 |
[ |
| 1036 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 1037 |
'type' => Controls_Manager::COLOR, |
| 1038 |
'selectors' => [ |
| 1039 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist.usk-active' => 'color: {{VALUE}}', |
| 1040 |
], |
| 1041 |
] |
| 1042 |
); |
| 1043 |
$this->add_control( |
| 1044 |
'wishlist_active_bg', |
| 1045 |
[ |
| 1046 |
'label' => esc_html__('Background Color', 'ultimate-store-kit'), |
| 1047 |
'type' => Controls_Manager::COLOR, |
| 1048 |
'selectors' => [ |
| 1049 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-wishlist.usk-active' => 'background: {{VALUE}}', |
| 1050 |
], |
| 1051 |
] |
| 1052 |
); |
| 1053 |
$this->end_controls_tab(); |
| 1054 |
// Compare |
| 1055 |
$this->start_controls_tab( |
| 1056 |
'compare_tab', |
| 1057 |
[ |
| 1058 |
'label' => esc_html__('Compare', 'ultimate-store-kit'), |
| 1059 |
'condition' => [ |
| 1060 |
'show_compare' => 'yes', |
| 1061 |
], |
| 1062 |
] |
| 1063 |
); |
| 1064 |
$this->add_control( |
| 1065 |
'compare_normal_color', |
| 1066 |
[ |
| 1067 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 1068 |
'type' => Controls_Manager::COLOR, |
| 1069 |
'selectors' => [ |
| 1070 |
'{{WRAPPER}} .usk-showcase-slider .usk-compare' => 'color: {{VALUE}}', |
| 1071 |
], |
| 1072 |
] |
| 1073 |
); |
| 1074 |
$this->add_control( |
| 1075 |
'compare_icon_bg', |
| 1076 |
[ |
| 1077 |
'label' => esc_html__('Background Color', 'ultimate-store-kit'), |
| 1078 |
'type' => Controls_Manager::COLOR, |
| 1079 |
'selectors' => [ |
| 1080 |
'{{WRAPPER}} .usk-showcase-slider .usk-compare' => 'background: {{VALUE}}', |
| 1081 |
], |
| 1082 |
] |
| 1083 |
); |
| 1084 |
|
| 1085 |
$this->add_control( |
| 1086 |
'heading_compare_hover', |
| 1087 |
[ |
| 1088 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 1089 |
'type' => Controls_Manager::HEADING, |
| 1090 |
'separator' => 'before', |
| 1091 |
] |
| 1092 |
); |
| 1093 |
$this->add_control( |
| 1094 |
'compare_hover_color', |
| 1095 |
[ |
| 1096 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 1097 |
'type' => Controls_Manager::COLOR, |
| 1098 |
'selectors' => [ |
| 1099 |
'{{WRAPPER}} .usk-showcase-slider .usk-compare:hover' => 'color: {{VALUE}}', |
| 1100 |
], |
| 1101 |
] |
| 1102 |
); |
| 1103 |
$this->add_control( |
| 1104 |
'compare_icon_hover_bg', |
| 1105 |
[ |
| 1106 |
'label' => esc_html__('Background Color', 'ultimate-store-kit'), |
| 1107 |
'type' => Controls_Manager::COLOR, |
| 1108 |
'selectors' => [ |
| 1109 |
'{{WRAPPER}} .usk-showcase-slider .usk-compare:hover' => 'background: {{VALUE}}', |
| 1110 |
], |
| 1111 |
] |
| 1112 |
); |
| 1113 |
$this->add_control( |
| 1114 |
'heading_compare_active', |
| 1115 |
[ |
| 1116 |
'label' => esc_html__('Active', 'ultimate-store-kit'), |
| 1117 |
'type' => Controls_Manager::HEADING, |
| 1118 |
'separator' => 'before', |
| 1119 |
] |
| 1120 |
); |
| 1121 |
$this->add_control( |
| 1122 |
'compare_active_color', |
| 1123 |
[ |
| 1124 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 1125 |
'type' => Controls_Manager::COLOR, |
| 1126 |
'selectors' => [ |
| 1127 |
'{{WRAPPER}} .usk-showcase-slider .usk-compare.usk-active' => 'color: {{VALUE}}', |
| 1128 |
], |
| 1129 |
] |
| 1130 |
); |
| 1131 |
$this->add_control( |
| 1132 |
'compare_icon_active_bg', |
| 1133 |
[ |
| 1134 |
'label' => esc_html__('Background Color', 'ultimate-store-kit'), |
| 1135 |
'type' => Controls_Manager::COLOR, |
| 1136 |
'selectors' => [ |
| 1137 |
'{{WRAPPER}} .usk-showcase-slider .usk-compare.usk-active' => 'background: {{VALUE}}', |
| 1138 |
], |
| 1139 |
] |
| 1140 |
); |
| 1141 |
$this->end_controls_tab(); |
| 1142 |
$this->start_controls_tab( |
| 1143 |
'quickview_tab', |
| 1144 |
[ |
| 1145 |
'label' => esc_html__('Quickview', 'ultimate-store-kit'), |
| 1146 |
'condition' => [ |
| 1147 |
'show_quick_view' => 'yes', |
| 1148 |
], |
| 1149 |
] |
| 1150 |
); |
| 1151 |
$this->add_control( |
| 1152 |
'quickview_color', |
| 1153 |
[ |
| 1154 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 1155 |
'type' => Controls_Manager::COLOR, |
| 1156 |
'selectors' => [ |
| 1157 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-quickview' => 'color: {{VALUE}}', |
| 1158 |
], |
| 1159 |
] |
| 1160 |
); |
| 1161 |
$this->add_control( |
| 1162 |
'quickview_icon_bg', |
| 1163 |
[ |
| 1164 |
'label' => esc_html__('Background Color', 'ultimate-store-kit'), |
| 1165 |
'type' => Controls_Manager::COLOR, |
| 1166 |
'selectors' => [ |
| 1167 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-quickview' => 'background: {{VALUE}}', |
| 1168 |
], |
| 1169 |
] |
| 1170 |
); |
| 1171 |
$this->add_control( |
| 1172 |
'heading_quickview_hover', |
| 1173 |
[ |
| 1174 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 1175 |
'type' => Controls_Manager::HEADING, |
| 1176 |
'separator' => 'before', |
| 1177 |
] |
| 1178 |
); |
| 1179 |
$this->add_control( |
| 1180 |
'quickview_color_hover', |
| 1181 |
[ |
| 1182 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 1183 |
'type' => Controls_Manager::COLOR, |
| 1184 |
'selectors' => [ |
| 1185 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-quickview:hover' => 'color: {{VALUE}}', |
| 1186 |
], |
| 1187 |
] |
| 1188 |
); |
| 1189 |
$this->add_control( |
| 1190 |
'quickview_icon_bg_hover', |
| 1191 |
[ |
| 1192 |
'label' => esc_html__('Background Color', 'ultimate-store-kit'), |
| 1193 |
'type' => Controls_Manager::COLOR, |
| 1194 |
'selectors' => [ |
| 1195 |
'{{WRAPPER}} .usk-showcase-slider .usk-shoping-icon-quickview:hover' => 'background: {{VALUE}}', |
| 1196 |
], |
| 1197 |
] |
| 1198 |
); |
| 1199 |
$this->end_controls_tab(); |
| 1200 |
$this->end_controls_tabs(); |
| 1201 |
$this->end_controls_section(); |
| 1202 |
$this->register_global_controls_navigation_style(); |
| 1203 |
} |
| 1204 |
|
| 1205 |
public function render_image() { |
| 1206 |
$tooltip_position = 'top'; |
| 1207 |
global $product; |
| 1208 |
$settings = $this->get_settings_for_display(); |
| 1209 |
$product_image = wp_get_attachment_image_url(get_post_thumbnail_id(), $settings['image_size']); |
| 1210 |
?> |
| 1211 |
<div class="usk-image-wrap"> |
| 1212 |
<img class="usk-image" src="<?php echo esc_url($product_image); ?>" alt="<?php echo esc_html(get_the_title()); ?>"> |
| 1213 |
<div class="usk-shoping"> |
| 1214 |
<?php |
| 1215 |
$this->register_global_template_add_to_wishlist($tooltip_position); |
| 1216 |
$this->register_global_template_add_to_compare($tooltip_position); |
| 1217 |
$this->register_global_template_quick_view($product->get_id(), $tooltip_position); |
| 1218 |
// $this->register_global_template_add_to_cart($tooltip_position); |
| 1219 |
?> |
| 1220 |
</div> |
| 1221 |
</div> |
| 1222 |
<?php |
| 1223 |
} |
| 1224 |
public function render_add_to_cart() { |
| 1225 |
global $product; |
| 1226 |
$settings = $this->get_settings_for_display(); |
| 1227 |
if ('yes' == $settings['show_cart']): ?> |
| 1228 |
<?php if ($product) { |
| 1229 |
$defaults = [ |
| 1230 |
'quantity' => 1, |
| 1231 |
'class' => implode( |
| 1232 |
' ', |
| 1233 |
array_filter( |
| 1234 |
[ |
| 1235 |
'usk-button', |
| 1236 |
'product_type_' . $product->get_type(), |
| 1237 |
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', |
| 1238 |
$product->supports('ajax_add_to_cart') && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '', |
| 1239 |
] |
| 1240 |
) |
| 1241 |
), |
| 1242 |
'attributes' => [ |
| 1243 |
'data-product_id' => $product->get_id(), |
| 1244 |
'data-product_sku' => $product->get_sku(), |
| 1245 |
'aria-label' => $product->add_to_cart_description(), |
| 1246 |
'rel' => 'nofollow', |
| 1247 |
], |
| 1248 |
]; |
| 1249 |
$args = apply_filters('woocommerce_loop_add_to_cart_args', wp_parse_args($defaults), $product); |
| 1250 |
if (isset($args['attributes']['aria-label'])) { |
| 1251 |
$args['attributes']['aria-label'] = wp_strip_all_tags($args['attributes']['aria-label']); |
| 1252 |
} |
| 1253 |
echo wp_kses_post(apply_filters( |
| 1254 |
'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok. |
| 1255 |
sprintf( |
| 1256 |
'<a href="%s" data-quantity="%s" class="%s" %s>%s <i class="button-icon usk-icon-arrow-right-8"></i></a>', |
| 1257 |
esc_url($product->add_to_cart_url()), |
| 1258 |
esc_attr(isset($args['quantity']) ? $args['quantity'] : 1), |
| 1259 |
esc_attr(isset($args['class']) ? $args['class'] : 'button'), |
| 1260 |
isset($args['attributes']) ? wc_implode_html_attributes($args['attributes']) : '', |
| 1261 |
esc_html($product->add_to_cart_text()) |
| 1262 |
), |
| 1263 |
$product, |
| 1264 |
$args |
| 1265 |
)); |
| 1266 |
};?> |
| 1267 |
<?php endif; |
| 1268 |
} |
| 1269 |
public function render_slider_header() { |
| 1270 |
$settings = $this->get_settings_for_display(); |
| 1271 |
$this->add_render_attribute('slider', 'class', ['usk-showcase-slider']); |
| 1272 |
$id = 'ultimate-store-kit-' . $this->get_id(); |
| 1273 |
$elementor_vp_lg = get_option('elementor_viewport_lg'); |
| 1274 |
$elementor_vp_md = get_option('elementor_viewport_md'); |
| 1275 |
$viewport_lg = !empty($elementor_vp_lg) ? $elementor_vp_lg - 1 : 1023; |
| 1276 |
$viewport_md = !empty($elementor_vp_md) ? $elementor_vp_md - 1 : 767; |
| 1277 |
$this->add_render_attribute('slider', 'id', $id); |
| 1278 |
$this->add_render_attribute('slider', 'class', ['usk-carousel', 'usk-carousel-layout', 'elementor-swiper']); |
| 1279 |
if ('arrows' == $settings['navigation']) { |
| 1280 |
$this->add_render_attribute('slider', 'class', 'usk-arrows-align-' . $settings['arrows_position']); |
| 1281 |
} elseif ('dots' == $settings['navigation']) { |
| 1282 |
$this->add_render_attribute('slider', 'class', 'usk-dots-align-' . $settings['dots_position']); |
| 1283 |
} elseif ('both' == $settings['navigation']) { |
| 1284 |
$this->add_render_attribute('slider', 'class', 'usk-arrows-dots-align-' . $settings['both_position']); |
| 1285 |
} elseif ('arrows-fraction' == $settings['navigation']) { |
| 1286 |
$this->add_render_attribute('slider', 'class', 'usk-arrows-dots-align-' . $settings['arrows_fraction_position']); |
| 1287 |
} |
| 1288 |
|
| 1289 |
if ('arrows-fraction' == $settings['navigation']) { |
| 1290 |
$pagination_type = 'fraction'; |
| 1291 |
} elseif ('both' == $settings['navigation'] or 'dots' == $settings['navigation']) { |
| 1292 |
$pagination_type = 'bullets'; |
| 1293 |
} elseif ('progressbar' == $settings['navigation']) { |
| 1294 |
$pagination_type = 'progressbar'; |
| 1295 |
} else { |
| 1296 |
$pagination_type = ''; |
| 1297 |
} |
| 1298 |
|
| 1299 |
$this->add_render_attribute( |
| 1300 |
[ |
| 1301 |
'slider' => [ |
| 1302 |
'data-settings' => [ |
| 1303 |
wp_json_encode(array_filter([ |
| 1304 |
"autoplay" => ("yes" == $settings["autoplay"]) ? ["delay" => $settings["autoplay_speed"]] : false, |
| 1305 |
"loop" => ($settings["loop"] == "yes") ? true : false, |
| 1306 |
"speed" => $settings["speed"]["size"], |
| 1307 |
"pauseOnHover" => ("yes" == $settings["pauseonhover"]) ? true : false, |
| 1308 |
"slidesPerView" => 1, |
| 1309 |
"slidesPerGroup" => isset($settings["slides_to_scroll_mobile"]) ? (int) $settings["slides_to_scroll_mobile"] : 1, |
| 1310 |
"spaceBetween" => !empty($settings["items_gap_mobile"]["size"]) ? (int) $settings["items_gap_mobile"]["size"] : 20, |
| 1311 |
"centeredSlides" => true, |
| 1312 |
"grabCursor" => ($settings["grab_cursor"] === "yes") ? true : false, |
| 1313 |
"effect" => 'coverflow', |
| 1314 |
"observer" => ($settings["observer"]) ? true : false, |
| 1315 |
"observeParents" => ($settings["observer"]) ? true : false, |
| 1316 |
"breakpoints" => [ |
| 1317 |
(int) $viewport_md => [ |
| 1318 |
"slidesPerView" => 1.7, |
| 1319 |
"spaceBetween" => !empty($settings["items_gap_tablet"]["size"]) ? (int) $settings["items_gap_tablet"]["size"] : 20, |
| 1320 |
"slidesPerGroup" => isset($settings["slides_to_scroll_tablet"]) ? (int) $settings["slides_to_scroll_tablet"] : 1, |
| 1321 |
], |
| 1322 |
(int) $viewport_lg => [ |
| 1323 |
"slidesPerView" => 2, |
| 1324 |
"spaceBetween" => !empty($settings["items_gap"]["size"]) ? (int) $settings["items_gap"]["size"] : 20, |
| 1325 |
"slidesPerGroup" => isset($settings["slides_to_scroll"]) ? (int) $settings["slides_to_scroll"] : 1, |
| 1326 |
], |
| 1327 |
], |
| 1328 |
"navigation" => [ |
| 1329 |
"nextEl" => "#" . $id . " .usk-navigation-next", |
| 1330 |
"prevEl" => "#" . $id . " .usk-navigation-prev", |
| 1331 |
], |
| 1332 |
"pagination" => [ |
| 1333 |
"el" => "#" . $id . " .swiper-pagination", |
| 1334 |
"type" => $pagination_type, |
| 1335 |
"clickable" => "true", |
| 1336 |
'dynamicBullets' => ("yes" == $settings["dynamic_bullets"]) ? true : false, |
| 1337 |
], |
| 1338 |
"scrollbar" => [ |
| 1339 |
"el" => "#" . $id . " .swiper-scrollbar", |
| 1340 |
"hide" => "true", |
| 1341 |
], |
| 1342 |
'coverflowEffect' => [ |
| 1343 |
'rotate' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_rotate"]["size"] : 0, |
| 1344 |
'stretch' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_stretch"]["size"] : 0, |
| 1345 |
'depth' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_depth"]["size"] : 100, |
| 1346 |
'modifier' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_modifier"]["size"] : 1, |
| 1347 |
'slideShadows' => false, |
| 1348 |
], |
| 1349 |
|
| 1350 |
])), |
| 1351 |
], |
| 1352 |
], |
| 1353 |
] |
| 1354 |
); |
| 1355 |
|
| 1356 |
$swiper_class = Plugin::$instance->experiments->is_feature_active('e_swiper_latest') ? 'swiper' : 'swiper-container'; |
| 1357 |
$this->add_render_attribute('swiper', 'class', 'usk-showcase-slider-wrapper swiper-carousel ' . $swiper_class); |
| 1358 |
?> |
| 1359 |
<div class="ultimate-store-kit"> |
| 1360 |
<div <?php $this->print_render_attribute_string('slider');?>> |
| 1361 |
<div <?php $this->print_render_attribute_string('swiper');?>> |
| 1362 |
<div class="swiper-wrapper"> |
| 1363 |
<?php |
| 1364 |
} |
| 1365 |
public function render_slider_footer() { |
| 1366 |
$settings = $this->get_settings_for_display(); |
| 1367 |
?> |
| 1368 |
</div> |
| 1369 |
<?php if ('yes' === $settings['show_scrollbar']): ?> |
| 1370 |
<div class="swiper-scrollbar"></div> |
| 1371 |
<?php endif;?> |
| 1372 |
</div> |
| 1373 |
|
| 1374 |
<?php if ('both' == $settings['navigation']): ?> |
| 1375 |
<?php $this->register_global_template_both_navigation();?> |
| 1376 |
<?php if ('center' === $settings['both_position']): ?> |
| 1377 |
<div class="usk-position-z-index usk-position-bottom"> |
| 1378 |
<div class="usk-dots-container"> |
| 1379 |
<div class="swiper-pagination"></div> |
| 1380 |
</div> |
| 1381 |
</div> |
| 1382 |
<?php endif;?> |
| 1383 |
<?php elseif ('arrows-fraction' == $settings['navigation']): ?> |
| 1384 |
<?php $this->register_global_template_arrows_fraction()?> |
| 1385 |
<?php if ('center' === $settings['arrows_fraction_position']): ?> |
| 1386 |
<div class="usk-dots-container"> |
| 1387 |
<div class="swiper-pagination"></div> |
| 1388 |
</div> |
| 1389 |
<?php endif;?> |
| 1390 |
<?php else: ?> |
| 1391 |
<?php $this->register_global_template_pagination();?> |
| 1392 |
<?php $this->register_global_template_navigation();?> |
| 1393 |
|
| 1394 |
<?php endif;?> |
| 1395 |
</div> |
| 1396 |
<?php |
| 1397 |
} |
| 1398 |
public function print_price_output($output) { |
| 1399 |
$tags = [ |
| 1400 |
'del' => ['aria-hidden' => []], |
| 1401 |
'span' => ['class' => []], |
| 1402 |
'bdi' => [], |
| 1403 |
'ins' => [], |
| 1404 |
]; |
| 1405 |
|
| 1406 |
if (isset($output)) { |
| 1407 |
echo wp_kses($output, $tags); |
| 1408 |
} |
| 1409 |
} |
| 1410 |
|
| 1411 |
public function render_loop_item() { |
| 1412 |
$settings = $this->get_settings_for_display(); |
| 1413 |
$id = 'usk-wc-product-' . $this->get_id(); |
| 1414 |
$modal_id = wp_unique_id('modal-id-'); |
| 1415 |
|
| 1416 |
// $wp_query = $this->render_query(); |
| 1417 |
$this->query_product(); |
| 1418 |
$wp_query = $this->get_query(); |
| 1419 |
if ($wp_query->have_posts()) {?> |
| 1420 |
<?php while ($wp_query->have_posts()): $wp_query->the_post(); |
| 1421 |
global $product; |
| 1422 |
$rating_count = $product->get_rating_count(); |
| 1423 |
$average = $product->get_average_rating(); |
| 1424 |
$have_rating = ('yes' === $settings['show_rating']) ? 'usk-have-rating' : ''; |
| 1425 |
|
| 1426 |
?> |
| 1427 |
<div class="swiper-slide usk-item <?php esc_attr_e($have_rating, 'ultimate-store-kit');?>"> |
| 1428 |
<?php $this->render_image();?> |
| 1429 |
<div class="usk-badge-label-wrapper"> |
| 1430 |
<div class="usk-badge-label-content usk-flex usk-flex-column"> |
| 1431 |
<?php $this->register_global_template_badge_label();?> |
| 1432 |
</div> |
| 1433 |
</div> |
| 1434 |
<div class="usk-item-box"> |
| 1435 |
<div class="usk-content"> |
| 1436 |
<?php if ('yes' == $settings['show_category']): ?> |
| 1437 |
<?php printf('<div class="usk-category">%1$s</div>', wp_kses_post(wc_get_product_category_list($product->get_id(), ' ')));?> |
| 1438 |
<?php endif;?> |
| 1439 |
<?php if ('yes' == $settings['show_title']): |
| 1440 |
printf('<a href="%2$s" class="usk-title"><%1$s class="title">%3$s</%1$s></a>', esc_attr($settings['title_tags']), esc_url($product->get_permalink()), esc_html($product->get_title())); |
| 1441 |
endif;?> |
| 1442 |
</div> |
| 1443 |
<?php $this->render_add_to_cart();?> |
| 1444 |
<div class="usk-price-button-wrap"> |
| 1445 |
<?php if (('yes' == $settings['show_price'])): ?> |
| 1446 |
<div class="usk-price"> |
| 1447 |
<?php $this->print_price_output($product->get_price_html()); ?> |
| 1448 |
</div> |
| 1449 |
<?php endif;?> |
| 1450 |
<?php if (('yes' == $settings['show_rating'])): ?> |
| 1451 |
<div class="usk-rating"> |
| 1452 |
<?php echo wp_kses_post($this->register_global_template_wc_rating($average, $rating_count)); ?> |
| 1453 |
</div> |
| 1454 |
<?php endif;?> |
| 1455 |
</div> |
| 1456 |
</div> |
| 1457 |
</div> |
| 1458 |
<?php endwhile; |
| 1459 |
wp_reset_postdata();} else { |
| 1460 |
echo '<div class="usk-alert-warning" usk-alert>' . esc_html__('Ops! There no product to display.', 'ultimate-store-kit') . '</div>'; |
| 1461 |
} |
| 1462 |
} |
| 1463 |
|
| 1464 |
public function render() { |
| 1465 |
$this->render_slider_header(); |
| 1466 |
$this->render_loop_item(); |
| 1467 |
$this->render_slider_footer(); |
| 1468 |
} |
| 1469 |
public function query_product() { |
| 1470 |
$default = $this->getGroupControlQueryArgs(); |
| 1471 |
$this->_query = new WP_Query($default); |
| 1472 |
} |
| 1473 |
} |
| 1474 |
|