PluginProbe ʕ •ᴥ•ʔ
ShopPress – Shop Builder for Elementor and WooCommerce / trunk
ShopPress – Shop Builder for Elementor and WooCommerce vtrunk
shop-press / Elementor / widgets / general / orders-tracking / config.php
shop-press / Elementor / widgets / general / orders-tracking Last commit date
config.php 2 years ago
config.php
225 lines
1 <?php
2 namespace ShopPress\Elementor\Widgets;
3
4 use ShopPress\Elementor\ShopPressWidgets;
5 use Elementor\Controls_Manager;
6
7 defined( 'ABSPATH' ) || exit;
8
9 class OrdersTracking extends ShopPressWidgets {
10
11 public function get_name() {
12 return 'sp-orders-tracking';
13 }
14
15 public function get_title() {
16 return __( 'Orders Tracking', 'shop-press' );
17 }
18
19 public function get_icon() {
20 return 'sp-widget sp-eicon-order-tracking';
21 }
22
23 public function get_categories() {
24 return array( 'sp_general' );
25 }
26
27 public function setup_styling_options() {
28 $this->register_group_styler(
29 'wrapper',
30 __( 'Wrapper', 'shop-press' ),
31 array(
32 'wrapper' => array(
33 'label' => esc_html__( 'Wrapper', 'shop-press' ),
34 'type' => 'styler',
35 'selector' => '.sp-orders-tracking',
36 'wrapper' => '{{WRAPPER}}',
37 ),
38 )
39 );
40
41 $this->register_group_styler(
42 'description',
43 __( 'Description', 'shop-press' ),
44 array(
45 'icon' => array(
46 'label' => esc_html__( 'Description', 'shop-press' ),
47 'type' => 'styler',
48 'selector' => '.order-tracking-description',
49 'wrapper' => '{{WRAPPER}}',
50 ),
51 )
52 );
53
54 $this->register_group_styler(
55 'order_id',
56 __( 'Order ID', 'shop-press' ),
57 array(
58 'order_id_wrapper' => array(
59 'label' => esc_html__( 'Wrapper', 'shop-press' ),
60 'type' => 'styler',
61 'selector' => '.form-row-first',
62 'wrapper' => '{{WRAPPER}}',
63 ),
64 'order_id_label' => array(
65 'label' => esc_html__( 'Label', 'shop-press' ),
66 'type' => 'styler',
67 'selector' => '.form-row-first label',
68 'wrapper' => '{{WRAPPER}}',
69 ),
70 'order_id_input' => array(
71 'label' => esc_html__( 'Input', 'shop-press' ),
72 'type' => 'styler',
73 'selector' => '.form-row-first .input-text',
74 'wrapper' => '{{WRAPPER}}',
75 ),
76 )
77 );
78
79 $this->register_group_styler(
80 'billing_email',
81 __( 'Billing email', 'shop-press' ),
82 array(
83 'billing_email_wrapper' => array(
84 'label' => esc_html__( 'Wrapper', 'shop-press' ),
85 'type' => 'styler',
86 'selector' => '.form-row-last',
87 'wrapper' => '{{WRAPPER}}',
88 ),
89 'billing_email_label' => array(
90 'label' => esc_html__( 'Label', 'shop-press' ),
91 'type' => 'styler',
92 'selector' => '.form-row-last label',
93 'wrapper' => '{{WRAPPER}}',
94 ),
95 'billing_email_input' => array(
96 'label' => esc_html__( 'Input', 'shop-press' ),
97 'type' => 'styler',
98 'selector' => '.form-row-last .input-text',
99 'wrapper' => '{{WRAPPER}}',
100 ),
101 )
102 );
103
104 $this->register_group_styler(
105 'button',
106 __( 'Button', 'shop-press' ),
107 array(
108 'track_button' => array(
109 'label' => esc_html__( 'Button', 'shop-press' ),
110 'type' => 'styler',
111 'selector' => 'button.track-button',
112 'wrapper' => '{{WRAPPER}}',
113 ),
114 )
115 );
116 }
117
118 protected function register_controls() {
119 $this->start_controls_section(
120 'section_content',
121 array(
122 'label' => __( 'General', 'shop-press' ),
123 )
124 );
125
126 $this->add_control(
127 'description',
128 array(
129 'label' => __( 'Description', 'shop-press' ),
130 'type' => Controls_Manager::TEXTAREA,
131 'rows' => 5,
132 'default' => __( 'To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.', 'shop-press' ),
133 )
134 );
135
136 $this->add_control(
137 'description_hr',
138 array(
139 'type' => Controls_Manager::DIVIDER,
140 )
141 );
142
143 $this->add_control(
144 'orderid_title',
145 array(
146 'label' => __( 'Order ID Title', 'shop-press' ),
147 'type' => Controls_Manager::TEXT,
148 'default' => __( 'Order ID', 'shop-press' ),
149 )
150 );
151
152 $this->add_control(
153 'order_placeholder',
154 array(
155 'label' => __( 'Order ID Placeholder', 'shop-press' ),
156 'type' => Controls_Manager::TEXT,
157 'default' => __( 'Found in your order confirmation email.', 'shop-press' ),
158 )
159 );
160
161 $this->add_control(
162 'order_hr',
163 array(
164 'type' => Controls_Manager::DIVIDER,
165 )
166 );
167
168 $this->add_control(
169 'email_title',
170 array(
171 'label' => __( 'Email Title', 'shop-press' ),
172 'type' => Controls_Manager::TEXT,
173 'default' => __( 'Billing email', 'shop-press' ),
174 )
175 );
176
177 $this->add_control(
178 'email_placeholder',
179 array(
180 'label' => __( 'Email Placeholder', 'shop-press' ),
181 'type' => Controls_Manager::TEXT,
182 'default' => __( 'Email you used during checkout.', 'shop-press' ),
183 )
184 );
185
186 $this->add_control(
187 'email_hr',
188 array(
189 'type' => Controls_Manager::DIVIDER,
190 )
191 );
192
193 $this->add_control(
194 'button_text',
195 array(
196 'label' => __( 'Button Text', 'shop-press' ),
197 'type' => Controls_Manager::TEXT,
198 'default' => __( 'Track', 'shop-press' ),
199 )
200 );
201
202 $this->end_controls_section();
203 $this->setup_styling_options();
204
205 do_action( 'shoppress/elementor/widget/register_controls_init', $this );
206 }
207
208 protected function render() {
209 $settings = $this->get_settings_for_display();
210
211 do_action( 'shoppress/widget/before_render', $settings );
212
213 $args = array(
214 'description' => $settings['description'],
215 'orderid_title' => $settings['orderid_title'],
216 'order_placeholder' => $settings['order_placeholder'],
217 'email_title' => $settings['email_title'],
218 'email_placeholder' => $settings['email_placeholder'],
219 'button_text' => $settings['button_text'],
220 );
221
222 sp_load_builder_template( 'general/orders-tracking', $args );
223 }
224 }
225