| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Cart Reserved Timer Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
$before_fields = array(); |
| 14 |
if ( defined( 'MERCHANT_PRO_VERSION' ) && merchant_is_cart_block_layout() ) { |
| 15 |
$before_fields = array( |
| 16 |
'type' => 'warning', |
| 17 |
'content' => sprintf( |
| 18 |
/* Translators: 1. docs link */ |
| 19 |
__( 'Your cart page is being rendered through the new WooCommerce cart block. You must edit the cart page to use the classic cart shortcode instead. Check <a href="%1$s" target="_blank">this documentation</a> to learn more.', 'merchant' ), |
| 20 |
'https://docs.athemes.com/article/how-to-switch-cart-checkout-blocks-to-the-classic-shortcodes/' |
| 21 |
), |
| 22 |
); |
| 23 |
} |
| 24 |
|
| 25 |
// Variables |
| 26 |
$icon_path = MERCHANT_URI . 'assets/images/icons/' . Merchant_Cart_Reserved_timer::MODULE_ID; |
| 27 |
|
| 28 |
// Settings |
| 29 |
Merchant_Admin_Options::create( array( |
| 30 |
'title' => esc_html__( 'Settings', 'merchant' ), |
| 31 |
'module' => Merchant_Cart_Reserved_timer::MODULE_ID, |
| 32 |
'fields' => array( |
| 33 |
|
| 34 |
$before_fields, |
| 35 |
|
| 36 |
array( |
| 37 |
'id' => 'duration', |
| 38 |
'type' => 'number', |
| 39 |
'title' => esc_html__( 'Count down duration minutes', 'merchant' ), |
| 40 |
'default' => 10, |
| 41 |
), |
| 42 |
|
| 43 |
array( |
| 44 |
'id' => 'reserved_message', |
| 45 |
'type' => 'text', |
| 46 |
'title' => esc_html__( 'Cart reserved message', 'merchant' ), |
| 47 |
'default' => esc_html__( 'An item in your cart is in high demand.', 'merchant' ), |
| 48 |
), |
| 49 |
|
| 50 |
array( |
| 51 |
'id' => 'timer_message_minutes', |
| 52 |
'type' => 'text', |
| 53 |
'title' => esc_html__( 'Timer message for > 1 min ', 'merchant' ), |
| 54 |
'default' => esc_html__( 'Your cart is saved for {timer} minutes!', 'merchant' ), |
| 55 |
), |
| 56 |
|
| 57 |
array( |
| 58 |
'id' => 'timer_message_seconds', |
| 59 |
'type' => 'text', |
| 60 |
'title' => esc_html__( 'Timer message for < 1 min', 'merchant' ), |
| 61 |
'default' => esc_html__( 'Your cart is saved for {timer} seconds!', 'merchant' ), |
| 62 |
), |
| 63 |
|
| 64 |
array( |
| 65 |
'id' => 'time_expires', |
| 66 |
'type' => 'radio', |
| 67 |
'title' => esc_html__( 'What to do after the timer expires?', 'merchant' ), |
| 68 |
'options' => array( |
| 69 |
'hide-timer' => esc_html__( 'Hide timer', 'merchant' ), |
| 70 |
'clear-cart' => esc_html__( 'Clear cart', 'merchant' ), |
| 71 |
), |
| 72 |
'default' => 'clear-cart' |
| 73 |
), |
| 74 |
|
| 75 |
array( |
| 76 |
'id' => 'icon', |
| 77 |
'type' => 'choices', |
| 78 |
'title' => esc_html__( 'Choose an icon', 'merchant' ), |
| 79 |
'class' => 'merchant-module-page-setting-field-choices-icon', |
| 80 |
'options' => array( |
| 81 |
'none' => $icon_path . '/cancel.svg', |
| 82 |
'fire' => $icon_path . '/fire.svg', |
| 83 |
'clock' => $icon_path . '/clock.svg', |
| 84 |
'hour-glass' => $icon_path . '/hour-glass.svg', |
| 85 |
), |
| 86 |
'default' => 'fire' |
| 87 |
), |
| 88 |
|
| 89 |
array( |
| 90 |
'id' => 'background_color', |
| 91 |
'type' => 'color', |
| 92 |
'title' => esc_html__( 'Choose background Color', 'merchant' ), |
| 93 |
'default' => '#f4f6f8', |
| 94 |
), |
| 95 |
|
| 96 |
), |
| 97 |
) ); |
| 98 |
|
| 99 |
|