PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.6.2
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.6.2
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
sellkit / includes / elementor / modules / order-details / widgets / order-details.php

order-details.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.6.2, at includes/elementor/modules/order-details/widgets/order-details.php

429 lines 10.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use Elementor\Repeater;
4 use Elementor\Scheme_Color;
5 use Elementor\Scheme_Typography;
6 use Elementor\Group_Control_Typography;
7 use Elementor\Plugin as Elementor;
8
9 defined( 'ABSPATH' ) || die();
10
11 /**
12 * Temporary supressed.
13 *
14 * @SuppressWarnings(ExcessiveClassLength)
15 * @SuppressWarnings(ExcessiveClassComplexity)
16 */
17 class Sellkit_Elementor_Order_Details_Widget extends Sellkit_Elementor_Base_Widget {
18
19 public function get_name() {
20 return 'sellkit-order-details';
21 }
22
23 public function get_title() {
24 return esc_html__( 'Order Details', 'sellkit' );
25 }
26
27 public function get_icon() {
28 return 'sellkit-element-icon sellkit-order-details-icon';
29 }
30
31 protected function register_controls() {
32 $this->register_section_details_order_items();
33 $this->register_settings();
34 $this->register_section_Box();
35 $this->register_section_order_details_item();
36 }
37
38 /**
39 * Temporary supressed.
40 *
41 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
42 */
43 private function register_section_details_order_items() {
44 $this->start_controls_section(
45 'section_order_detail_items',
46 [
47 'label' => esc_html__( 'Order Details items', 'sellkit' ),
48 ]
49 );
50
51 $repeater = new Repeater();
52
53 $repeater->add_control(
54 'type',
55 [
56 'label' => esc_html__( 'Type', 'sellkit' ),
57 'type' => 'select',
58 'options' => Sellkit_Elementor_Order_Details_Module::get_field_types(),
59 'default' => 'order_number',
60 ]
61 );
62
63 $repeater->add_control(
64 'label',
65 [
66 'label' => esc_html__( 'Title', 'sellkit' ),
67 'placeholder' => esc_html__( 'Title', 'sellkit' ),
68 'type' => 'text',
69 ]
70 );
71
72 $repeater->add_control(
73 'detail_item_icon',
74 [
75 'label' => esc_html__( 'Icon', 'sellkit' ),
76 'type' => 'icons',
77 'fa4compatibility' => 'icon',
78 ]
79 );
80
81 $repeater->add_responsive_control(
82 'detail_item_width',
83 [
84 'label' => esc_html__( 'Item Width', 'sellkit' ),
85 'type' => 'select',
86 'options' => [
87 '' => esc_html__( 'Default', 'sellkit' ),
88 '100' => '100%',
89 '80' => '80%',
90 '75' => '75%',
91 '66' => '66%',
92 '60' => '60%',
93 '50' => '50%',
94 '40' => '40%',
95 '33' => '33%',
96 '25' => '25%',
97 '20' => '20%',
98 ],
99 'default' => '100',
100 ]
101 );
102
103 $this->add_control(
104 'fields',
105 [
106 'type' => 'repeater',
107 'fields' => $repeater->get_controls(),
108 'default' => [
109 [
110 'type' => 'order_number',
111 'label' => esc_html__( 'Order Number', 'sellkit' ),
112 ],
113 ],
114 'frontend_available' => true,
115 'title_field' => '{{{ label }}}',
116 ]
117 );
118
119 $this->end_controls_section();
120 }
121
122 private function register_settings() {
123 $this->start_controls_section(
124 'section_settings',
125 [
126 'label' => esc_html__( 'Settings', 'sellkit' ),
127 ]
128 );
129
130 $this->add_control(
131 'list_name',
132 [
133 'label' => esc_html__( 'Heading', 'sellkit' ),
134 'type' => 'text',
135 'default' => 'Order Details',
136 'placeholder' => esc_html__( 'Enter your list name', 'sellkit' ),
137 ]
138 );
139
140 $this->end_controls_section();
141 }
142
143 private function register_section_Box() {
144 $this->start_controls_section(
145 'section_style_Box',
146 [
147 'label' => esc_html__( 'Box', 'sellkit' ),
148 'tab' => 'style',
149 ]
150 );
151
152 $this->add_control(
153 'order_details_box_background_color',
154 [
155 'label' => esc_html__( 'Background Color', 'sellkit' ),
156 'type' => 'color',
157 'selectors' => [
158 '{{WRAPPER}} .sellkit-order-details' => 'background-color: {{VALUE}};',
159 ],
160 ]
161 );
162
163 $this->add_group_control(
164 'border',
165 [
166 'name' => 'order_details_box_border',
167 'selector' => '{{WRAPPER}} .sellkit-order-details',
168 ]
169 );
170
171 $this->add_responsive_control(
172 'order_details_box_border_radius',
173 [
174 'label' => esc_html__( 'Border Radius', 'sellkit' ),
175 'type' => 'dimensions',
176 'size_units' => [ 'px', '%' ],
177 'selectors' => [
178 '{{WRAPPER}} .sellkit-order-details' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
179 ],
180 ]
181 );
182
183 $this->add_group_control(
184 'box-shadow',
185 [
186 'name' => 'order_details_box_box_shadow',
187 'exclude' => [
188 'box_shadow_position',
189 ],
190 'separator' => 'before',
191 'selector' => '{{WRAPPER}} .sellkit-order-details',
192 ]
193 );
194
195 $this->add_responsive_control(
196 'order_details_box_padding',
197 [
198 'label' => esc_html__( 'Padding', 'sellkit' ),
199 'type' => 'dimensions',
200 'size_units' => [ 'px', 'em', '%' ],
201 'separator' => 'before',
202 'selectors' => [
203 '{{WRAPPER}} .sellkit-order-details' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
204 ],
205 ]
206 );
207
208 $this->add_responsive_control(
209 'order_details_box_margin',
210 [
211 'label' => esc_html__( 'Margin', 'sellkit' ),
212 'type' => 'dimensions',
213 'size_units' => [ 'px', 'em', '%' ],
214 'selectors' => [
215 '{{WRAPPER}} .sellkit-order-details' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
216 ],
217 ]
218 );
219
220 $this->end_controls_section();
221 }
222
223 private function register_section_order_details_item() {
224 $this->start_controls_section(
225 'section_style_order_details_item',
226 [
227 'label' => esc_html__( 'Order Details Item', 'sellkit' ),
228 'tab' => 'style',
229 ]
230 );
231
232 $this->add_control(
233 'order_details_heading',
234 [
235 'label' => esc_html__( 'Heading', 'sellkit' ),
236 'type' => 'heading',
237 'separator' => 'before',
238 ]
239 );
240
241 $this->add_group_control(
242 'typography',
243 [
244 'name' => 'order_details_heading_typography',
245 'selector' => '{{WRAPPER}} .sellkit-order-details h3',
246 'scheme' => '3',
247 ]
248 );
249
250 $this->add_control(
251 'order_details_heading_color',
252 [
253 'label' => esc_html__( 'Color', 'sellkit' ),
254 'type' => 'color',
255 'selectors' => [
256 '{{WRAPPER}} .sellkit-order-details h3' => 'color: {{VALUE}};',
257 ],
258 ]
259 );
260
261 $this->add_responsive_control(
262 'order_details_heading_margin',
263 [
264 'label' => esc_html__( 'Margin', 'sellkit' ),
265 'type' => 'dimensions',
266 'size_units' => [ 'px', 'em', '%' ],
267 'selectors' => [
268 '{{WRAPPER}} .sellkit-order-details h3' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
269 ],
270 ]
271 );
272
273 $this->add_control(
274 'order_details_icon',
275 [
276 'label' => esc_html__( 'Icon', 'sellkit' ),
277 'type' => 'heading',
278 'separator' => 'before',
279 ]
280 );
281
282 $this->add_responsive_control(
283 'order_details_icon_size',
284 [
285 'label' => esc_html__( 'Size', 'sellkit' ),
286 'type' => 'slider',
287 'size_units' => [ 'px' ],
288 'range' => [
289 'px' => [
290 'max' => 200,
291 ],
292 ],
293 'selectors' => [
294 '{{WRAPPER}} .sellkit-order-details .sellkit-order-details-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
295 '{{WRAPPER}} .sellkit-order-details .sellkit-order-details-icon svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
296 ],
297 ]
298 );
299
300 $this->add_control(
301 'order_details_icon_color',
302 [
303 'label' => esc_html__( 'Color', 'sellkit' ),
304 'type' => 'color',
305 'selectors' => [
306 '{{WRAPPER}} .sellkit-order-details .sellkit-order-details-icon i' => 'color: {{VALUE}};',
307 '{{WRAPPER}} .sellkit-order-details .sellkit-order-details-icon svg' => 'fill: {{VALUE}};',
308 ],
309 ]
310 );
311
312 $this->add_control(
313 'order_details_icon_space_between',
314 [
315 'label' => esc_html__( 'Space Between', 'sellkit' ),
316 'type' => 'slider',
317 'size_units' => [ 'px' ],
318 'range' => [
319 'px' => [
320 'max' => 100,
321 ],
322 ],
323 'default' => [
324 'unit' => 'px',
325 'size' => 5,
326 ],
327 'selectors' => [
328 '{{WRAPPER}} .sellkit-order-details-left .sellkit-order-details-icon i, {{WRAPPER}} .sellkit-order-details-left .sellkit-order-details-icon svg' => 'margin-right: {{SIZE}}{{UNIT}};',
329 '{{WRAPPER}} .sellkit-order-details-right .sellkit-order-details-icon i, {{WRAPPER}} .sellkit-order-details-right .sellkit-order-details-icon svg' => 'margin-left: {{SIZE}}{{UNIT}};',
330
331 ],
332 ]
333 );
334
335 $this->add_control(
336 'order_details_data',
337 [
338 'label' => esc_html__( 'Data', 'sellkit' ),
339 'type' => 'heading',
340 'separator' => 'before',
341 ]
342 );
343
344 $this->add_group_control(
345 'typography',
346 [
347 'name' => 'order_details_data_typography',
348 'selector' => '{{WRAPPER}} .order-details-item-content',
349 'scheme' => '3',
350 ]
351 );
352
353 $this->add_control(
354 'order_details_data_color',
355 [
356 'label' => esc_html__( 'Color', 'sellkit' ),
357 'type' => 'color',
358 'selectors' => [
359 '{{WRAPPER}} .order-details-item-content' => 'color: {{VALUE}};',
360 ],
361 ]
362 );
363
364 $this->add_responsive_control(
365 'order_details_data_margin',
366 [
367 'label' => esc_html__( 'Margin', 'sellkit' ),
368 'type' => 'dimensions',
369 'size_units' => [ 'px', 'em', '%' ],
370 'selectors' => [
371 '{{WRAPPER}} .order-details-item-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
372 ],
373 ]
374 );
375
376 $this->end_controls_section();
377 }
378
379 private function render_heading() {
380 $settings = $this->get_settings_for_display();
381
382 if ( empty( $settings['list_name'] ) ) {
383 return;
384 }
385
386 printf( '<h3>%1$s</h3>', $settings['list_name'] );
387 }
388
389 private function render_item_content() {
390 $settings = $this->get_settings_for_display();
391 $fields = $settings['fields'];
392
393 $this->add_render_attribute( 'details-order-content', [
394 'class' => 'sellkit-order-details-content sellkit-flex sellkit-flex-wrap col-100',
395 ] );
396
397 // phpcs:disable
398 $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : false;
399 $order = wc_get_order( $order );
400
401 require sellkit()->plugin_dir() . 'includes/elementor/modules/order-details/templates/thankyou.php';
402 }
403
404 private function render_item() {
405
406 $direction = 'left';
407 if ( is_rtl() ) {
408 $direction = 'right';
409 }
410 $this->add_render_attribute( 'details-order-item-wrapper', [
411 'class' => 'woocommerce-order-overview woocommerce-thankyou-order-details order_details sellkit-order-details sellkit-order-details-' . $direction,
412 'id' => 'sellkit-order-details-' . $this->get_id(),
413 ] );
414 ?>
415 <div <?php echo $this->get_render_attribute_string( 'details-order-item-wrapper' ); ?>>
416 <?php
417 $this->render_heading();
418 $this->render_item_content();
419 ?>
420 </div>
421 <?php
422 }
423
424 protected function render() {
425 $this->render_item();
426 }
427
428 }
429