| 1 |
<?php |
| 2 |
|
| 3 |
namespace UltimateStoreKit\Modules\UpSells\Widgets; |
| 4 |
|
| 5 |
use UltimateStoreKit\Base\Module_Base; |
| 6 |
use Elementor\Controls_Manager; |
| 7 |
use Elementor\Group_Control_Typography; |
| 8 |
use Elementor\Group_Control_Box_Shadow; |
| 9 |
use Elementor\Group_Control_Background; |
| 10 |
use Elementor\Group_Control_Border; |
| 11 |
|
| 12 |
if (!defined('ABSPATH')) exit; // Exit if accessed directly |
| 13 |
|
| 14 |
class Up_Sells extends Module_Base |
| 15 |
{ |
| 16 |
|
| 17 |
public function get_name() |
| 18 |
{ |
| 19 |
return 'usk-up-sells'; |
| 20 |
} |
| 21 |
|
| 22 |
public function get_title() |
| 23 |
{ |
| 24 |
return BDTUSK . esc_html__('Up Sells', 'ultimate-store-kit'); |
| 25 |
} |
| 26 |
|
| 27 |
public function get_icon() |
| 28 |
{ |
| 29 |
return 'usk-widget-icon usk-icon-up-sells'; |
| 30 |
} |
| 31 |
|
| 32 |
public function get_categories() |
| 33 |
{ |
| 34 |
return ['ultimate-store-kit']; |
| 35 |
} |
| 36 |
|
| 37 |
public function get_keywords() |
| 38 |
{ |
| 39 |
return ['woocommerce', 'shop', 'store', 'upsell', 'product']; |
| 40 |
} |
| 41 |
|
| 42 |
public function get_style_depends() |
| 43 |
{ |
| 44 |
if ($this->usk_is_edit_mode()) { |
| 45 |
return ['usk-all-styles']; |
| 46 |
} else { |
| 47 |
return ['usk-up-sells']; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
// public function get_custom_help_url() { |
| 52 |
// return 'https://youtu.be/ksy2uZ5Hg3M'; |
| 53 |
// } |
| 54 |
|
| 55 |
protected function register_controls() |
| 56 |
{ |
| 57 |
|
| 58 |
$this->register_controls_upsell_content(); |
| 59 |
$this->register_style_controls_heading(); |
| 60 |
$this->register_controls_items(); |
| 61 |
$this->register_controls_title(); |
| 62 |
$this->register_controls_price(); |
| 63 |
$this->register_controls_action_btn(); |
| 64 |
} |
| 65 |
protected function register_controls_upsell_content() |
| 66 |
{ |
| 67 |
|
| 68 |
$this->start_controls_section( |
| 69 |
'section_upsell_content', |
| 70 |
[ |
| 71 |
'label' => __('Upsells', 'ultimate-store-kit'), |
| 72 |
] |
| 73 |
); |
| 74 |
|
| 75 |
$this->add_responsive_control( |
| 76 |
'columns', |
| 77 |
[ |
| 78 |
'label' => __('Columns', 'ultimate-store-kit'), |
| 79 |
'type' => Controls_Manager::NUMBER, |
| 80 |
'prefix_class' => 'usk-products-columns%s-', |
| 81 |
'default' => 4, |
| 82 |
'min' => 1, |
| 83 |
'max' => 12, |
| 84 |
] |
| 85 |
); |
| 86 |
|
| 87 |
$this->add_control( |
| 88 |
'orderby', |
| 89 |
[ |
| 90 |
'label' => __('Order By', 'ultimate-store-kit'), |
| 91 |
'type' => Controls_Manager::SELECT, |
| 92 |
'default' => 'date', |
| 93 |
'options' => [ |
| 94 |
'date' => __('Date', 'ultimate-store-kit'), |
| 95 |
'title' => __('Title', 'ultimate-store-kit'), |
| 96 |
'price' => __('Price', 'ultimate-store-kit'), |
| 97 |
'popularity' => __('Popularity', 'ultimate-store-kit'), |
| 98 |
'rating' => __('Rating', 'ultimate-store-kit'), |
| 99 |
'rand' => __('Random', 'ultimate-store-kit'), |
| 100 |
'menu_order' => __('Menu Order', 'ultimate-store-kit'), |
| 101 |
], |
| 102 |
] |
| 103 |
); |
| 104 |
|
| 105 |
$this->add_control( |
| 106 |
'order', |
| 107 |
[ |
| 108 |
'label' => __('Order', 'ultimate-store-kit'), |
| 109 |
'type' => Controls_Manager::SELECT, |
| 110 |
'default' => 'desc', |
| 111 |
'options' => [ |
| 112 |
'asc' => __('ASC', 'ultimate-store-kit'), |
| 113 |
'desc' => __('DESC', 'ultimate-store-kit'), |
| 114 |
], |
| 115 |
] |
| 116 |
); |
| 117 |
|
| 118 |
$this->end_controls_section(); |
| 119 |
} |
| 120 |
|
| 121 |
protected function register_style_controls_heading() |
| 122 |
{ |
| 123 |
$this->start_controls_section( |
| 124 |
'section_heading_style', |
| 125 |
[ |
| 126 |
'label' => __('Heading', 'ultimate-store-kit'), |
| 127 |
'tab' => Controls_Manager::TAB_STYLE, |
| 128 |
] |
| 129 |
); |
| 130 |
|
| 131 |
$this->add_control( |
| 132 |
'show_heading', |
| 133 |
[ |
| 134 |
'label' => __('Heading', 'ultimate-store-kit'), |
| 135 |
'type' => Controls_Manager::SWITCHER, |
| 136 |
'label_off' => __('Hide', 'ultimate-store-kit'), |
| 137 |
'label_on' => __('Show', 'ultimate-store-kit'), |
| 138 |
'default' => 'yes', |
| 139 |
'return_value' => 'yes', |
| 140 |
'prefix_class' => 'usk-up-sells-show-heading-', |
| 141 |
] |
| 142 |
); |
| 143 |
|
| 144 |
$this->add_control( |
| 145 |
'heading_color', |
| 146 |
[ |
| 147 |
'label' => __('Color', 'ultimate-store-kit'), |
| 148 |
'type' => Controls_Manager::COLOR, |
| 149 |
'selectors' => [ |
| 150 |
'{{WRAPPER}} .usk-up-sells .products > h2' => 'color: {{VALUE}}', |
| 151 |
], |
| 152 |
'condition' => [ |
| 153 |
'show_heading!' => '', |
| 154 |
], |
| 155 |
] |
| 156 |
); |
| 157 |
|
| 158 |
$this->add_group_control( |
| 159 |
Group_Control_Typography::get_type(), |
| 160 |
[ |
| 161 |
'name' => 'heading_typography', |
| 162 |
'selector' => '{{WRAPPER}} .usk-up-sells .products > h2', |
| 163 |
'condition' => [ |
| 164 |
'show_heading!' => '', |
| 165 |
], |
| 166 |
] |
| 167 |
); |
| 168 |
|
| 169 |
$this->add_responsive_control( |
| 170 |
'heading_text_align', |
| 171 |
[ |
| 172 |
'label' => __('Text Align', 'ultimate-store-kit'), |
| 173 |
'type' => Controls_Manager::CHOOSE, |
| 174 |
'options' => [ |
| 175 |
'left' => [ |
| 176 |
'title' => __('Left', 'ultimate-store-kit'), |
| 177 |
'icon' => 'eicon-text-align-left', |
| 178 |
], |
| 179 |
'center' => [ |
| 180 |
'title' => __('Center', 'ultimate-store-kit'), |
| 181 |
'icon' => 'eicon-text-align-center', |
| 182 |
], |
| 183 |
'right' => [ |
| 184 |
'title' => __('Right', 'ultimate-store-kit'), |
| 185 |
'icon' => 'eicon-text-align-right', |
| 186 |
], |
| 187 |
], |
| 188 |
'selectors' => [ |
| 189 |
'{{WRAPPER}} .usk-up-sells .products > h2' => 'text-align: {{VALUE}}', |
| 190 |
], |
| 191 |
'condition' => [ |
| 192 |
'show_heading!' => '', |
| 193 |
], |
| 194 |
] |
| 195 |
); |
| 196 |
|
| 197 |
$this->add_responsive_control( |
| 198 |
'heading_spacing', |
| 199 |
[ |
| 200 |
'label' => __('Spacing', 'ultimate-store-kit'), |
| 201 |
'type' => Controls_Manager::SLIDER, |
| 202 |
'size_units' => ['px', 'em'], |
| 203 |
'selectors' => [ |
| 204 |
'{{WRAPPER}} .usk-up-sells .products > h2' => 'margin-bottom: {{SIZE}}{{UNIT}}', |
| 205 |
], |
| 206 |
'condition' => [ |
| 207 |
'show_heading!' => '', |
| 208 |
], |
| 209 |
] |
| 210 |
); |
| 211 |
|
| 212 |
$this->end_controls_section(); |
| 213 |
} |
| 214 |
protected function register_controls_grid_image() |
| 215 |
{ |
| 216 |
$this->start_controls_section( |
| 217 |
'section_style_image', |
| 218 |
[ |
| 219 |
'label' => esc_html__('Image', 'ultimate-store-kit'), |
| 220 |
'tab' => Controls_Manager::TAB_STYLE, |
| 221 |
] |
| 222 |
); |
| 223 |
$this->start_controls_tabs( |
| 224 |
'style_tabs_image' |
| 225 |
); |
| 226 |
$this->start_controls_tab( |
| 227 |
'image_normal', |
| 228 |
[ |
| 229 |
'label' => esc_html__('Normal', 'ultimate-store-kit'), |
| 230 |
] |
| 231 |
); |
| 232 |
$this->add_group_control( |
| 233 |
Group_Control_Background::get_type(), |
| 234 |
[ |
| 235 |
'name' => 'image_background', |
| 236 |
'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image', |
| 237 |
] |
| 238 |
); |
| 239 |
$this->add_group_control( |
| 240 |
Group_Control_Border::get_type(), |
| 241 |
[ |
| 242 |
'name' => 'image_border', |
| 243 |
'label' => esc_html__('Image Border', 'ultimate-store-kit'), |
| 244 |
'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image', |
| 245 |
'separator' => 'before', |
| 246 |
] |
| 247 |
); |
| 248 |
|
| 249 |
$this->add_responsive_control( |
| 250 |
'image_border_radius', |
| 251 |
[ |
| 252 |
'label' => esc_html__('Border Radius', 'ultimate-store-kit'), |
| 253 |
'type' => Controls_Manager::DIMENSIONS, |
| 254 |
'size_units' => ['px', '%'], |
| 255 |
'selectors' => [ |
| 256 |
'{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 257 |
], |
| 258 |
] |
| 259 |
); |
| 260 |
|
| 261 |
$this->add_responsive_control( |
| 262 |
'image_padding', |
| 263 |
[ |
| 264 |
'label' => esc_html__('Padding', 'ultimate-store-kit'), |
| 265 |
'type' => Controls_Manager::DIMENSIONS, |
| 266 |
'size_units' => ['px', '%'], |
| 267 |
'selectors' => [ |
| 268 |
'{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 269 |
], |
| 270 |
] |
| 271 |
); |
| 272 |
|
| 273 |
$this->add_group_control( |
| 274 |
Group_Control_Box_Shadow::get_type(), |
| 275 |
[ |
| 276 |
'name' => 'image_shadow', |
| 277 |
'exclude' => [ |
| 278 |
'shadow_position', |
| 279 |
], |
| 280 |
'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image', |
| 281 |
] |
| 282 |
); |
| 283 |
$this->end_controls_tab(); |
| 284 |
$this->start_controls_tab( |
| 285 |
'image_hover', |
| 286 |
[ |
| 287 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 288 |
] |
| 289 |
); |
| 290 |
$this->add_group_control( |
| 291 |
Group_Control_Background::get_type(), |
| 292 |
[ |
| 293 |
'name' => 'image_hover_background', |
| 294 |
'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item:hover .usk-item-box .usk-image', |
| 295 |
] |
| 296 |
); |
| 297 |
$this->add_group_control( |
| 298 |
Group_Control_Border::get_type(), |
| 299 |
[ |
| 300 |
'name' => 'image_hover_border', |
| 301 |
'label' => esc_html__('Image Border', 'ultimate-store-kit'), |
| 302 |
'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item:hover .usk-item-box .usk-image', |
| 303 |
'separator' => 'before', |
| 304 |
] |
| 305 |
); |
| 306 |
|
| 307 |
$this->add_responsive_control( |
| 308 |
'image_hover_border_radius', |
| 309 |
[ |
| 310 |
'label' => esc_html__('Border Radius', 'ultimate-store-kit'), |
| 311 |
'type' => Controls_Manager::DIMENSIONS, |
| 312 |
'size_units' => ['px', '%'], |
| 313 |
'selectors' => [ |
| 314 |
'{{WRAPPER}} .' . $this->get_name() . ' .usk-item:hover .usk-item-box .usk-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 315 |
], |
| 316 |
] |
| 317 |
); |
| 318 |
|
| 319 |
$this->add_group_control( |
| 320 |
Group_Control_Box_Shadow::get_type(), |
| 321 |
[ |
| 322 |
'name' => 'image_hover_shadow', |
| 323 |
'exclude' => [ |
| 324 |
'shadow_position', |
| 325 |
], |
| 326 |
'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item:hover .usk-item-box .usk-image', |
| 327 |
] |
| 328 |
); |
| 329 |
$this->end_controls_tab(); |
| 330 |
$this->end_controls_tabs(); |
| 331 |
|
| 332 |
$this->end_controls_section(); |
| 333 |
} |
| 334 |
protected function register_controls_content() |
| 335 |
{ |
| 336 |
$this->start_controls_section( |
| 337 |
'section_style_content', |
| 338 |
[ |
| 339 |
'label' => esc_html__('Content', 'ultimate-store-kit'), |
| 340 |
'tab' => Controls_Manager::TAB_STYLE, |
| 341 |
] |
| 342 |
); |
| 343 |
|
| 344 |
$this->start_controls_tabs('tabs_content_style'); |
| 345 |
|
| 346 |
$this->start_controls_tab( |
| 347 |
'tab_content_normal', |
| 348 |
[ |
| 349 |
'label' => esc_html__('Normal', 'ultimate-store-kit'), |
| 350 |
] |
| 351 |
); |
| 352 |
$this->add_group_control( |
| 353 |
Group_Control_Background::get_type(), |
| 354 |
[ |
| 355 |
'name' => 'content_background', |
| 356 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 357 |
'types' => ['classic', 'gradient'], |
| 358 |
'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-content', |
| 359 |
] |
| 360 |
); |
| 361 |
|
| 362 |
$this->add_group_control( |
| 363 |
Group_Control_Border::get_type(), |
| 364 |
[ |
| 365 |
'name' => 'content_border', |
| 366 |
'label' => esc_html__('Border Color', 'ultimate-store-kit'), |
| 367 |
'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-content', |
| 368 |
'separator' => 'before', |
| 369 |
] |
| 370 |
); |
| 371 |
|
| 372 |
$this->add_responsive_control( |
| 373 |
'content_radius', |
| 374 |
[ |
| 375 |
'label' => esc_html__('Border Radius', 'ultimate-store-kit'), |
| 376 |
'type' => Controls_Manager::DIMENSIONS, |
| 377 |
'size_units' => ['px', '%'], |
| 378 |
'selectors' => [ |
| 379 |
'{{WRAPPER}} .' . $this->get_name() . ' .usk-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;', |
| 380 |
], |
| 381 |
] |
| 382 |
); |
| 383 |
|
| 384 |
$this->add_responsive_control( |
| 385 |
'content_padding', |
| 386 |
[ |
| 387 |
'label' => esc_html__('Padding', 'ultimate-store-kit'), |
| 388 |
'type' => Controls_Manager::DIMENSIONS, |
| 389 |
'size_units' => ['px', 'em', '%'], |
| 390 |
'selectors' => [ |
| 391 |
'{{WRAPPER}} .' . $this->get_name() . ' .usk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 392 |
], |
| 393 |
] |
| 394 |
); |
| 395 |
$this->end_controls_tab(); |
| 396 |
|
| 397 |
$this->start_controls_tab( |
| 398 |
'tab_content_hover', |
| 399 |
[ |
| 400 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 401 |
] |
| 402 |
); |
| 403 |
$this->add_group_control( |
| 404 |
Group_Control_Background::get_type(), |
| 405 |
[ |
| 406 |
'name' => 'content_hover_background', |
| 407 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 408 |
'types' => ['classic', 'gradient'], |
| 409 |
'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-content:hover', |
| 410 |
] |
| 411 |
); |
| 412 |
$this->add_control( |
| 413 |
'content_hover_border_color', |
| 414 |
[ |
| 415 |
'label' => esc_html__('Border Color', 'ultimate-store-kit'), |
| 416 |
'type' => Controls_Manager::COLOR, |
| 417 |
'condition' => [ |
| 418 |
'item_border_border!' => '', |
| 419 |
], |
| 420 |
'selectors' => [ |
| 421 |
'{{WRAPPER}} .' . $this->get_name() . ' .usk-content:hover' => 'border-color: {{VALUE}};', |
| 422 |
], |
| 423 |
] |
| 424 |
); |
| 425 |
$this->end_controls_tab(); |
| 426 |
|
| 427 |
$this->end_controls_tabs(); |
| 428 |
|
| 429 |
$this->end_controls_section(); |
| 430 |
} |
| 431 |
protected function register_controls_title() |
| 432 |
{ |
| 433 |
$this->start_controls_section( |
| 434 |
'section_style_title', |
| 435 |
[ |
| 436 |
'label' => esc_html__('Title', 'ultimate-store-kit'), |
| 437 |
'tab' => Controls_Manager::TAB_STYLE, |
| 438 |
] |
| 439 |
); |
| 440 |
|
| 441 |
$this->add_control( |
| 442 |
'title_color', |
| 443 |
[ |
| 444 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 445 |
'type' => Controls_Manager::COLOR, |
| 446 |
'selectors' => [ |
| 447 |
'{{WRAPPER}} .woocommerce ul.products li.product .woocommerce-loop-category__title, .woocommerce ul.products li.product .woocommerce-loop-product__title, .woocommerce ul.products li.product h3' => 'color: {{VALUE}}', |
| 448 |
], |
| 449 |
] |
| 450 |
); |
| 451 |
|
| 452 |
$this->add_control( |
| 453 |
'hover_title_color', |
| 454 |
[ |
| 455 |
'label' => esc_html__('Hover Color', 'ultimate-store-kit'), |
| 456 |
'type' => Controls_Manager::COLOR, |
| 457 |
'selectors' => [ |
| 458 |
'{{WRAPPER}} .woocommerce ul.products li.product .woocommerce-loop-category__title, .woocommerce ul.products li.product .woocommerce-loop-product__title, .woocommerce ul.products li.product h3:hover' => 'color: {{VALUE}};', |
| 459 |
], |
| 460 |
] |
| 461 |
); |
| 462 |
|
| 463 |
$this->add_responsive_control( |
| 464 |
'title_margin', |
| 465 |
[ |
| 466 |
'label' => esc_html__('Margin', 'ultimate-store-kit'), |
| 467 |
'type' => Controls_Manager::DIMENSIONS, |
| 468 |
'size_units' => ['px', '%'], |
| 469 |
'selectors' => [ |
| 470 |
'{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-content .usk-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 471 |
], |
| 472 |
] |
| 473 |
); |
| 474 |
|
| 475 |
$this->add_group_control( |
| 476 |
Group_Control_Typography::get_type(), |
| 477 |
[ |
| 478 |
'name' => 'title_typography', |
| 479 |
'label' => esc_html__('Typography', 'ultimate-store-kit'), |
| 480 |
'selector' => '{{WRAPPER}} .woocommerce ul.products li.product .woocommerce-loop-category__title, .woocommerce ul.products li.product .woocommerce-loop-product__title, .woocommerce ul.products li.product h3', |
| 481 |
] |
| 482 |
); |
| 483 |
|
| 484 |
$this->end_controls_section(); |
| 485 |
} |
| 486 |
protected function register_controls_price() |
| 487 |
{ |
| 488 |
$this->start_controls_section( |
| 489 |
'section_style_price', |
| 490 |
[ |
| 491 |
'label' => esc_html__('Price', 'ultimate-store-kit'), |
| 492 |
'tab' => Controls_Manager::TAB_STYLE, |
| 493 |
] |
| 494 |
); |
| 495 |
|
| 496 |
$this->add_control( |
| 497 |
'sale_price_color', |
| 498 |
[ |
| 499 |
'label' => esc_html__('Sale Color', 'ultimate-store-kit'), |
| 500 |
'type' => Controls_Manager::COLOR, |
| 501 |
'selectors' => [ |
| 502 |
'{{WRAPPER}} .usk-up-sells ul.products li.product .price' => 'color: {{VALUE}}', |
| 503 |
'{{WRAPPER}} .usk-up-sells ul.products li.product .price ins span' => 'color: {{VALUE}}', |
| 504 |
'{{WRAPPER}} .usk-up-sells ul.products li.product .price .woocommerce-Price-amount.amount' => 'color: {{VALUE}}', |
| 505 |
'{{WRAPPER}} .usk-up-sells ul.products li.product .price > .woocommerce-Price-amount.amount bdi' => 'color: {{VALUE}}', |
| 506 |
], |
| 507 |
] |
| 508 |
); |
| 509 |
|
| 510 |
$this->add_control( |
| 511 |
'regular_price_color', |
| 512 |
[ |
| 513 |
'label' => esc_html__('Regular Color', 'ultimate-store-kit'), |
| 514 |
'type' => Controls_Manager::COLOR, |
| 515 |
'selectors' => [ |
| 516 |
'{{WRAPPER}} .usk-up-sells .woocommerce ul.products li.product .price.amount' => 'color: {{VALUE}};', |
| 517 |
'{{WRAPPER}} .usk-up-sells .woocommerce ul.products li.product .price del' => 'color: {{VALUE}};', |
| 518 |
], |
| 519 |
|
| 520 |
] |
| 521 |
); |
| 522 |
|
| 523 |
$this->add_responsive_control( |
| 524 |
'price_margin', |
| 525 |
[ |
| 526 |
'label' => esc_html__('Margin', 'ultimate-store-kit'), |
| 527 |
'type' => Controls_Manager::DIMENSIONS, |
| 528 |
'size_units' => ['px', '%'], |
| 529 |
'selectors' => [ |
| 530 |
'{{WRAPPER}} .usk-up-sells ul.products li.product .price' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 531 |
], |
| 532 |
] |
| 533 |
); |
| 534 |
|
| 535 |
$this->add_group_control( |
| 536 |
Group_Control_Typography::get_type(), |
| 537 |
[ |
| 538 |
'name' => 'sale_price_typography', |
| 539 |
'label' => esc_html__('Typography', 'ultimate-store-kit'), |
| 540 |
'selector' => ' |
| 541 |
{{WRAPPER}} .usk-up-sells ul.products li.product .price', |
| 542 |
] |
| 543 |
); |
| 544 |
|
| 545 |
$this->end_controls_section(); |
| 546 |
} |
| 547 |
protected function register_controls_action_btn() |
| 548 |
{ |
| 549 |
$this->start_controls_section( |
| 550 |
'style_action_btn', |
| 551 |
[ |
| 552 |
'label' => esc_html__('Action Button', 'ultimate-store-kit'), |
| 553 |
'tab' => Controls_Manager::TAB_STYLE, |
| 554 |
] |
| 555 |
); |
| 556 |
|
| 557 |
$this->add_control( |
| 558 |
'cart_color', |
| 559 |
[ |
| 560 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 561 |
'type' => Controls_Manager::COLOR, |
| 562 |
'selectors' => [ |
| 563 |
'{{WRAPPER}} .usk-up-sells ul.products .button' => 'color: {{VALUE}}', |
| 564 |
], |
| 565 |
] |
| 566 |
); |
| 567 |
$this->add_control( |
| 568 |
'cart_icon_bg', |
| 569 |
[ |
| 570 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 571 |
'type' => Controls_Manager::COLOR, |
| 572 |
'selectors' => [ |
| 573 |
'{{WRAPPER}} .usk-up-sells ul.products .button' => 'background: {{VALUE}}', |
| 574 |
], |
| 575 |
] |
| 576 |
); |
| 577 |
$this->add_control( |
| 578 |
'heading_cart_hover', |
| 579 |
[ |
| 580 |
'label' => esc_html__('Hover', 'ultimate-store-kit'), |
| 581 |
'type' => Controls_Manager::HEADING, |
| 582 |
'separator' => 'before', |
| 583 |
] |
| 584 |
); |
| 585 |
$this->add_control( |
| 586 |
'cart_color_hover', |
| 587 |
[ |
| 588 |
'label' => esc_html__('Color', 'ultimate-store-kit'), |
| 589 |
'type' => Controls_Manager::COLOR, |
| 590 |
'selectors' => [ |
| 591 |
'{{WRAPPER}} .usk-up-sells ul.products .button:hover' => 'color: {{VALUE}}', |
| 592 |
], |
| 593 |
] |
| 594 |
); |
| 595 |
$this->add_control( |
| 596 |
'cart_icon_bg_hover', |
| 597 |
[ |
| 598 |
'label' => esc_html__('Background', 'ultimate-store-kit'), |
| 599 |
'type' => Controls_Manager::COLOR, |
| 600 |
'selectors' => [ |
| 601 |
'{{WRAPPER}} .usk-up-sells ul.products .button:hover' => 'background: {{VALUE}}', |
| 602 |
], |
| 603 |
] |
| 604 |
); |
| 605 |
$this->add_group_control( |
| 606 |
Group_Control_Border::get_type(), |
| 607 |
[ |
| 608 |
'name' => 'cart_btn_border', |
| 609 |
'label' => esc_html__('Border', 'ultimate-store-kit'), |
| 610 |
'selector' => '{{WRAPPER}} .usk-up-sells ul.products .button', |
| 611 |
'separator' => 'before' |
| 612 |
] |
| 613 |
); |
| 614 |
$this->add_responsive_control( |
| 615 |
'cart_btn_radius', |
| 616 |
[ |
| 617 |
'label' => esc_html__('Radius', 'ultimate-store-kit'), |
| 618 |
'type' => Controls_Manager::DIMENSIONS, |
| 619 |
'size_units' => ['px', '%', 'em'], |
| 620 |
'selectors' => [ |
| 621 |
'{{WRAPPER}} .usk-up-sells ul.products .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 622 |
], |
| 623 |
] |
| 624 |
); |
| 625 |
$this->add_responsive_control( |
| 626 |
'cart_btn_padding', |
| 627 |
[ |
| 628 |
'label' => esc_html__('Padding', 'ultimate-store-kit'), |
| 629 |
'type' => Controls_Manager::DIMENSIONS, |
| 630 |
'size_units' => ['px', '%', 'em'], |
| 631 |
'selectors' => [ |
| 632 |
'{{WRAPPER}} .usk-up-sells ul.products .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 633 |
], |
| 634 |
] |
| 635 |
); |
| 636 |
$this->add_responsive_control( |
| 637 |
'cart_btn_margin', |
| 638 |
[ |
| 639 |
'label' => esc_html__('Margin', 'ultimate-store-kit'), |
| 640 |
'type' => Controls_Manager::DIMENSIONS, |
| 641 |
'size_units' => ['px', '%', 'em'], |
| 642 |
'selectors' => [ |
| 643 |
'{{WRAPPER}} .usk-up-sells ul.products .button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 644 |
], |
| 645 |
] |
| 646 |
); |
| 647 |
$this->add_group_control( |
| 648 |
Group_Control_Typography::get_type(), |
| 649 |
[ |
| 650 |
'name' => 'cart_button_typography', |
| 651 |
'label' => __('Typography', 'ultimate-store-kit'), |
| 652 |
'selector' => '{{WRAPPER}} .usk-up-sells ul.products .button', |
| 653 |
] |
| 654 |
); |
| 655 |
|
| 656 |
$this->end_controls_section(); |
| 657 |
} |
| 658 |
protected function register_controls_items() |
| 659 |
{ |
| 660 |
$this->start_controls_section( |
| 661 |
'section_style_item', |
| 662 |
[ |
| 663 |
'label' => esc_html__('Item', 'ultimate-store-kit'), |
| 664 |
'tab' => Controls_Manager::TAB_STYLE, |
| 665 |
] |
| 666 |
); |
| 667 |
|
| 668 |
$this->start_controls_tabs('tabs_item_style'); |
| 669 |
|
| 670 |
$this->start_controls_tab( |
| 671 |
'tab_item_normal', |
| 672 |
[ |
| 673 |
'label' => esc_html__('Normal', 'ultimate-store-kit'), |
| 674 |
] |
| 675 |
); |
| 676 |
|
| 677 |
$this->add_group_control( |
| 678 |
Group_Control_Background::get_type(), |
| 679 |
[ |
| 680 |
'name' => 'item_background', |
| 681 |
'label' => __('Background', 'ultimate-store-kit'), |
| 682 |
'types' => ['classic', 'gradient'], |
| 683 |
'selector' => '{{WRAPPER}} .usk-up-sells ul.products li.product', |
| 684 |
] |
| 685 |
); |
| 686 |
|
| 687 |
$this->add_group_control( |
| 688 |
Group_Control_Border::get_type(), |
| 689 |
[ |
| 690 |
'name' => 'item_border', |
| 691 |
'label' => esc_html__('Border Color', 'ultimate-store-kit'), |
| 692 |
'selector' => '{{WRAPPER}} .usk-up-sells ul.products li.product', |
| 693 |
'separator' => 'before', |
| 694 |
] |
| 695 |
); |
| 696 |
|
| 697 |
$this->add_responsive_control( |
| 698 |
'item_radius', |
| 699 |
[ |
| 700 |
'label' => esc_html__('Border Radius', 'ultimate-store-kit'), |
| 701 |
'type' => Controls_Manager::DIMENSIONS, |
| 702 |
'size_units' => ['px', '%'], |
| 703 |
'selectors' => [ |
| 704 |
'{{WRAPPER}} .usk-up-sells ul.products li.product' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;', |
| 705 |
], |
| 706 |
] |
| 707 |
); |
| 708 |
|
| 709 |
$this->add_group_control( |
| 710 |
Group_Control_Box_Shadow::get_type(), |
| 711 |
[ |
| 712 |
'name' => 'item_shadow', |
| 713 |
'selector' => '{{WRAPPER}} .usk-up-sells ul.products li.product', |
| 714 |
] |
| 715 |
); |
| 716 |
|
| 717 |
$this->add_responsive_control( |
| 718 |
'item_padding', |
| 719 |
[ |
| 720 |
'label' => esc_html__('Item Padding', 'ultimate-store-kit'), |
| 721 |
'type' => Controls_Manager::DIMENSIONS, |
| 722 |
'size_units' => ['px', 'em', '%'], |
| 723 |
'selectors' => [ |
| 724 |
'{{WRAPPER}} .usk-up-sells ul.products li.product' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 725 |
], |
| 726 |
] |
| 727 |
); |
| 728 |
|
| 729 |
$this->add_responsive_control( |
| 730 |
'content_padding', |
| 731 |
[ |
| 732 |
'label' => esc_html__('Content Padding', 'ultimate-store-kit'), |
| 733 |
'type' => Controls_Manager::DIMENSIONS, |
| 734 |
'size_units' => ['px', 'em', '%'], |
| 735 |
'selectors' => [ |
| 736 |
'{{WRAPPER}} .usk-up-sells ul.products li.product .usk-edd-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 737 |
], |
| 738 |
] |
| 739 |
); |
| 740 |
|
| 741 |
$this->add_control( |
| 742 |
'item_alignment', |
| 743 |
[ |
| 744 |
'label' => __('Alignment', 'ultimate-store-kit'), |
| 745 |
'type' => Controls_Manager::CHOOSE, |
| 746 |
'options' => [ |
| 747 |
'left' => [ |
| 748 |
'title' => __('Left', 'ultimate-store-kit'), |
| 749 |
'icon' => 'eicon-h-align-left', |
| 750 |
], |
| 751 |
'center' => [ |
| 752 |
'title' => __('Center', 'ultimate-store-kit'), |
| 753 |
'icon' => 'eicon-h-align-center', |
| 754 |
], |
| 755 |
'right' => [ |
| 756 |
'title' => __('Right', 'ultimate-store-kit'), |
| 757 |
'icon' => 'eicon-h-align-right', |
| 758 |
], |
| 759 |
], |
| 760 |
'default' => 'center', |
| 761 |
'toggle' => false, |
| 762 |
'selectors' => [ |
| 763 |
'{{WRAPPER}} .usk-up-sells ul.products li.product' => 'text-align: {{VALUE}};', |
| 764 |
], |
| 765 |
] |
| 766 |
); |
| 767 |
|
| 768 |
|
| 769 |
$this->end_controls_section(); |
| 770 |
} |
| 771 |
protected function render() |
| 772 |
{ |
| 773 |
|
| 774 |
$this->usk_set_single_post_preview_data(); |
| 775 |
$settings = $this->get_settings_for_display(); |
| 776 |
$limit = '-1'; |
| 777 |
$columns = isset($settings['columns']) ? $settings['columns'] : 4; |
| 778 |
$orderby = isset($settings['orderby']) ? $settings['orderby'] : 'date'; |
| 779 |
$order = isset($settings['order']) ? $settings['order'] : 'desc'; |
| 780 |
?> |
| 781 |
<div class="usk-up-sells"> |
| 782 |
<?php woocommerce_upsell_display($limit, $columns, $orderby, $order); ?> |
| 783 |
</div> |
| 784 |
<?php |
| 785 |
} |
| 786 |
} |
| 787 |
|