PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.13
ShopBuilder – WooCommerce Builder For Elementor v2.1.13
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Widgets / Controls / AddToCartSettings.php

AddToCartSettings.php in ShopBuilder – WooCommerce Builder For Elementor 2.1.13, at app/Elementor/Widgets/Controls/AddToCartSettings.php

491 lines 14.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main ProductDescription class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\Controls;
9
10 use Elementor\Controls_Manager;
11 use RadiusTheme\SB\Elementor\Widgets\Controls\ButtonSettings;
12 use RadiusTheme\SB\Helpers\Fns;
13
14 // Do not allow directly accessing this file.
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit( 'This script cannot be accessed directly.' );
17 }
18
19 /**
20 * Product Description class
21 */
22 class AddToCartSettings {
23 /**
24 * Widget Control Selectors
25 *
26 * @var object
27 */
28 private static $widget = [];
29 /**
30 * Widget Control Selectors
31 *
32 * @var array
33 */
34 private static $selectors = [];
35 /**
36 * Widget Field
37 *
38 * @return array
39 */
40 public static function widget_fields( $widget ) {
41 self::$widget = $widget;
42 self::$selectors = $widget->selectors;
43 return QuantityFields::quantity_fields( $widget ) +
44 self::add_to_cart_fields() +
45 self::add_to_cart_style() +
46 self::product_price_style_fields() +
47 QuantityFields::quantity_style_fields( $widget ) +
48 self::variation_style_fields();
49 }
50
51 /**
52 * Widget Field
53 *
54 * @return array
55 */
56 public static function add_to_cart_fields() {
57 $fields = [
58 'sec_add_to_cart' => [
59 'mode' => 'section_start',
60 'label' => esc_html__( 'Add to cart', 'shopbuilder' ),
61 ],
62
63 'cart_icon' => [
64 'label' => esc_html__( 'Cart Icon', 'shopbuilder' ),
65 'type' => 'icons',
66 'separator' => 'default',
67 ],
68 'cart_icon_align' => [
69 'mode' => 'responsive',
70 'label' => esc_html__( 'Icon Alignment', 'shopbuilder' ),
71 'type' => 'choose',
72 'options' => [
73 '0' => [
74 'title' => esc_html__( 'Left', 'shopbuilder' ),
75 'icon' => 'fas fa-arrow-left',
76 ],
77 '1' => [
78 'title' => esc_html__( 'Right', 'shopbuilder' ),
79 'icon' => 'fas fa-arrow-right',
80 ],
81 ],
82 'default' => '0',
83 'condition' => [
84 'quantity_style!' => 'default',
85 ],
86 'selectors' => [
87 self::$selectors['cart_icon_align'] => 'order: {{VALUE}};',
88 ],
89 ],
90 'cart_icon_gap' => [
91 'label' => esc_html__( 'Gap', 'shopbuilder' ),
92 'type' => 'slider',
93 'mode' => 'responsive',
94 'range' => [
95 'px' => [
96 'min' => 0,
97 'max' => 100,
98 ],
99 ],
100 'selectors' => [
101 self::$selectors['cart_icon_gap'] => 'gap: {{SIZE}}{{UNIT}};',
102 ],
103 ],
104 'add_to_cart_end' => [
105 'mode' => 'section_end',
106 ],
107 ];
108 return $fields;
109 }
110 /**
111 * Widget Field
112 *
113 * @return array
114 */
115 public static function add_to_cart_style() {
116 $fields = ButtonSettings::style_settings( self::$widget );
117 $insert_array = [
118 'cart_icon_size' => [
119 'label' => esc_html__( 'Icon size', 'shopbuilder' ),
120 'type' => 'slider',
121 'separator' => 'default',
122 'range' => [
123 'px' => [
124 'min' => 10,
125 'max' => 50,
126 ],
127 ],
128 'selectors' => [
129 self::$selectors['cart_icon_size'] => 'font-size: {{SIZE}}{{UNIT}};',
130 ],
131 ],
132 ];
133 $fields = Fns::insert_controls( 'button_padding', $fields, $insert_array );
134 return $fields;
135 }
136
137 /**
138 * Widget Field
139 *
140 * @return array
141 */
142 public static function quantity_style_fields() {
143 $fields = [
144 'quantity_section' => [
145 'mode' => 'section_start',
146 'tab' => 'style',
147 'label' => esc_html__( 'Quantity', 'shopbuilder' ),
148 ],
149 'quantity_style_heading' => [
150 'type' => 'html',
151 'raw' => sprintf(
152 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
153 esc_html__( 'Quantity Style', 'shopbuilder' )
154 ),
155 'content_classes' => 'elementor-panel-heading-title',
156 'condition' => [
157 'quantity_style' => [ 'style-1', 'style-2' ],
158 ],
159 ],
160 'icon_size' => [
161 'label' => esc_html__( 'Icon size', 'shopbuilder' ),
162 'type' => 'slider',
163 'separator' => 'default',
164 'range' => [
165 'px' => [
166 'min' => 10,
167 'max' => 50,
168 ],
169 ],
170 'default' => [
171 'size' => 15,
172 ],
173 'selectors' => [
174 self::$selectors['icon_size'] => 'font-size: {{SIZE}}{{UNIT}};',
175 ],
176 ],
177 'quantitybox_border_color' => [
178 'label' => esc_html__( 'Border Color', 'shopbuilder' ),
179 'type' => 'color',
180 'selectors' => [
181 self::$selectors['quantitybox_border_color'] => 'border-color: {{VALUE}}',
182 ],
183 ],
184 'quantity_icon_tabs_start' => [
185 'mode' => 'tabs_start',
186 ],
187 // Tab For normal view.
188 'quantity_icon_normal' => [
189 'mode' => 'tab_start',
190 'label' => esc_html__( 'Normal', 'shopbuilder' ),
191 ],
192 'quantity_icon_color' => [
193 'label' => esc_html__( 'Quantity icon Color', 'shopbuilder' ),
194 'type' => 'color',
195 'separator' => 'default',
196 'selectors' => [
197 self::$selectors['quantity_icon_color'] => 'color: {{VALUE}}',
198 ],
199 ],
200 'quantity_icon_normal_end' => [
201 'mode' => 'tab_end',
202 ],
203 'quantity_icon_hover' => [
204 'mode' => 'tab_start',
205 'label' => esc_html__( 'Hover', 'shopbuilder' ),
206 ],
207 'quantity_icon_hover_color' => [
208 'label' => esc_html__( 'Quantity icon Color', 'shopbuilder' ),
209 'type' => 'color',
210 'separator' => 'default',
211 'selectors' => [
212 self::$selectors['quantity_icon_hover_color'] => 'color: {{VALUE}}',
213 ],
214 ],
215 'quantity_icon_hover_end' => [
216 'mode' => 'tab_end',
217 ],
218 'quantity_icon_tabs_end' => [
219 'mode' => 'tabs_end',
220 ],
221
222 'text_typography' => [
223 'type' => 'typography',
224 'separator' => 'before',
225 'mode' => 'group',
226 'label' => esc_html__( 'Typography', 'shopbuilder' ),
227 'description' => esc_html__( 'Only for Quantity Label.', 'shopbuilder' ),
228 'selector' => self::$selectors['text_typography'],
229 ],
230 'quantity_number_color' => [
231 'label' => esc_html__( 'Quantity Number', 'shopbuilder' ),
232 'type' => 'color',
233 'selectors' => [
234 self::$selectors['quantity_number_color'] => 'color: {{VALUE}}',
235 ],
236 ],
237 'quantity_background_color' => [
238 'label' => esc_html__( 'Quantity Backgeound', 'shopbuilder' ),
239 'type' => 'color',
240 'selectors' => [
241 self::$selectors['quantity_background_color'] => 'background: {{VALUE}}',
242 ],
243 ],
244 'quantity_border' => [
245 'mode' => 'group',
246 'type' => 'border',
247 'label' => esc_html__( 'Quantity Border', 'shopbuilder' ),
248 'selector' => self::$selectors['quantity_border'],
249 ],
250 'quantity_radius' => [
251 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
252 'size_units' => [ 'px', '%' ],
253 'type' => 'dimensions',
254 'selectors' => [
255 self::$selectors['quantity_radius'] => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
256 ],
257 ],
258 'qunatity_padding' => [
259 'label' => esc_html__( 'Padding', 'shopbuilder' ),
260 'type' => 'dimensions',
261 'mode' => 'responsive',
262 'size_units' => [ 'px', '%', 'em' ],
263 'selectors' => [
264 self::$selectors['qunatity_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
265 ],
266 ],
267 'quantity_style_wrapper_heading' => [
268 'type' => 'html',
269 'raw' => sprintf(
270 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
271 esc_html__( 'Quantity Wrapper Style', 'shopbuilder' )
272 ),
273 'content_classes' => 'elementor-panel-heading-title',
274 'condition' => [
275 'quantity_style' => [ 'style-1', 'style-2' ],
276 ],
277 ],
278 'quantity_wrapper_background_color' => [
279 'label' => esc_html__( 'Background', 'shopbuilder' ),
280 'type' => 'color',
281 'selectors' => [
282 self::$selectors['quantity_wrapper_background_color'] => 'background: {{VALUE}}',
283 ],
284 'condition' => [
285 'quantity_style' => [ 'style-1', 'style-2' ],
286 ],
287 ],
288 'quantity_wrapper_radius' => [
289 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
290 'size_units' => [ 'px', '%' ],
291 'type' => 'dimensions',
292 'selectors' => [
293 self::$selectors['quantity_wrapper_radius'] => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
294 ],
295 'condition' => [
296 'quantity_style' => [ 'style-1', 'style-2' ],
297 ],
298 ],
299 'qunatity_wrapper_padding' => [
300 'label' => esc_html__( 'Padding', 'shopbuilder' ),
301 'type' => 'dimensions',
302 'mode' => 'responsive',
303 'size_units' => [ 'px', '%', 'em' ],
304 'selectors' => [
305 self::$selectors['qunatity_wrapper_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
306 ],
307 ],
308 'quantity_section_end' => [
309 'mode' => 'section_end',
310 ],
311 ];
312 return $fields;
313 }
314
315 /**
316 * Widget Field
317 *
318 * @return array
319 */
320 public static function variation_style_fields() {
321 $fields = [
322 'variation_section' => [
323 'mode' => 'section_start',
324 'tab' => 'style',
325 'label' => esc_html__( 'Variations', 'shopbuilder' ),
326 ],
327 'variation_label_typography' => [
328 'type' => 'typography',
329 'separator' => 'before',
330 'mode' => 'group',
331 'label' => esc_html__( 'Label Typography', 'shopbuilder' ),
332 'description' => esc_html__( 'Only for Variation Label.', 'shopbuilder' ),
333 'selector' => self::$selectors['variation_label_typography'],
334 ],
335 'variation_stock_typography' => [
336 'type' => 'typography',
337 'separator' => 'before',
338 'mode' => 'group',
339 'label' => esc_html__( 'Stock Typography', 'shopbuilder' ),
340 'description' => esc_html__( 'Only for variation stock.', 'shopbuilder' ),
341 'selector' => self::$selectors['variation_stock_typography'],
342 ],
343 'variation_label_color' => [
344 'label' => esc_html__( 'Label Color', 'shopbuilder' ),
345 'type' => 'color',
346 'selectors' => [
347 self::$selectors['variation_label_color'] => 'color: {{VALUE}}',
348 ],
349 ],
350 'variation_stock_color' => [
351 'label' => esc_html__( 'Stock Color', 'shopbuilder' ),
352 'type' => 'color',
353 'selectors' => [
354 self::$selectors['variation_stock_color'] => 'color: {{VALUE}}',
355 ],
356 ],
357 'variation_outofstock_color' => [
358 'label' => esc_html__( 'Out of Stock Color', 'shopbuilder' ),
359 'type' => 'color',
360 'selectors' => [
361 self::$selectors['variation_outofstock_color'] => 'color: {{VALUE}}',
362 ],
363 ],
364 'variation_height' => [
365 'label' => esc_html__( 'Height', 'shopbuilder' ),
366 'type' => 'slider',
367 'range' => [
368 'px' => [
369 'min' => 10,
370 'max' => 200,
371 ],
372 ],
373 'selectors' => [
374 self::$selectors['variation_height'] => 'height: {{SIZE}}{{UNIT}};',
375 ],
376 ],
377 'variation_width' => [
378 'label' => esc_html__( 'Width', 'shopbuilder' ),
379 'size_units' => [ 'px', '%' ],
380 'type' => 'slider',
381 'range' => [
382 'px' => [
383 'min' => 10,
384 'max' => 900,
385 ],
386 '%' => [
387 'min' => 0,
388 'max' => 100,
389 ],
390 ],
391 'selectors' => [
392 self::$selectors['variation_width'] => 'width: {{SIZE}}{{UNIT}};',
393 ],
394 ],
395 'variation_border' => [
396 'mode' => 'group',
397 'type' => 'border',
398 'label' => esc_html__( 'Quantity Border', 'shopbuilder' ),
399 'selector' => self::$selectors['variation_border'],
400 ],
401 'variation_border_radius' => [
402 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
403 'size_units' => [ 'px', '%' ],
404 'type' => 'slider',
405 'selectors' => [
406 self::$selectors['variation_border_radius'] => 'border-radius: {{SIZE}}{{UNIT}};',
407 ],
408 ],
409 'variation_padding' => [
410 'label' => esc_html__( 'Padding', 'shopbuilder' ),
411 'type' => 'dimensions',
412 'size_units' => [ 'px' ],
413 'default' => [
414 'top' => '10',
415 'right' => '10',
416 'bottom' => '10',
417 'left' => '10',
418 'unit' => 'px',
419 'isLinked' => true,
420 ],
421 'separator' => 'default',
422 'selectors' => [
423 self::$selectors['variation_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
424 ],
425 ],
426 'variation_label_margin' => [
427 'label' => esc_html__( 'Label Margin', 'shopbuilder' ),
428 'type' => 'dimensions',
429 'size_units' => [ 'px', '%', 'em' ],
430 'selectors' => [
431 self::$selectors['variation_label_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
432 ],
433 ],
434 'variation_item_margin' => [
435 'label' => esc_html__( 'Variation Item Margin', 'shopbuilder' ),
436 'type' => 'dimensions',
437 'size_units' => [ 'px', '%', 'em' ],
438 'selectors' => [
439 self::$selectors['variation_item_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
440 ],
441 ],
442 'variation_section_end' => [
443 'mode' => 'section_end',
444 ],
445 ];
446 return $fields;
447 }
448
449 /**
450 * Widget Field
451 *
452 * @return array
453 */
454 public static function product_price_style_fields() {
455 return [
456 'price_section_style_start' => [
457 'mode' => 'section_start',
458 'tab' => 'style',
459 'label' => esc_html__( 'Price', 'shopbuilder' ),
460 ],
461 'price_typography' => [
462 'type' => 'typography',
463 'separator' => 'before',
464 'mode' => 'group',
465 'label' => esc_html__( 'Typography', 'shopbuilder' ),
466 'description' => esc_html__( 'Only for Variation Price', 'shopbuilder' ),
467 'selector' => self::$selectors['price_typography'],
468 ],
469 'price_color' => [
470 'label' => esc_html__( 'Color', 'shopbuilder' ),
471 'type' => 'color',
472 'selectors' => [
473 self::$selectors['price_color'] => 'color: {{VALUE}}',
474 ],
475 ],
476 'price_margin' => [
477 'label' => esc_html__( 'Margin', 'shopbuilder' ),
478 'type' => 'dimensions',
479 'size_units' => [ 'px' ],
480 'separator' => 'default',
481 'selectors' => [
482 self::$selectors['price_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
483 ],
484 ],
485 'price_section_style_end' => [
486 'mode' => 'section_end',
487 ],
488 ];
489 }
490 }
491