| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Cart Reserved Timer — Option group definitions. |
| 5 |
* |
| 6 |
* Pure data file. Returns the option groups array |
| 7 |
* consumed by init_option_groups(). |
| 8 |
* |
| 9 |
* @package Merchant |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; // Exit if accessed directly |
| 14 |
} |
| 15 |
|
| 16 |
return array( |
| 17 |
array( |
| 18 |
'title' => esc_html__( 'Settings', 'merchant' ), |
| 19 |
'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 20 |
'fields' => array( |
| 21 |
array( |
| 22 |
'id' => 'end_date', |
| 23 |
'type' => 'select', |
| 24 |
'title' => esc_html__( 'Countdown timer end date', 'merchant' ), |
| 25 |
'options' => array( |
| 26 |
'evergreen' => esc_html__( 'Evergreen', 'merchant' ), |
| 27 |
'sale-dates' => esc_html__( 'Sale price dates', 'merchant' ), |
| 28 |
), |
| 29 |
'default' => 'sale-dates', |
| 30 |
'desc' => esc_html__( '"Sale Price Dates" will countdown to a specified end-date and time. "Evergreen" generates a unique expiration date for each visitor and product, within set minimum and maximum deadlines', |
| 31 |
'merchant' ), |
| 32 |
'ai_meta' => array( |
| 33 |
'usage_hint' => 'Controls the countdown mode. Set BEFORE other fields: sale-dates enables sale_start_date and sale_end_date; evergreen enables cool_off_period and the min/max expiration deadline fields.', |
| 34 |
), |
| 35 |
), |
| 36 |
|
| 37 |
array( |
| 38 |
'id' => 'sale_start_date', |
| 39 |
'type' => 'date_time', |
| 40 |
'title' => esc_html__( 'Countdown starts at', 'merchant' ), |
| 41 |
'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ), |
| 42 |
'condition' => array( 'end_date', '==', 'sale-dates' ), |
| 43 |
'ai_meta' => array( |
| 44 |
'allow_empty' => true, |
| 45 |
'value_format' => 'm-d-Y h:i A', |
| 46 |
'usage_hint' => 'Optional. Countdown start date. Format: m-d-Y h:i A (e.g., 06-24-2026 03:30 PM). Requires end_date=sale-dates.', |
| 47 |
), |
| 48 |
), |
| 49 |
|
| 50 |
array( |
| 51 |
'id' => 'sale_end_date', |
| 52 |
'type' => 'date_time', |
| 53 |
'title' => esc_html__( 'Countdown ends at', 'merchant' ), |
| 54 |
'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ), |
| 55 |
'condition' => array( 'end_date', '==', 'sale-dates' ), |
| 56 |
'ai_meta' => array( |
| 57 |
'allow_empty' => true, |
| 58 |
'value_format' => 'm-d-Y h:i A', |
| 59 |
'usage_hint' => 'Optional. Countdown end date. Leave empty for no end. Format: m-d-Y h:i A (e.g., 06-24-2026 03:30 PM). Requires end_date=sale-dates.', |
| 60 |
), |
| 61 |
'desc' => sprintf( |
| 62 |
/* Translators: %1$s: Time zone, %2$s WordPress setting link */ |
| 63 |
esc_html__( 'The countdown bar will only be displayed during this range. The times set above are in the %1$s timezone, according to your settings from %2$s.', |
| 64 |
'merchant' ), |
| 65 |
'<strong>' . wp_timezone_string() . '</strong>', |
| 66 |
'<a href="' . esc_url( admin_url( 'options-general.php' ) ) . '" target="_blank">' . esc_html__( 'WordPress Settings', 'merchant' ) . '</a>' |
| 67 |
), |
| 68 |
), |
| 69 |
|
| 70 |
array( |
| 71 |
'id' => 'cool_off_period', |
| 72 |
'type' => 'number', |
| 73 |
'title' => esc_html__( 'Cool off period (minutes)', 'merchant' ), |
| 74 |
'default' => 15, |
| 75 |
'desc' => esc_html__( 'Once the cool off period expires, the countdown timer will be shown again (individually for each customer on each product page).', |
| 76 |
'merchant' ), |
| 77 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 78 |
), |
| 79 |
|
| 80 |
// Minimum |
| 81 |
array( |
| 82 |
'id' => 'min_expiration_deadline_label', |
| 83 |
'type' => 'content', |
| 84 |
'title' => esc_html__( 'Minimum expiration deadline', 'merchant' ), |
| 85 |
'content' => '', |
| 86 |
'desc' => esc_html__( 'Sets the time before the end date (set by the Maximum expiration deadline option) when the timer will disappear.', 'merchant' ), |
| 87 |
'class' => 'merchant-countdown-evergreen-content-field', |
| 88 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 89 |
), |
| 90 |
array( |
| 91 |
'id' => 'min_expiration_deadline_days', |
| 92 |
'type' => 'number', |
| 93 |
'title' => esc_html__( 'Days', 'merchant' ), |
| 94 |
'default' => 0, |
| 95 |
'min' => 0, |
| 96 |
'step' => 1, |
| 97 |
'placeholder' => esc_html__( 'Days', 'merchant' ), |
| 98 |
'class' => 'merchant-countdown-evergreen-field', |
| 99 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 100 |
), |
| 101 |
array( |
| 102 |
'id' => 'min_expiration_deadline', |
| 103 |
'type' => 'number', |
| 104 |
'title' => esc_html__( 'Hours', 'merchant' ), |
| 105 |
'default' => 2, |
| 106 |
'min' => 0, |
| 107 |
'step' => 1, |
| 108 |
'placeholder' => esc_html__( 'Hours', 'merchant' ), |
| 109 |
'class' => 'merchant-countdown-evergreen-field', |
| 110 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 111 |
), |
| 112 |
array( |
| 113 |
'id' => 'min_expiration_deadline_minutes', |
| 114 |
'type' => 'number', |
| 115 |
'title' => esc_html__( 'Minutes', 'merchant' ), |
| 116 |
'default' => 0, |
| 117 |
'min' => 0, |
| 118 |
'step' => 1, |
| 119 |
'placeholder' => esc_html__( 'Minutes', 'merchant' ), |
| 120 |
'class' => 'merchant-countdown-evergreen-field', |
| 121 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 122 |
), |
| 123 |
|
| 124 |
// Maximum |
| 125 |
array( |
| 126 |
'id' => 'max_expiration_deadline_label', |
| 127 |
'type' => 'content', |
| 128 |
'title' => esc_html__( 'Maximum expiration deadline', 'merchant' ), |
| 129 |
'content' => '', |
| 130 |
'desc' => esc_html__( 'Defines the final countdown end date, when the timer hits 00:00:00.', 'merchant' ), |
| 131 |
'class' => 'merchant-countdown-evergreen-content-field', |
| 132 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 133 |
), |
| 134 |
array( |
| 135 |
'id' => 'max_expiration_deadline_days', |
| 136 |
'type' => 'number', |
| 137 |
'title' => esc_html__( 'Days', 'merchant' ), |
| 138 |
'default' => 0, |
| 139 |
'min' => 0, |
| 140 |
'step' => 1, |
| 141 |
'placeholder' => esc_html__( 'Days', 'merchant' ), |
| 142 |
'class' => 'merchant-countdown-evergreen-field', |
| 143 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 144 |
), |
| 145 |
array( |
| 146 |
'id' => 'max_expiration_deadline', |
| 147 |
'type' => 'number', |
| 148 |
'title' => esc_html__( 'Hours', 'merchant' ), |
| 149 |
'default' => 26, |
| 150 |
'min' => 0, |
| 151 |
'step' => 1, |
| 152 |
'placeholder' => esc_html__( 'Hours', 'merchant' ), |
| 153 |
'class' => 'merchant-countdown-evergreen-field', |
| 154 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 155 |
), |
| 156 |
array( |
| 157 |
'id' => 'max_expiration_deadline_minutes', |
| 158 |
'type' => 'number', |
| 159 |
'title' => esc_html__( 'Minutes', 'merchant' ), |
| 160 |
'min' => 0, |
| 161 |
'step' => 1, |
| 162 |
'placeholder' => esc_html__( 'Minutes', 'merchant' ), |
| 163 |
'class' => 'merchant-countdown-evergreen-field', |
| 164 |
'condition' => array( 'end_date', '==', 'evergreen' ), |
| 165 |
), |
| 166 |
), |
| 167 |
), |
| 168 |
array( |
| 169 |
'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 170 |
'title' => esc_html__( 'Display Settings', 'merchant' ), |
| 171 |
'fields' => array( |
| 172 |
array( |
| 173 |
'id' => 'discount_products_only', |
| 174 |
'type' => 'switcher', |
| 175 |
'title' => esc_html__( 'Display on discounted products only', 'merchant' ), |
| 176 |
'desc' => esc_html__( 'Enable this to only show the countdown timer on discounted products.', 'merchant' ), |
| 177 |
'default' => true, |
| 178 |
), |
| 179 |
|
| 180 |
array( |
| 181 |
'id' => 'theme', |
| 182 |
'type' => 'image_picker', |
| 183 |
'title' => esc_html__( 'Select layout', 'merchant' ), |
| 184 |
'options' => array( |
| 185 |
'classic' => array( |
| 186 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/classic.png', |
| 187 |
'title' => esc_html__( 'Classic', 'merchant' ), |
| 188 |
), |
| 189 |
'progress' => array( |
| 190 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/progress.png', |
| 191 |
'title' => esc_html__( 'Progress bar', 'merchant' ), |
| 192 |
), |
| 193 |
'circles' => array( |
| 194 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/circles.png', |
| 195 |
'title' => esc_html__( 'Circles', 'merchant' ), |
| 196 |
), |
| 197 |
'squares' => array( |
| 198 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/squares.png', |
| 199 |
'title' => esc_html__( 'Squares', 'merchant' ), |
| 200 |
), |
| 201 |
'minimalist' => array( |
| 202 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/minimalist.png', |
| 203 |
'title' => esc_html__( 'Minimalist', 'merchant' ), |
| 204 |
), |
| 205 |
'cards' => array( |
| 206 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/cards.png', |
| 207 |
'title' => esc_html__( 'Cards', 'merchant' ), |
| 208 |
), |
| 209 |
'modern' => array( |
| 210 |
'image' => MERCHANT_URI . 'assets/images/icons/countdown-timer/admin/modern.png', |
| 211 |
'title' => esc_html__( 'modern', 'merchant' ), |
| 212 |
), |
| 213 |
), |
| 214 |
'default' => 'classic', |
| 215 |
), |
| 216 |
|
| 217 |
array( |
| 218 |
'id' => 'sale_ending_text', |
| 219 |
'type' => 'text', |
| 220 |
'title' => esc_html__( 'Sale ending message', 'merchant' ), |
| 221 |
'default' => esc_html__( 'Sale ends in', 'merchant' ), |
| 222 |
'desc' => esc_html__( 'The message that shows up above the countdown timer.', 'merchant' ), |
| 223 |
), |
| 224 |
|
| 225 |
array( |
| 226 |
'id' => 'sale_ending_alignment', |
| 227 |
'type' => 'select', |
| 228 |
'title' => esc_html__( 'Align', 'merchant' ), |
| 229 |
'options' => array( |
| 230 |
'left' => esc_html__( 'Left', 'merchant' ), |
| 231 |
'center' => esc_html__( 'Center', 'merchant' ), |
| 232 |
'right' => esc_html__( 'Right', 'merchant' ), |
| 233 |
), |
| 234 |
'default' => 'left', |
| 235 |
), |
| 236 |
), |
| 237 |
), |
| 238 |
array( |
| 239 |
'title' => esc_html__( 'Look and Feel', 'merchant' ), |
| 240 |
'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 241 |
'fields' => array( |
| 242 |
array( |
| 243 |
'id' => 'digits_font_size', |
| 244 |
'type' => 'range', |
| 245 |
'title' => esc_html__( 'Digits\' font size', 'merchant' ), |
| 246 |
'min' => 1, |
| 247 |
'max' => 100, |
| 248 |
'step' => 1, |
| 249 |
'default' => 16, |
| 250 |
'unit' => 'px', |
| 251 |
), |
| 252 |
|
| 253 |
array( |
| 254 |
'id' => 'labels_font_size', |
| 255 |
'type' => 'range', |
| 256 |
'title' => esc_html__( 'Label font size', 'merchant' ), |
| 257 |
'min' => 1, |
| 258 |
'max' => 100, |
| 259 |
'step' => 1, |
| 260 |
'default' => 16, |
| 261 |
'unit' => 'px', |
| 262 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 263 |
), |
| 264 |
|
| 265 |
array( |
| 266 |
'id' => 'icon_color', |
| 267 |
'type' => 'color', |
| 268 |
'title' => esc_html__( 'Icon color', 'merchant' ), |
| 269 |
'default' => '#626262', |
| 270 |
'condition' => array( 'theme', '=', 'classic' ), |
| 271 |
), |
| 272 |
|
| 273 |
array( |
| 274 |
'id' => 'sale_ending_color', |
| 275 |
'type' => 'color', |
| 276 |
'title' => esc_html__( 'Sale ending message text color', 'merchant' ), |
| 277 |
'default' => '#626262', |
| 278 |
'condition' => array( 'theme', 'any', 'classic|progress' ), |
| 279 |
), |
| 280 |
|
| 281 |
array( |
| 282 |
'id' => 'digits_color', |
| 283 |
'type' => 'color', |
| 284 |
'title' => esc_html__( 'Digits\' color', 'merchant' ), |
| 285 |
'default' => '#444444', |
| 286 |
), |
| 287 |
|
| 288 |
array( |
| 289 |
'id' => 'labels_color', |
| 290 |
'type' => 'color', |
| 291 |
'title' => esc_html__( 'Label color', 'merchant' ), |
| 292 |
'default' => '#444444', |
| 293 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 294 |
), |
| 295 |
|
| 296 |
array( |
| 297 |
'id' => 'digits_background', |
| 298 |
'type' => 'color', |
| 299 |
'title' => esc_html__( 'Digit background color', 'merchant' ), |
| 300 |
'default' => '#fff', |
| 301 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 302 |
), |
| 303 |
|
| 304 |
array( |
| 305 |
'id' => 'digits_border', |
| 306 |
'type' => 'color', |
| 307 |
'title' => esc_html__( 'Border color', 'merchant' ), |
| 308 |
'default' => '#444', |
| 309 |
'condition' => array( 'theme', 'any', 'squares|circles' ), |
| 310 |
), |
| 311 |
|
| 312 |
array( |
| 313 |
'id' => 'progress_color', |
| 314 |
'type' => 'color', |
| 315 |
'title' => esc_html__( 'Progress Bar color', 'merchant' ), |
| 316 |
'default' => '#3858E9', |
| 317 |
'condition' => array( 'theme', 'any', 'progress|circles' ), |
| 318 |
), |
| 319 |
|
| 320 |
array( |
| 321 |
'id' => 'digits_width', |
| 322 |
'type' => 'range', |
| 323 |
'title' => esc_html__( 'Width', 'merchant' ), |
| 324 |
'min' => 1, |
| 325 |
'max' => 250, |
| 326 |
'step' => 1, |
| 327 |
'default' => 80, |
| 328 |
'unit' => 'px', |
| 329 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 330 |
), |
| 331 |
|
| 332 |
array( |
| 333 |
'id' => 'digits_height', |
| 334 |
'type' => 'range', |
| 335 |
'title' => esc_html__( 'Height', 'merchant' ), |
| 336 |
'min' => 1, |
| 337 |
'max' => 250, |
| 338 |
'step' => 1, |
| 339 |
'default' => 80, |
| 340 |
'unit' => 'px', |
| 341 |
'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 342 |
), |
| 343 |
), |
| 344 |
), |
| 345 |
array( |
| 346 |
'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 347 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 348 |
'fields' => array( |
| 349 |
array( |
| 350 |
'id' => 'use_shortcode', |
| 351 |
'type' => 'switcher', |
| 352 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 353 |
'default' => 0, |
| 354 |
), |
| 355 |
array( |
| 356 |
'type' => 'info', |
| 357 |
'id' => 'shortcode_info', |
| 358 |
'content' => esc_html__( 'If you are using a page builder or a theme that supports shortcodes, then you can output the module using the shortcode above. This might be useful if, for example, you find that you want to control the position of the module output more precisely than with the module settings. Note that the shortcodes can only be used on single product pages.', 'merchant' ), |
| 359 |
), |
| 360 |
array( |
| 361 |
'id' => 'shortcode_text', |
| 362 |
'type' => 'text_readonly', |
| 363 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 364 |
'default' => '[merchant_module_' . str_replace( '-', '_', Merchant_Countdown_Timer::MODULE_ID ) . ']', |
| 365 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 366 |
), |
| 367 |
), |
| 368 |
), |
| 369 |
); |
| 370 |
|