PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.10.0
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.10.0
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.0, at inc/modules/pre-orders/admin/options.php

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