PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.5.8
Shortcodes and extra features for Phlox theme v2.5.8
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 6 years ago copyright.php 6 years ago current-time.php 6 years ago logo.php 6 years ago menu.php 6 years ago modern-search.php 6 years ago search.php 6 years ago shopping-cart.php 6 years ago site-title.php 6 years ago
shopping-cart.php
599 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\Scheme_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' => 'fa fa-align-left',
197 ),
198 'center' => array(
199 'title' => __( 'Center', 'elementor' ),
200 'icon' => 'fa fa-align-center',
201 ),
202 'end' => array(
203 'title' => __( 'Right', 'elementor' ),
204 'icon' => 'fa fa-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
224 $this->end_controls_section();
225
226 /* title_style_section
227 /*-------------------------------------*/
228
229 $this->start_controls_section(
230 'bubble_section',
231 array(
232 'label' => __( 'Counter Bubble', 'auxin-elements' ),
233 'tab' => Controls_Manager::TAB_STYLE
234 )
235 );
236
237 $this->add_control(
238 'bubble_bg_color',
239 array(
240 'label' => __( 'Background', 'auxin-elements' ),
241 'type' => Controls_Manager::COLOR,
242 'selectors' => array(
243 '{{WRAPPER}} .aux-cart-contents > span' => 'background-color: {{VALUE}};',
244 )
245 )
246 );
247
248 $this->add_group_control(
249 Group_Control_Typography::get_type(),
250 array(
251 'name' => 'bubble_typography',
252 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
253 'selector' => '{{WRAPPER}} .aux-cart-contents > span'
254 )
255 );
256
257 $this->add_control(
258 'bubble_text_color',
259 array(
260 'label' => __( 'Text Color', 'auxin-elements' ),
261 'type' => Controls_Manager::COLOR,
262 'selectors' => array(
263 '{{WRAPPER}} .aux-cart-contents > span' => 'color: {{VALUE}};',
264 )
265 )
266 );
267
268 $this->add_group_control(
269 Group_Control_Box_Shadow::get_type(),
270 array(
271 'label' => __( 'Box Shadow', 'auxin-elements' ),
272 'name' => 'bubble_box_shadow',
273 'selector' => '{{WRAPPER}} .aux-cart-contents > span'
274 )
275 );
276
277 $this->add_responsive_control(
278 'bubble_position_bottom',
279 array(
280 'label' => __('Position from Bottom','auxin-elements' ),
281 'type' => Controls_Manager::SLIDER,
282 'size_units' => array('px', 'em', '%'),
283 'range' => array(
284 'px' => array(
285 'min' => -100,
286 'max' => 100,
287 'step' => 1
288 ),
289 'em' => array(
290 'min' => -15,
291 'max' => 15,
292 'step' => 1
293 )
294 ),
295 'selectors' => array(
296 '{{WRAPPER}} .aux-cart-contents > span' => 'bottom:{{SIZE}}{{UNIT}};'
297 )
298 )
299 );
300 $this->add_responsive_control(
301 'bubble_position_right',
302 array(
303 'label' => __('Position from right','auxin-elements' ),
304 'type' => Controls_Manager::SLIDER,
305 'size_units' => array('px', 'em', '%'),
306 'range' => array(
307 'px' => array(
308 'min' => -100,
309 'max' => 100,
310 'step' => 1
311 ),
312 'em' => array(
313 'min' => -15,
314 'max' => 15,
315 'step' => 1
316 )
317 ),
318 'selectors' => array(
319 '{{WRAPPER}} .aux-cart-contents > span' => 'right:{{SIZE}}{{UNIT}};'
320 )
321 )
322 );
323
324 $this->add_responsive_control(
325 'bubble_padding',
326 array(
327 'label' => __( 'Padding', 'auxin-elements' ),
328 'type' => Controls_Manager::DIMENSIONS,
329 'size_units' => array( 'px', 'em' ),
330 'selectors' => array(
331 '{{WRAPPER}} .aux-cart-contents > span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
332 )
333 )
334 );
335
336 $this->end_controls_section();
337
338 /*-----------------------------------------------------------------------------------*/
339 /* text_section
340 /*-----------------------------------------------------------------------------------*/
341
342 $this->start_controls_section(
343 'dropdown_section',
344 array(
345 'label' => __('Dropdown', 'auxin-elements' ),
346 'tab' => Controls_Manager::TAB_STYLE,
347 )
348 );
349
350 $this->add_responsive_control(
351 'dropdown_position_bottom',
352 array(
353 'label' => __('Position from Bottom','auxin-elements' ),
354 'type' => Controls_Manager::SLIDER,
355 'size_units' => array('px', 'em', '%'),
356 'range' => array(
357 'px' => array(
358 'min' => -2000,
359 'max' => 2000,
360 'step' => 1
361 ),
362 '%' => array(
363 'min' => -100,
364 'max' => 100,
365 'step' => 1
366 ),
367 'em' => array(
368 'min' => -150,
369 'max' => 150,
370 'step' => 1
371 )
372 ),
373 'selectors' => array(
374 '{{WRAPPER}} .aux-card-dropdown' => 'bottom:{{SIZE}}{{UNIT}};'
375 )
376 )
377 );
378 $this->add_responsive_control(
379 'dropdown_position_left',
380 array(
381 'label' => __('Position from Left','auxin-elements' ),
382 'type' => Controls_Manager::SLIDER,
383 'size_units' => array('px', 'em', '%'),
384 'range' => array(
385 'px' => array(
386 'min' => -2000,
387 'max' => 2000,
388 'step' => 1
389 ),
390 '%' => array(
391 'min' => -100,
392 'max' => 100,
393 'step' => 1
394 ),
395 'em' => array(
396 'min' => -150,
397 'max' => 150,
398 'step' => 1
399 )
400 ),
401 'selectors' => array(
402 '{{WRAPPER}} .aux-card-dropdown' => 'left:{{SIZE}}{{UNIT}};'
403 )
404 )
405 );
406
407 $this->add_responsive_control(
408 'dropdown_width',
409 array(
410 'label' => __('Max Width','auxin-elements' ),
411 'type' => Controls_Manager::SLIDER,
412 'size_units' => array('px'),
413 'range' => array(
414 'px' => array(
415 'min' => 120,
416 'max' => 1600,
417 'step' => 1
418 )
419 ),
420 'selectors' => array(
421 '{{WRAPPER}} .aux-card-dropdown' => 'width:{{SIZE}}{{UNIT}};'
422 )
423 )
424 );
425
426 $this->add_responsive_control(
427 'dropdown_padding',
428 array(
429 'label' => __( 'Padding', 'auxin-elements' ),
430 'type' => Controls_Manager::DIMENSIONS,
431 'size_units' => array( 'px', 'em', '%'),
432 'allowed_dimensions' => 'all',
433 'selectors' => array(
434 '{{WRAPPER}} .aux-card-dropdown' => 'padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
435 )
436 )
437 );
438
439 $this->add_group_control(
440 Group_Control_Background::get_type(),
441 array(
442 'name' => 'dropdown_background',
443 'label' => __( 'Background', 'auxin-elements' ),
444 'types' => array( 'classic', 'gradient' ),
445 'selector' => '{{WRAPPER}} .aux-card-dropdown'
446 )
447 );
448
449 $this->add_group_control(
450 Group_Control_Border::get_type(),
451 array(
452 'name' => 'dropdown_border',
453 'selector' => '{{WRAPPER}} .aux-card-dropdown',
454 'separator' => 'none'
455 )
456 );
457
458 $this->add_group_control(
459 Group_Control_Box_Shadow::get_type(),
460 array(
461 'label' => __( 'Box Shadow', 'auxin-elements' ),
462 'name' => 'dropdown_box_shadow',
463 'selector' => '{{WRAPPER}} .aux-card-dropdown'
464 )
465 );
466
467 $this->end_controls_section();
468
469 /*-----------------------------------------------------------------------------------*/
470 /* text_section
471 /*-----------------------------------------------------------------------------------*/
472
473 $this->start_controls_section(
474 'item_style',
475 array(
476 'label' => __('Item', 'auxin-elements' ),
477 'tab' => Controls_Manager::TAB_STYLE,
478 )
479 );
480
481
482 $this->add_group_control(
483 Group_Control_Image_Size::get_type(),
484 array(
485 'name' => 'image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
486 'separator' => 'none',
487 'default' => 'thumbnail'
488 )
489 );
490
491 $this->add_responsive_control(
492 'item_padding',
493 array(
494 'label' => __( 'Padding', 'auxin-elements' ),
495 'type' => Controls_Manager::DIMENSIONS,
496 'size_units' => array( 'px', 'em' ),
497 'selectors' => array(
498 '{{WRAPPER}} .aux-cart-wrapper .aux-card-box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
499 ),
500 'separator' => 'after'
501 )
502 );
503
504 $this->add_control(
505 'title_color',
506 array(
507 'label' => __('Title color', 'auxin-elements'),
508 'type' => Controls_Manager::COLOR,
509 'default' => '#303030',
510 'selectors' => array(
511 '{{WRAPPER}} .aux-cart-wrapper .aux-card-item h3' => 'color: {{VALUE}}',
512 )
513 )
514 );
515
516
517 $this->add_group_control(
518 Group_Control_Typography::get_type(),
519 array(
520 'label' => __('Title Typography', 'auxin-elements' ),
521 'name' => 'title_typography',
522 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
523 'selector' => '{{WRAPPER}} .aux-cart-wrapper .aux-card-item h3'
524 )
525 );
526
527 $this->add_control(
528 'price_color',
529 array(
530 'label' => __('Price color', 'auxin-elements'),
531 'type' => Controls_Manager::COLOR,
532 'default' => '#303030',
533 'selectors' => array(
534 '{{WRAPPER}} .aux-cart-wrapper .aux-card-item span' => 'color: {{VALUE}}',
535 )
536 )
537 );
538
539 $this->add_group_control(
540 Group_Control_Typography::get_type(),
541 array(
542 'label' => __('Price Typography', 'auxin-elements' ),
543 'name' => 'price_typography',
544 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
545 'selector' => '{{WRAPPER}} .aux-cart-wrapper .aux-card-item span'
546 )
547 );
548
549
550 $this->end_controls_section();
551 }
552
553 /**
554 * Render image box widget output on the frontend.
555 *
556 * Written in PHP and used to generate the final HTML.
557 *
558 * @since 1.0.0
559 * @access protected
560 */
561 protected function render() {
562
563 $settings = $this->get_settings_for_display();
564 $align = ! empty( $settings['align'] ) ? ' aux-dropdown-' . $settings['align'] : '';
565 $dropdown_class = "";
566
567 if ( $settings['cart_style'] === 'offcanvas' ) {
568 $dropdown_class .= ' aux-desktop-off aux-tablet-off';
569 }
570
571 if ( $settings['simple_cart_mode'] = auxin_is_true( $settings['simple_cart_mode'] ) ) {
572 $dropdown_class .= ' aux-modern-dropdown';
573 }
574
575 $icon_value = ! empty( $settings['aux_shopping_cart_icon']['value'] ) ? $settings['aux_shopping_cart_icon']['value'] : ( ! empty( $settings['icon'] ) ? $settings['icon'] : 'auxicon-shopping-bag-4' ) ;
576
577 echo '<div class="aux-cart-element-container">';
578 echo auxin_wc_add_to_cart(
579 array(
580 'css_class' => 'aux-cart-element'. $align .' aux-cart-type-'. $settings['cart_style'],
581 'dropdown_class' => $dropdown_class,
582 'dropdown_skin' => $settings['cart_content_skin'],
583 'action_on' => $settings['action'],
584 'icon' => $icon_value,
585 'size' => $settings['image_size'],
586 'width' => $settings['image_custom_dimension']['width'],
587 'height' => $settings['image_custom_dimension']['height'],
588 'simple_mode' => $settings['simple_cart_mode'],
589 'basket_animation' => auxin_is_true( $settings['basket_animation'] ),
590 'cart_header_text' => $settings['cart_header_text'],
591 'total_price_text_in_dropdown' => $settings['total_price_text_in_dropdown']
592 )
593 );
594 echo '</div>';
595
596 }
597
598 }
599