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

330 lines 12.5 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 Offer', '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' ),
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 product categories that will show the offer.', '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' => 'text',
101 'default' => 10,
102 'conditions' => array(
103 'terms' => array(
104 array(
105 'field' => 'discount_toggle', // field ID
106 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
107 'value' => true, // can be a single value or an array of string/number/int
108 ),
109 ),
110 ),
111 ),
112 array(
113 'id' => 'shipping_date',
114 'type' => 'date_time',
115 'title' => esc_html__( 'Shipping date', 'merchant' ),
116 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
117 'desc' => sprintf(
118 /* Translators: %1$s: Time zone, %2$s WordPress setting link */
119 esc_html__( 'The times set above are in the %1$s timezone, according to your settings from %2$s.',
120 'merchant' ),
121 '<strong>' . wp_timezone_string() . '</strong>',
122 '<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>'
123 ),
124 ),
125 array(
126 'id' => 'pre_order_start',
127 'type' => 'date_time',
128 'title' => esc_html__( 'Pre-order starts at', 'merchant' ),
129 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
130 'desc' => esc_html__( 'If you want your pre-order settings to take effect immediately, leave the pre-order start empty.', 'merchant' ),
131 ),
132 array(
133 'id' => 'pre_order_end',
134 'type' => 'date_time',
135 'title' => esc_html__( 'Pre-order ends at', 'merchant' ),
136 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ),
137 'desc' => sprintf(
138 /* Translators: %1$s: Time zone, %2$s WordPress setting link */
139 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.',
140 'merchant' ),
141 '<strong>' . wp_timezone_string() . '</strong>',
142 '<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>'
143 ),
144 ),
145
146 array(
147 'id' => 'user_condition',
148 'type' => 'select',
149 'title' => esc_html__( 'User Condition', 'merchant' ),
150 'options' => array(
151 'all' => esc_html__( 'All Users', 'merchant' ),
152 'customers' => esc_html__( 'Selected Users', 'merchant' ),
153 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
154 ),
155 'default' => 'all',
156 ),
157
158 array(
159 'id' => 'user_condition_roles',
160 'type' => 'select_ajax',
161 'title' => esc_html__( 'User Roles', 'merchant' ),
162 'desc' => esc_html__( 'This will limit the rule to users with these roles.', 'merchant' ),
163 'source' => 'options',
164 'multiple' => true,
165 'classes' => array( 'flex-grow' ),
166 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
167 'condition' => array( 'user_condition', '==', 'roles' ),
168 ),
169
170 array(
171 'id' => 'user_condition_users',
172 'type' => 'select_ajax',
173 'title' => esc_html__( 'Users', 'merchant' ),
174 'desc' => esc_html__( 'This will limit the rule to the selected customers.', 'merchant' ),
175 'source' => 'user',
176 'multiple' => true,
177 'classes' => array( 'flex-grow' ),
178 'condition' => array( 'user_condition', '==', 'customers' ),
179 ),
180 array(
181 'id' => 'button_text',
182 'type' => 'text',
183 'title' => esc_html__( 'Button text', 'merchant' ),
184 'default' => esc_html__( 'Pre-Order Now!', 'merchant' ),
185 ),
186
187 array(
188 'id' => 'additional_text',
189 'type' => 'text',
190 'title' => esc_html__( 'Additional information', 'merchant' ),
191 'default' => esc_html__( 'Ships on {date}', 'merchant' ),
192 ),
193
194 array(
195 'id' => 'placement',
196 'type' => 'radio',
197 'title' => esc_html__( 'Placement', 'merchant' ),
198 'options' => array(
199 'before' => esc_html__( 'Before Button', 'merchant' ),
200 'after' => esc_html__( 'After Button', 'merchant' ),
201 ),
202 'default' => 'before',
203 ),
204 array(
205 'id' => 'cart_label_text',
206 'type' => 'text',
207 'title' => esc_html__( 'Label text on cart', 'merchant' ),
208 'default' => esc_html__( 'Ships on', 'merchant' ),
209 ),
210 array(
211 'id' => 'text-color',
212 'type' => 'color',
213 'title' => esc_html__( 'Button text color', 'merchant' ),
214 'default' => '#FFF',
215 ),
216
217 array(
218 'id' => 'text-hover-color',
219 'type' => 'color',
220 'title' => esc_html__( 'Button text color hover', 'merchant' ),
221 'default' => '#FFF',
222 ),
223
224 array(
225 'id' => 'border-color',
226 'type' => 'color',
227 'title' => esc_html__( 'Button border color', 'merchant' ),
228 'default' => '#212121',
229 ),
230
231 array(
232 'id' => 'border-hover-color',
233 'type' => 'color',
234 'title' => esc_html__( 'Button border color hover', 'merchant' ),
235 'default' => '#414141',
236 ),
237
238 array(
239 'id' => 'background-color',
240 'type' => 'color',
241 'title' => esc_html__( 'Button background color', 'merchant' ),
242 'default' => '#212121',
243 ),
244
245 array(
246 'id' => 'background-hover-color',
247 'type' => 'color',
248 'title' => esc_html__( 'Button background color hover', 'merchant' ),
249 'default' => '#414141',
250 ),
251 ),
252 ),
253 ),
254 'default' => array(
255 array(
256 'layout' => 'rule-details',
257 ),
258 ),
259 ),
260 array(
261 'id' => 'modes',
262 'type' => 'select',
263 'title' => esc_html__( 'Pre-order Modes', 'merchant' ),
264 'options' => array(
265 'only_pre_orders' => esc_html__( 'Allow only pre-orders', 'merchant' ),
266 'unified_order' => esc_html__( 'Treat the whole order as pre-order', 'merchant' ),
267 'separate_order_for_pre_orders' => esc_html__( 'Generate separate orders for each pre-order product', 'merchant' ),
268 'group_pre_order_into_one_order' => esc_html__( 'Generate two separate orders, one for pre-orders and one for in-stock products', 'merchant' ),
269 ),
270 'default' => 'unified_order',
271 ),
272 array(
273 'id' => 'helping_instructions_only_pre_orders',
274 'type' => 'info_block',
275 'description' => esc_html__( 'Use this mode if you want to only allow your customers to either choose pre-order products or available ones.', 'merchant' ),
276 'conditions' => array(
277 'terms' => array(
278 array(
279 'field' => 'modes', // field ID
280 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
281 'value' => 'only_pre_orders', // can be a single value or an array of string/number/int
282 ),
283 ),
284 ),
285 ),
286 array(
287 'id' => 'helping_instructions_unified_order',
288 'type' => 'info_block',
289 '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' ),
290 'conditions' => array(
291 'terms' => array(
292 array(
293 'field' => 'modes', // field ID
294 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
295 'value' => 'unified_order', // can be a single value or an array of string/number/int
296 ),
297 ),
298 ),
299 ),
300 array(
301 'id' => 'helping_instructions_separate_order_for_pre_orders',
302 'type' => 'info_block',
303 'description' => esc_html__( 'Use this mode if you want to generate separate orders for each pre-order product.', 'merchant' ),
304 'conditions' => array(
305 'terms' => array(
306 array(
307 'field' => 'modes', // field ID
308 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
309 'value' => 'separate_order_for_pre_orders', // can be a single value or an array of string/number/int
310 ),
311 ),
312 ),
313 ),
314 array(
315 'id' => 'helping_instructions_group_pre_order_into_one_order',
316 'type' => 'info_block',
317 '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' ),
318 'conditions' => array(
319 'terms' => array(
320 array(
321 'field' => 'modes', // field ID
322 'operator' => '===', // Available operators: ===, !==, >, <, >=, <=, in, !in, contains, !contains
323 'value' => 'group_pre_order_into_one_order', // can be a single value or an array of string/number/int
324 ),
325 ),
326 ),
327 ),
328 ),
329 )
330 );