PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.10.1
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.10.1
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / inc / modules / pre-orders / admin / options.php

options.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.10.1, at inc/modules/pre-orders/admin/options.php

344 lines 13.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Pre Orders.
4 *
5 * @package Merchant
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly
10 }
11
12
13 /**
14 * Hook functionality before including modules options.
15 *
16 * @since 1.9.8
17 */
18 do_action( 'merchant_admin_before_include_modules_options', Merchant_Pre_Orders::MODULE_ID );
19
20 Merchant_Admin_Options::create(
21 array(
22 'title' => esc_html__( 'Pre-order Rule', 'merchant' ),
23 'module' => Merchant_Pre_Orders::MODULE_ID,
24 'fields' => array(
25 array(
26 'id' => 'rules',
27 'type' => 'flexible_content',
28 'sorting' => true,
29 'duplicate' => true,
30 'accordion' => true,
31 'style' => Merchant_Pre_Orders::MODULE_ID . '-style default',
32 'button_label' => esc_html__( 'Add New Pre-Order', 'merchant' ),
33 'layouts' => array(
34 'rule-details' => array(
35 'title' => esc_html__( 'Campaign', 'merchant' ),
36 'title-field' => 'offer-title', // text field ID to use as title for the layout
37 'fields' => array(
38 array(
39 'id' => 'offer-title',
40 'type' => 'text',
41 'title' => esc_html__( 'Order name', 'merchant' ),
42 'default' => esc_html__( 'Custom Pre-order', 'merchant' ),
43 'desc' => esc_html__( 'Internal campaign name. This is not visible to customers.', 'merchant' ),
44 ),
45 array(
46 'id' => 'trigger_on',
47 'type' => 'select',
48 'title' => esc_html__( 'Trigger', 'merchant' ),
49 'options' => array(
50 'product' => esc_html__( 'Specific products', 'merchant' ),
51 'category' => esc_html__( 'Specific categories', 'merchant' ),
52 'tags' => esc_html__( 'Specific tags', 'merchant' ),
53 ),
54 'default' => 'product',
55 ),
56 array(
57 'id' => 'product_ids',
58 'type' => 'products_selector',
59 'multiple' => true,
60 'allowed_types' => array( 'simple', 'variable', 'variation', 'merchant_pro_bundle' ),
61 'desc' => esc_html__( 'Select the product(s) included in this pre-order.', 'merchant' ),
62 'condition' => array( 'trigger_on', '==', 'product' ),
63 ),
64 array(
65 'id' => 'category_slugs',
66 'type' => 'select_ajax',
67 'title' => esc_html__( 'Categories', 'merchant' ),
68 'source' => 'options',
69 'multiple' => true,
70 'options' => Merchant_Admin_Options::get_category_select2_choices(),
71 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
72 'desc' => esc_html__( 'Select the category or categories for which the products will be available for pre-order.', 'merchant' ),
73 'condition' => array( 'trigger_on', '==', 'category' ),
74 ),
75 array(
76 'id' => 'tag_slugs',
77 'type' => 'select_ajax',
78 'title' => esc_html__( 'Tags', 'merchant' ),
79 'source' => 'options',
80 'multiple' => true,
81 'options' => Merchant_Admin_Options::get_tag_select2_choices(),
82 'placeholder' => esc_html__( 'Select tags', 'merchant' ),
83 'desc' => esc_html__( 'Select the tag or tags for which the products will be available for pre-order.', 'merchant' ),
84 'condition' => array( 'trigger_on', '==', 'tags' ),
85 ),
86 array(
87 'id' => 'discount_toggle',
88 'type' => 'switcher',
89 'title' => __( 'Do you want to offer a discount on this pre-order?', 'merchant' ),
90 'default' => 0,
91 ),
92 array(
93 'id' => 'discount_type',
94 'type' => 'radio',
95 'title' => esc_html__( 'Discount Type', 'merchant' ),
96 'options' => array(
97 'percentage' => esc_html__( 'Percentage', 'merchant' ),
98 'fixed' => esc_html__( 'Fixed', 'merchant' ),
99 ),
100 'default' => 'percentage',
101 'conditions' => array(
102 'terms' => array(
103 array(
104 'field' => 'discount_toggle', // field ID
105 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
106 'value' => true, // can be a single value or an array of string/number/int
107 ),
108 ),
109 ),
110 ),
111 array(
112 'id' => 'discount_amount',
113 'type' => 'number',
114 'step' => 0.01,
115 'default' => 10,
116 'conditions' => array(
117 'terms' => array(
118 array(
119 'field' => 'discount_toggle', // field ID
120 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
121 'value' => true, // can be a single value or an array of string/number/int
122 ),
123 ),
124 ),
125 ),
126 array(
127 'id' => 'shipping_date',
128 'type' => 'date_time',
129 'title' => esc_html__( 'Shipping date', 'merchant' ),
130 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
131 'desc' => sprintf(
132 /* Translators: %1$s: Time zone, %2$s WordPress setting link */
133 esc_html__( 'The times set above are in the %1$s timezone, according to your settings from %2$s.',
134 'merchant' ),
135 '<strong>' . wp_timezone_string() . '</strong>',
136 '<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>'
137 ),
138 ),
139 array(
140 'id' => 'pre_order_start',
141 'type' => 'date_time',
142 'title' => esc_html__( 'Pre-order starts at', 'merchant' ),
143 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
144 'desc' => esc_html__( 'If you want your pre-order settings to take effect immediately, leave the pre-order start empty.', 'merchant' ),
145 ),
146 array(
147 'id' => 'pre_order_end',
148 'type' => 'date_time',
149 'title' => esc_html__( 'Pre-order ends at', 'merchant' ),
150 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
151 'desc' => sprintf(
152 /* Translators: %1$s: Time zone, %2$s WordPress setting link */
153 esc_html__( 'Leave it empty if you don’t want to have an end date. The times set above are in the %1$s timezone, according to your settings from %2$s.',
154 'merchant' ),
155 '<strong>' . wp_timezone_string() . '</strong>',
156 '<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>'
157 ),
158 ),
159
160 array(
161 'id' => 'user_condition',
162 'type' => 'select',
163 'title' => esc_html__( 'User Condition', 'merchant' ),
164 'options' => array(
165 'all' => esc_html__( 'All Users', 'merchant' ),
166 'customers' => esc_html__( 'Selected Users', 'merchant' ),
167 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
168 ),
169 'default' => 'all',
170 ),
171
172 array(
173 'id' => 'user_condition_roles',
174 'type' => 'select_ajax',
175 'title' => esc_html__( 'User Roles', 'merchant' ),
176 'desc' => esc_html__( 'This will limit the rule to users with these roles.', 'merchant' ),
177 'source' => 'options',
178 'multiple' => true,
179 'classes' => array( 'flex-grow' ),
180 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
181 'condition' => array( 'user_condition', '==', 'roles' ),
182 ),
183
184 array(
185 'id' => 'user_condition_users',
186 'type' => 'select_ajax',
187 'title' => esc_html__( 'Users', 'merchant' ),
188 'desc' => esc_html__( 'This will limit the rule to the selected customers.', 'merchant' ),
189 'source' => 'user',
190 'multiple' => true,
191 'classes' => array( 'flex-grow' ),
192 'condition' => array( 'user_condition', '==', 'customers' ),
193 ),
194 array(
195 'id' => 'button_text',
196 'type' => 'text',
197 'title' => esc_html__( 'Button text', 'merchant' ),
198 'default' => esc_html__( 'Pre-Order Now!', 'merchant' ),
199 ),
200
201 array(
202 'id' => 'additional_text',
203 'type' => 'text',
204 'title' => esc_html__( 'Additional information', 'merchant' ),
205 'default' => esc_html__( 'Ships on {date}', 'merchant' ),
206 ),
207
208 array(
209 'id' => 'placement',
210 'type' => 'radio',
211 'title' => esc_html__( 'Placement', 'merchant' ),
212 'options' => array(
213 'before' => esc_html__( 'Before Button', 'merchant' ),
214 'after' => esc_html__( 'After Button', 'merchant' ),
215 ),
216 'default' => 'before',
217 ),
218 array(
219 'id' => 'cart_label_text',
220 'type' => 'text',
221 'title' => esc_html__( 'Label text on cart', 'merchant' ),
222 'default' => esc_html__( 'Ships on', 'merchant' ),
223 ),
224 array(
225 'id' => 'text-color',
226 'type' => 'color',
227 'title' => esc_html__( 'Button text color', 'merchant' ),
228 'default' => '#FFF',
229 ),
230
231 array(
232 'id' => 'text-hover-color',
233 'type' => 'color',
234 'title' => esc_html__( 'Button text color hover', 'merchant' ),
235 'default' => '#FFF',
236 ),
237
238 array(
239 'id' => 'border-color',
240 'type' => 'color',
241 'title' => esc_html__( 'Button border color', 'merchant' ),
242 'default' => '#212121',
243 ),
244
245 array(
246 'id' => 'border-hover-color',
247 'type' => 'color',
248 'title' => esc_html__( 'Button border color hover', 'merchant' ),
249 'default' => '#414141',
250 ),
251
252 array(
253 'id' => 'background-color',
254 'type' => 'color',
255 'title' => esc_html__( 'Button background color', 'merchant' ),
256 'default' => '#212121',
257 ),
258
259 array(
260 'id' => 'background-hover-color',
261 'type' => 'color',
262 'title' => esc_html__( 'Button background color hover', 'merchant' ),
263 'default' => '#414141',
264 ),
265 ),
266 ),
267 ),
268 'default' => array(
269 array(
270 'layout' => 'rule-details',
271 ),
272 ),
273 ),
274 array(
275 'id' => 'modes',
276 'type' => 'select',
277 'title' => esc_html__( 'Pre-order Modes', 'merchant' ),
278 'options' => array(
279 'only_pre_orders' => esc_html__( 'Allow only pre-orders', 'merchant' ),
280 'unified_order' => esc_html__( 'Treat the whole order as pre-order', 'merchant' ),
281 // 'separate_order_for_pre_orders' => esc_html__( 'Generate separate orders for each pre-order product', 'merchant' ),
282 // 'group_pre_order_into_one_order' => esc_html__( 'Generate two separate orders, one for pre-orders and one for in-stock products', 'merchant' ),
283 ),
284 'default' => 'unified_order',
285 ),
286 array(
287 'id' => 'helping_instructions_only_pre_orders',
288 'type' => 'info_block',
289 'description' => esc_html__( 'Use this mode if you want to only allow your customers to either choose pre-order products or available ones.', 'merchant' ),
290 'conditions' => array(
291 'terms' => array(
292 array(
293 'field' => 'modes', // field ID
294 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
295 'value' => 'only_pre_orders', // can be a single value or an array of string/number/int
296 ),
297 ),
298 ),
299 ),
300 array(
301 'id' => 'helping_instructions_unified_order',
302 'type' => 'info_block',
303 'description' => esc_html__( 'Use this mode if you want to treat the whole order as a pre-order if at least one product is a pre-order.', 'merchant' ),
304 'conditions' => array(
305 'terms' => array(
306 array(
307 'field' => 'modes', // field ID
308 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
309 'value' => 'unified_order', // can be a single value or an array of string/number/int
310 ),
311 ),
312 ),
313 ),
314 array(
315 'id' => 'helping_instructions_separate_order_for_pre_orders',
316 'type' => 'info_block',
317 'description' => esc_html__( 'Use this mode if you want to generate separate orders for each pre-order product.', 'merchant' ),
318 'conditions' => array(
319 'terms' => array(
320 array(
321 'field' => 'modes', // field ID
322 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
323 'value' => 'separate_order_for_pre_orders', // can be a single value or an array of string/number/int
324 ),
325 ),
326 ),
327 ),
328 array(
329 'id' => 'helping_instructions_group_pre_order_into_one_order',
330 'type' => 'info_block',
331 'description' => esc_html__( 'Use this mode if you want to generate two separate orders, one for pre-orders and one for in-stock products.', 'merchant' ),
332 'conditions' => array(
333 'terms' => array(
334 array(
335 'field' => 'modes', // field ID
336 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
337 'value' => 'group_pre_order_into_one_order', // can be a single value or an array of string/number/int
338 ),
339 ),
340 ),
341 ),
342 ),
343 )
344 );