PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.15.2
Shortcodes and extra features for Phlox theme v2.15.2
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elementor / widgets / theme-elements / shopping-cart.php
auxin-elements / includes / elementor / widgets / theme-elements Last commit date
breadcrumbs.php 4 years ago copyright.php 4 years ago current-time.php 4 years ago logo.php 4 years ago menu.php 4 years ago modern-search.php 2 years ago search.php 4 years ago select.php 4 years ago shopping-cart.php 4 years ago site-title.php 3 years ago
shopping-cart.php
612 lines
1 <?php
2 namespace Auxin\Plugin\CoreElements\Elementor\Elements\Theme_Elements;
3
4 use Elementor\Plugin;
5 use Elementor\Widget_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Image_Size;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Core\Schemes\Typography;
10 use Elementor\Group_Control_Border;
11 use Elementor\Group_Control_Background;
12 use Elementor\Group_Control_Box_Shadow;
13
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit; // Exit if accessed directly.
17 }
18
19 /**
20 * Elementor 'Shopping_Cart' widget.
21 *
22 * Elementor widget that displays an 'Shopping_Cart' with lightbox.
23 *
24 * @since 1.0.0
25 */
26 class Shopping_Cart extends Widget_Base {
27
28 /**
29 * Get widget name.
30 *
31 * Retrieve 'Shopping_Cart' widget name.
32 *
33 * @since 1.0.0
34 * @access public
35 *
36 * @return string Widget name.
37 */
38 public function get_name() {
39 return 'aux_shopping_cart';
40 }
41
42 /**
43 * Get widget title.
44 *
45 * Retrieve 'Shopping_Cart' widget title.
46 *
47 * @since 1.0.0
48 * @access public
49 *
50 * @return string Widget title.
51 */
52 public function get_title() {
53 return __('Shopping Cart', 'auxin-elements' );
54 }
55
56 /**
57 * Get widget icon.
58 *
59 * Retrieve 'Shopping_Cart' widget icon.
60 *
61 * @since 1.0.0
62 * @access public
63 *
64 * @return string Widget icon.
65 */
66 public function get_icon() {
67 return 'eicon-cart-light auxin-badge';
68 }
69
70 /**
71 * Get widget categories.
72 *
73 * Retrieve 'Shopping_Cart' widget icon.
74 *
75 * @since 1.0.0
76 * @access public
77 *
78 * @return string Widget icon.
79 */
80 public function get_categories() {
81 return array( 'auxin-core', 'auxin-theme-elements' );
82 }
83
84 /**
85 * Register 'Shopping_Cart' widget controls.
86 *
87 * Adds different input fields to allow the user to change and customize the widget settings.
88 *
89 * @since 1.0.0
90 * @access protected
91 */
92 protected function register_controls() {
93
94 /*-----------------------------------------------------------------------------------*/
95 /* button_section
96 /*-----------------------------------------------------------------------------------*/
97
98 $this->start_controls_section(
99 'button_section',
100 array(
101 'label' => __('Settings', 'auxin-elements' ),
102 )
103 );
104
105 $this->add_control(
106 'aux_shopping_cart_icon',
107 array(
108 'label' => __( 'Icon', 'auxin-elements' ),
109 'type' => Controls_Manager::ICONS
110 )
111 );
112
113 $this->add_control(
114 'cart_style',
115 array(
116 'label' => __( 'Cart Type', 'auxin-elements' ),
117 'type' => Controls_Manager::SELECT,
118 'options' => array(
119 'dropdown' => __( 'DropDown', 'auxin-elements' ),
120 'offcanvas' => __( 'Off Canvas', 'auxin-elements' )
121 ),
122 'default' => 'dropdown'
123 )
124 );
125
126 $this->add_control(
127 'cart_content_skin',
128 array(
129 'label' => __('Cart Skin', 'auxin-elements'),
130 'type' => Controls_Manager::SELECT,
131 'default' => 'light',
132 'options' => array(
133 'light' => __('Light', 'auxin-elements' ),
134 'dark' => __('Dark' , 'auxin-elements' )
135 )
136 )
137 );
138
139 $this->add_control(
140 'action',
141 array(
142 'label' => __('Display Basket', 'auxin-elements'),
143 'type' => Controls_Manager::SELECT,
144 'default' => 'hover',
145 'options' => array(
146 'hover' => __('On Hover', 'auxin-elements' ),
147 'click' => __('On Click' , 'auxin-elements' )
148 )
149 )
150 );
151
152 $this->add_control(
153 'basket_animation',
154 array(
155 'label' => __( 'Basket Animation', 'auxin-elements' ),
156 'type' => Controls_Manager::SWITCHER,
157 'label_on' => __( 'Yes', 'auxin-elements' ),
158 'label_off' => __( 'No', 'auxin-elements' ),
159 'return_value' => 'yes',
160 'default' => 'yes'
161 )
162 );
163
164 $this->add_control(
165 'simple_cart_mode',
166 array(
167 'label' => __( 'Simple Cart', 'auxin-elements' ),
168 'type' => Controls_Manager::SWITCHER,
169 'label_on' => __( 'Yes', 'auxin-elements' ),
170 'label_off' => __( 'No', 'auxin-elements' ),
171 'return_value' => 'yes',
172 'default' => 'yes'
173 )
174 );
175
176 $this->add_control(
177 'cart_header_text',
178 [
179 'label' => __( 'Text for cart', 'auxin-elements' ),
180 'type' => \Elementor\Controls_Manager::TEXT,
181 'default' => __( 'Shopping Basket', 'auxin-elements' ),
182 'condition' => array(
183 'simple_cart_mode' => ''
184 )
185 ]
186 );
187
188 $this->add_responsive_control(
189 'align',
190 array(
191 'label' => __( 'Alignment', 'elementor' ),
192 'type' => Controls_Manager::CHOOSE,
193 'options' => array(
194 'start' => array(
195 'title' => __( 'Left', 'elementor' ),
196 'icon' => 'eicon-text-align-left',
197 ),
198 'center' => array(
199 'title' => __( 'Center', 'elementor' ),
200 'icon' => 'eicon-text-align-center',
201 ),
202 'end' => array(
203 'title' => __( 'Right', 'elementor' ),
204 'icon' => 'eicon-text-align-right',
205 ),
206 ),
207 'default' => '',
208 'selectors' => [
209 '{{WRAPPER}} .aux-cart-element-container' => 'display: flex; justify-content: {{VALUE}};',
210 ]
211 )
212 );
213
214 $this->add_control(
215 'total_price_text_in_dropdown',
216 [
217 'label' => __( 'Total Price Text', 'auxin-elements' ),
218 'type' => \Elementor\Controls_Manager::TEXT,
219 'default' => __( 'Sub Total', 'auxin-elements' )
220 ]
221 );
222
223 $this->add_control(
224 'checkout_text',
225 [
226 'label' => __( 'Checkout Text', 'auxin-elements' ),
227 'type' => \Elementor\Controls_Manager::TEXT,
228 'placeholder' => __( 'Checkout', 'auxin-elements' )
229 ]
230 );
231
232
233 $this->end_controls_section();
234
235 /* title_style_section
236 /*-------------------------------------*/
237
238 $this->start_controls_section(
239 'bubble_section',
240 array(
241 'label' => __( 'Counter Bubble', 'auxin-elements' ),
242 'tab' => Controls_Manager::TAB_STYLE
243 )
244 );
245
246 $this->add_control(
247 'bubble_bg_color',
248 array(
249 'label' => __( 'Background', 'auxin-elements' ),
250 'type' => Controls_Manager::COLOR,
251 'selectors' => array(
252 '{{WRAPPER}} .aux-cart-contents > span' => 'background-color: {{VALUE}};',
253 )
254 )
255 );
256
257 $this->add_group_control(
258 Group_Control_Typography::get_type(),
259 array(
260 'name' => 'bubble_typography',
261 'scheme' => Typography::TYPOGRAPHY_1,
262 'selector' => '{{WRAPPER}} .aux-cart-contents > span'
263 )
264 );
265
266 $this->add_control(
267 'bubble_text_color',
268 array(
269 'label' => __( 'Text Color', 'auxin-elements' ),
270 'type' => Controls_Manager::COLOR,
271 'selectors' => array(
272 '{{WRAPPER}} .aux-cart-contents > span' => 'color: {{VALUE}};',
273 )
274 )
275 );
276
277 $this->add_group_control(
278 Group_Control_Box_Shadow::get_type(),
279 array(
280 'label' => __( 'Box Shadow', 'auxin-elements' ),
281 'name' => 'bubble_box_shadow',
282 'selector' => '{{WRAPPER}} .aux-cart-contents > span'
283 )
284 );
285
286 $this->add_responsive_control(
287 'bubble_position_bottom',
288 array(
289 'label' => __('Position from Bottom','auxin-elements' ),
290 'type' => Controls_Manager::SLIDER,
291 'size_units' => array('px', 'em', '%'),
292 'range' => array(
293 'px' => array(
294 'min' => -100,
295 'max' => 100,
296 'step' => 1
297 ),
298 'em' => array(
299 'min' => -15,
300 'max' => 15,
301 'step' => 1
302 )
303 ),
304 'selectors' => array(
305 '{{WRAPPER}} .aux-cart-contents > span' => 'bottom:{{SIZE}}{{UNIT}};'
306 )
307 )
308 );
309 $this->add_responsive_control(
310 'bubble_position_right',
311 array(
312 'label' => __('Position from right','auxin-elements' ),
313 'type' => Controls_Manager::SLIDER,
314 'size_units' => array('px', 'em', '%'),
315 'range' => array(
316 'px' => array(
317 'min' => -100,
318 'max' => 100,
319 'step' => 1
320 ),
321 'em' => array(
322 'min' => -15,
323 'max' => 15,
324 'step' => 1
325 )
326 ),
327 'selectors' => array(
328 '{{WRAPPER}} .aux-cart-contents > span' => 'right:{{SIZE}}{{UNIT}};'
329 )
330 )
331 );
332
333 $this->add_responsive_control(
334 'bubble_padding',
335 array(
336 'label' => __( 'Padding', 'auxin-elements' ),
337 'type' => Controls_Manager::DIMENSIONS,
338 'size_units' => array( 'px', 'em' ),
339 'selectors' => array(
340 '{{WRAPPER}} .aux-cart-contents > span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
341 )
342 )
343 );
344
345 $this->end_controls_section();
346
347 /*-----------------------------------------------------------------------------------*/
348 /* text_section
349 /*-----------------------------------------------------------------------------------*/
350
351 $this->start_controls_section(
352 'dropdown_section',
353 array(
354 'label' => __('Dropdown', 'auxin-elements' ),
355 'tab' => Controls_Manager::TAB_STYLE,
356 )
357 );
358
359 $this->add_responsive_control(
360 'dropdown_position_bottom',
361 array(
362 'label' => __('Position from Bottom','auxin-elements' ),
363 'type' => Controls_Manager::SLIDER,
364 'size_units' => array('px', 'em', '%'),
365 'range' => array(
366 'px' => array(
367 'min' => -2000,
368 'max' => 2000,
369 'step' => 1
370 ),
371 '%' => array(
372 'min' => -100,
373 'max' => 100,
374 'step' => 1
375 ),
376 'em' => array(
377 'min' => -150,
378 'max' => 150,
379 'step' => 1
380 )
381 ),
382 'selectors' => array(
383 '{{WRAPPER}} .aux-card-dropdown' => 'bottom:{{SIZE}}{{UNIT}};'
384 )
385 )
386 );
387 $this->add_responsive_control(
388 'dropdown_position_left',
389 array(
390 'label' => __('Position from Left','auxin-elements' ),
391 'type' => Controls_Manager::SLIDER,
392 'size_units' => array('px', 'em', '%'),
393 'range' => array(
394 'px' => array(
395 'min' => -2000,
396 'max' => 2000,
397 'step' => 1
398 ),
399 '%' => array(
400 'min' => -100,
401 'max' => 100,
402 'step' => 1
403 ),
404 'em' => array(
405 'min' => -150,
406 'max' => 150,
407 'step' => 1
408 )
409 ),
410 'selectors' => array(
411 '{{WRAPPER}} .aux-card-dropdown' => 'left:{{SIZE}}{{UNIT}};'
412 )
413 )
414 );
415
416 $this->add_responsive_control(
417 'dropdown_width',
418 array(
419 'label' => __('Max Width','auxin-elements' ),
420 'type' => Controls_Manager::SLIDER,
421 'size_units' => array('px'),
422 'range' => array(
423 'px' => array(
424 'min' => 120,
425 'max' => 1600,
426 'step' => 1
427 )
428 ),
429 'selectors' => array(
430 '{{WRAPPER}} .aux-card-dropdown' => 'width:{{SIZE}}{{UNIT}};'
431 )
432 )
433 );
434
435 $this->add_responsive_control(
436 'dropdown_padding',
437 array(
438 'label' => __( 'Padding', 'auxin-elements' ),
439 'type' => Controls_Manager::DIMENSIONS,
440 'size_units' => array( 'px', 'em', '%'),
441 'allowed_dimensions' => 'all',
442 'selectors' => array(
443 '{{WRAPPER}} .aux-card-dropdown' => 'padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
444 )
445 )
446 );
447
448 $this->add_group_control(
449 Group_Control_Background::get_type(),
450 array(
451 'name' => 'dropdown_background',
452 'label' => __( 'Background', 'auxin-elements' ),
453 'types' => array( 'classic', 'gradient' ),
454 'selector' => '{{WRAPPER}} .aux-card-dropdown'
455 )
456 );
457
458 $this->add_group_control(
459 Group_Control_Border::get_type(),
460 array(
461 'name' => 'dropdown_border',
462 'selector' => '{{WRAPPER}} .aux-card-dropdown',
463 'separator' => 'none'
464 )
465 );
466
467 $this->add_group_control(
468 Group_Control_Box_Shadow::get_type(),
469 array(
470 'label' => __( 'Box Shadow', 'auxin-elements' ),
471 'name' => 'dropdown_box_shadow',
472 'selector' => '{{WRAPPER}} .aux-card-dropdown'
473 )
474 );
475
476 $this->end_controls_section();
477
478 /*-----------------------------------------------------------------------------------*/
479 /* text_section
480 /*-----------------------------------------------------------------------------------*/
481
482 $this->start_controls_section(
483 'item_style',
484 array(
485 'label' => __('Item', 'auxin-elements' ),
486 'tab' => Controls_Manager::TAB_STYLE,
487 )
488 );
489
490
491 $this->add_group_control(
492 Group_Control_Image_Size::get_type(),
493 array(
494 'name' => 'image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
495 'separator' => 'none',
496 'default' => 'thumbnail'
497 )
498 );
499
500 $this->add_responsive_control(
501 'item_padding',
502 array(
503 'label' => __( 'Padding', 'auxin-elements' ),
504 'type' => Controls_Manager::DIMENSIONS,
505 'size_units' => array( 'px', 'em' ),
506 'selectors' => array(
507 '{{WRAPPER}} .aux-cart-wrapper .aux-card-box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
508 ),
509 'separator' => 'after'
510 )
511 );
512
513 $this->add_control(
514 'title_color',
515 array(
516 'label' => __('Title color', 'auxin-elements'),
517 'type' => Controls_Manager::COLOR,
518 'default' => '#303030',
519 'selectors' => array(
520 '{{WRAPPER}} .aux-cart-wrapper .aux-card-item h3' => 'color: {{VALUE}}',
521 )
522 )
523 );
524
525
526 $this->add_group_control(
527 Group_Control_Typography::get_type(),
528 array(
529 'label' => __('Title Typography', 'auxin-elements' ),
530 'name' => 'title_typography',
531 'scheme' => Typography::TYPOGRAPHY_1,
532 'selector' => '{{WRAPPER}} .aux-cart-wrapper .aux-card-item h3'
533 )
534 );
535
536 $this->add_control(
537 'price_color',
538 array(
539 'label' => __('Price color', 'auxin-elements'),
540 'type' => Controls_Manager::COLOR,
541 'default' => '#303030',
542 'selectors' => array(
543 '{{WRAPPER}} .aux-cart-wrapper .aux-card-item span' => 'color: {{VALUE}}',
544 )
545 )
546 );
547
548 $this->add_group_control(
549 Group_Control_Typography::get_type(),
550 array(
551 'label' => __('Price Typography', 'auxin-elements' ),
552 'name' => 'price_typography',
553 'scheme' => Typography::TYPOGRAPHY_1,
554 'selector' => '{{WRAPPER}} .aux-cart-wrapper .aux-card-item span'
555 )
556 );
557
558
559 $this->end_controls_section();
560 }
561
562 /**
563 * Render image box widget output on the frontend.
564 *
565 * Written in PHP and used to generate the final HTML.
566 *
567 * @since 1.0.0
568 * @access protected
569 */
570 protected function render() {
571
572 $settings = $this->get_settings_for_display();
573 $align = ! empty( $settings['align'] ) ? ' aux-dropdown-' . $settings['align'] : '';
574 $dropdown_class = "";
575
576 if ( $settings['cart_style'] === 'offcanvas' ) {
577 $dropdown_class .= ' aux-desktop-off aux-tablet-off';
578 }
579
580 if ( $settings['simple_cart_mode'] = auxin_is_true( $settings['simple_cart_mode'] ) ) {
581 $dropdown_class .= ' aux-modern-dropdown';
582 }
583
584 $icon_value = ! empty( $settings['aux_shopping_cart_icon']['value'] ) ? $settings['aux_shopping_cart_icon']['value'] : ( ! empty( $settings['icon'] ) ? $settings['icon'] : 'auxicon-shopping-bag-4' ) ;
585
586 $settings['image_custom_dimension']['width'] = empty( $settings['image_custom_dimension']['width'] ) ? '' : $settings['image_custom_dimension']['width'];
587 $settings['image_custom_dimension']['height'] = empty( $settings['image_custom_dimension']['height'] ) ? '' : $settings['image_custom_dimension']['height'];
588
589 echo '<div class="aux-cart-element-container">';
590 echo auxin_wc_add_to_cart(
591 array(
592 'css_class' => 'aux-cart-element'. $align .' aux-cart-type-'. $settings['cart_style'],
593 'dropdown_class' => $dropdown_class,
594 'dropdown_skin' => $settings['cart_content_skin'],
595 'action_on' => $settings['action'],
596 'icon' => $icon_value,
597 'size' => $settings['image_size'],
598 'width' => $settings['image_custom_dimension']['width'],
599 'height' => $settings['image_custom_dimension']['height'],
600 'simple_mode' => $settings['simple_cart_mode'],
601 'basket_animation' => auxin_is_true( $settings['basket_animation'] ),
602 'cart_header_text' => $settings['cart_header_text'],
603 'total_price_text_in_dropdown' => $settings['total_price_text_in_dropdown'],
604 'checkout_text' => $settings['checkout_text']
605 )
606 );
607 echo '</div>';
608
609 }
610
611 }
612