PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 4.9.2
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v4.9.2
4.9.2 4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / widgets / product-price / product-price.php
shopengine / widgets / product-price Last commit date
screens 4 years ago product-price-config.php 4 years ago product-price.php 3 years ago
product-price.php
326 lines
1 <?php
2
3 namespace Elementor;
4
5 use ShopEngine\Widgets\Products;
6
7 defined('ABSPATH') || exit;
8
9 class ShopEngine_Product_Price extends \ShopEngine\Base\Widget {
10
11 public function config() {
12 return new ShopEngine_Product_Price_Config();
13 }
14
15 protected function register_controls() {
16
17 $this->start_controls_section(
18 'shopengine_section_price_style',
19 [
20 'label' => esc_html__('Price', 'shopengine'),
21 'tab' => Controls_Manager::TAB_STYLE,
22 ]
23 );
24
25 $this->add_responsive_control(
26 'shopengine_product_price_text_align',
27 [
28 'label' => esc_html__('Alignment', 'shopengine'),
29 'type' => Controls_Manager::CHOOSE,
30 'default' => 'flex-start',
31 'options' => [
32 'flex-start' => [
33 'title' => esc_html__('Left', 'shopengine'),
34 'icon' => 'eicon-text-align-left',
35 ],
36 'center' => [
37 'title' => esc_html__('Center', 'shopengine'),
38 'icon' => 'eicon-text-align-center',
39 ],
40 'flex-end' => [
41 'title' => esc_html__('Right', 'shopengine'),
42 'icon' => 'eicon-text-align-right',
43 ],
44 ],
45 'toggle' => false,
46 'selectors' => [
47 '{{WRAPPER}} .shopengine-product-price .price' => 'display: flex; align-items: center; justify-content: {{VALUE}};',
48 '{{WRAPPER}} .shopengine-product-price .price del, {{WRAPPER}} .shopengine-product-price .price ins' => 'background: none;',
49 ],
50 ]
51 );
52
53 $this->add_group_control(
54 Group_Control_Typography::get_type(),
55 [
56 'name' => 'shopengine_product_price_typography',
57 'selector' => '{{WRAPPER}} .shopengine-product-price :is(.price, .price .amount, .price ins)',
58 'exclude' => ['text_transform', 'text_decoration', 'font_style', 'letter_spacing'],
59 'fields_options' => [
60 'typography' => [
61 'default' => 'custom',
62 ],
63 'font_weight' => [
64 'default' => '600',
65 ],
66 'font_size' => [
67 'label' => esc_html__('Font Size (px)', 'shopengine'),
68 'size_units' => ['px'],
69 'default' => [
70 'size' => '28',
71 'unit' => 'px'
72 ]
73 ],
74 'text_transform' => [
75 'default' => 'uppercase',
76 ],
77 'text_decoration' => [
78 'default' => 'none',
79 ],
80 'line_height' => [
81 'label' => esc_html__('Line Height (px)', 'shopengine'),
82 'default' => [
83 'size' => '30',
84 'unit' => 'px',
85 ],
86 'size_units' => ['px'],
87 'tablet_default' => [
88 'unit' => 'px',
89 ],
90 'mobile_default' => [
91 'unit' => 'px',
92 ],
93 ],
94 'letter_spacing' => [
95 'label' => esc_html__('Letter Spacing (px)', 'shopengine'),
96 'size_units' => ['px'],
97 'default' => [
98 'size' => '0.1',
99 ]
100 ],
101 ],
102 ]
103 );
104
105 $this->add_control(
106 'shopengine_product_price_price_color',
107 [
108 'label' => esc_html__('Color', 'shopengine'),
109 'type' => Controls_Manager::COLOR,
110 'default' => '#101010',
111 'alpha' => false,
112 'selectors' => [
113 '{{WRAPPER}} .shopengine-product-price :is(.price, .price del, .price del .amount, .price ins )' => 'color: {{VALUE}}; opacity: 1; vertical-align: middle;',
114 ],
115 ]
116 );
117
118 $this->add_responsive_control(
119 'shopengine_product_price_space_between',
120 [
121 'label' => esc_html__('Space In-between
122 (px)', 'shopengine'),
123 'type' => Controls_Manager::SLIDER,
124 'size_units' => ['px'],
125 'default' => [
126 'size' => 8,
127 'unit' => 'px'
128 ],
129 'range' => [
130 'px' => [
131 'min' => 0,
132 'max' => 100,
133 ]
134 ],
135 'selectors' => [
136 '{{WRAPPER}} .shopengine-product-price .price del' => 'margin-right: {{SIZE}}{{UNIT}};',
137 '{{WRAPPER}} .shopengine-product-price .price .shopengine-discount-badge' => 'margin-left: {{SIZE}}{{UNIT}};',
138 '.rtl {{WRAPPER}} .shopengine-product-price .price del' => 'margin-left: {{SIZE}}{{UNIT}}; margin-right:0px;',
139 '.rtl {{WRAPPER}} .shopengine-product-price .price .shopengine-discount-badge' => 'margin-right: {{SIZE}}{{UNIT}}; margin-left:0px;',
140 ],
141 'separator' => 'before',
142 ]
143 );
144
145 $this->add_control(
146 'shopengine_product_price_sale_heading',
147 [
148 'label' => esc_html__('Sale Price', 'shopengine'),
149 'type' => Controls_Manager::HEADING,
150 'separator' => 'before',
151 ]
152 );
153
154 $this->add_control(
155 'shopengine_product_price_sale_price_color',
156 [
157 'label' => esc_html__('Color', 'shopengine'),
158 'type' => Controls_Manager::COLOR,
159 'default' => '#101010',
160 'alpha' => false,
161 'selectors' => [
162 '{{WRAPPER}} .shopengine-product-price .price ins .amount' => ' background: transparent; color: {{VALUE}};',
163 ],
164 ]
165 );
166
167 $this->add_group_control(
168 Group_Control_Typography::get_type(),
169 [
170 'name' => 'shopengine_product_price_sale_price_typography',
171 'selector' => '{{WRAPPER}} .shopengine-product-price .price ins .amount',
172 'exclude' => ['line_height', 'text_transform', 'text_decoration', 'font_style', 'letter_spacing', 'word_spacing'],
173 'fields_options' => [
174 'typography' => [
175 'default' => 'custom',
176 ],
177 'font_weight' => [
178 'default' => '600',
179 ],
180 'font_size' => [
181 'label' => esc_html__('Font Size (px)', 'shopengine'),
182 'size_units' => ['px'],
183 'default' => [
184 'size' => '14',
185 'unit' => 'px'
186 ]
187 ],
188 'text_transform' => [
189 'default' => 'uppercase',
190 ],
191 'text_decoration' => [
192 'default' => 'none',
193 ],
194 'line_height' => [
195 'label' => esc_html__('Line Height (px)', 'shopengine'),
196 'default' => [
197 'size' => '30',
198 'unit' => 'px',
199 ],
200 'size_units' => ['px'],
201 'tablet_default' => [
202 'unit' => 'px',
203 ],
204 'mobile_default' => [
205 'unit' => 'px',
206 ],
207 ],
208 'letter_spacing' => [
209 'label' => esc_html__('Letter Spacing (px)', 'shopengine'),
210 'size_units' => ['px'],
211 'default' => [
212 'size' => '0.1',
213 ]
214 ],
215 ],
216 ]
217 );
218
219 $this->add_control(
220 'shopengine_product_price_discount_badge_style',
221 [
222 'label' => esc_html__('Discount Badge', 'shopengine'),
223 'type' => Controls_Manager::HEADING,
224 'separator' => 'before',
225 ]
226 );
227
228 $this->add_control(
229 'shopengine_product_price_discount_badge_note',
230 [
231 'type' => Controls_Manager::RAW_HTML,
232 'raw' => esc_html__('Discount badge shows when a product has a sale price.', 'shopengine'),
233 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
234 ]
235 );
236
237 $this->add_group_control(
238 Group_Control_Typography::get_type(),
239 [
240 'name' => 'shopengine_product_price_discount_badge_typography',
241 'selector' => '{{WRAPPER}} .shopengine-product-price .price .shopengine-discount-badge',
242 'exclude' => ['text_decoration', 'font_style', 'letter_spacing'],
243 'fields_options' => [
244 'typography' => [
245 'default' => 'custom',
246 ],
247 'font_weight' => [
248 'default' => '400',
249 ],
250 'font_size' => [
251 'size_units' => ['px'],
252 'default' => [
253 'size' => '12',
254 'unit' => 'px'
255 ]
256 ],
257 'text_transform' => [
258 'default' => 'uppercase',
259 ],
260 'line_height' => [
261 'size_units' => ['px'],
262 'default' => [
263 'size' => '20',
264 'unit' => 'px'
265 ]
266 ],
267 'letter_spacing' => [
268 'default' => [
269 'size' => '',
270 ]
271 ],
272 ],
273 ]
274 );
275
276 $this->add_control(
277 'shopengine_product_price_discount_badge_color',
278 [
279 'label' => esc_html__('Color', 'shopengine'),
280 'type' => Controls_Manager::COLOR,
281 'alpha' => false,
282 'default' => '#FFFFFF',
283 'selectors' => [
284 '{{WRAPPER}} .shopengine-product-price .price .shopengine-discount-badge' => 'color: {{VALUE}};',
285 ],
286 ]
287 );
288
289 $this->add_control(
290 'shopengine_product_price_discount_badge_bg_color',
291 [
292 'label' => esc_html__('Background Color', 'shopengine'),
293 'type' => Controls_Manager::COLOR,
294 'alpha' => false,
295 'default' => '#EA4335',
296 'selectors' => [
297 '{{WRAPPER}} .shopengine-product-price .price .shopengine-discount-badge' => 'background: {{VALUE}};',
298 ],
299 ]
300 );
301
302 $this->add_control(
303 'shopengine_product_price_discount_badge_padding',
304 [
305 'label' => esc_html__( 'Badge Padding (px)', 'shopengine' ),
306 'type' => Controls_Manager::DIMENSIONS,
307 'selectors' => [
308 '{{WRAPPER}} .shopengine-product-price .price .shopengine-discount-badge' => 'padding: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
309 '.rtl {{WRAPPER}} .shopengine-product-price .price .shopengine-discount-badge' => 'padding: {{TOP}}px {{LEFT}}px {{BOTTOM}}px {{RIGHT}}px;',
310 ],
311 ]
312 );
313
314 $this->end_controls_section();
315 }
316
317 protected function screen() {
318
319 $settings = $this->get_settings_for_display();
320
321 $tpl = Products::instance()->get_widget_template($this->get_name());
322
323 include $tpl;
324 }
325 }
326