| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Spending Goal Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
// Settings |
| 14 |
Merchant_Admin_Options::create( array( |
| 15 |
'title' => esc_html__( 'Settings', 'merchant' ), |
| 16 |
'module' => Merchant_Spending_Goal::MODULE_ID, |
| 17 |
'fields' => array( |
| 18 |
|
| 19 |
array( |
| 20 |
'id' => 'spending_goal', |
| 21 |
'type' => 'number', |
| 22 |
'title' => esc_html__( 'Spending goal', 'merchant' ), |
| 23 |
'default' => 150, |
| 24 |
), |
| 25 |
|
| 26 |
array( |
| 27 |
'id' => 'total_type', |
| 28 |
'type' => 'select', |
| 29 |
'title' => esc_html__( 'Based on', 'merchant' ), |
| 30 |
'desc' => esc_html__( 'To which the spending goal should be based on. "Cart Subtotal" does not include additional calculated discounts, whereas the "Cart Total" does.', |
| 31 |
'merchant' ), |
| 32 |
'options' => array( |
| 33 |
'subtotal' => esc_html__( 'Cart subtotal', 'merchant' ), |
| 34 |
'total' => esc_html__( 'Cart total', 'merchant' ), |
| 35 |
), |
| 36 |
'default' => 'subtotal', |
| 37 |
), |
| 38 |
|
| 39 |
array( |
| 40 |
'id' => 'discount_type', |
| 41 |
'type' => 'select', |
| 42 |
'title' => esc_html__( 'Discount type', 'merchant' ), |
| 43 |
'options' => array( |
| 44 |
'percent' => esc_html__( 'Percent', 'merchant' ), |
| 45 |
'fixed' => esc_html__( 'Fixed amount', 'merchant' ), |
| 46 |
), |
| 47 |
'default' => 'percent', |
| 48 |
), |
| 49 |
|
| 50 |
array( |
| 51 |
'id' => 'discount_amount', |
| 52 |
'type' => 'number', |
| 53 |
'title' => esc_html__( 'Discount amount', 'merchant' ), |
| 54 |
'default' => 10, |
| 55 |
), |
| 56 |
|
| 57 |
array( |
| 58 |
'id' => 'discount_name', |
| 59 |
'type' => 'text', |
| 60 |
'title' => esc_html__( 'Discount name', 'merchant' ), |
| 61 |
'default' => esc_html__( 'Spending goal', 'merchant' ), |
| 62 |
'desc' => esc_html__( 'This will be the name of the applied discount on the cart page.', 'merchant' ), |
| 63 |
), |
| 64 |
|
| 65 |
), |
| 66 |
|
| 67 |
) ); |
| 68 |
|
| 69 |
// Text Formatting Settings |
| 70 |
Merchant_Admin_Options::create( array( |
| 71 |
'title' => esc_html__( 'Text Formatting Settings', 'merchant' ), |
| 72 |
'module' => Merchant_Spending_Goal::MODULE_ID, |
| 73 |
'fields' => array( |
| 74 |
|
| 75 |
array( |
| 76 |
'id' => 'text_goal_zero', |
| 77 |
'type' => 'text', |
| 78 |
'title' => esc_html__( 'When the goal target is at 0%', 'merchant' ), |
| 79 |
'default' => esc_html__( 'Spend {spending_goal} to get a {discount_amount} discount!', 'merchant' ), |
| 80 |
'desc' => esc_html__( 'Default is: Spend {spending_goal} to get a {discount_amount} discount!', 'merchant' ), |
| 81 |
), |
| 82 |
|
| 83 |
array( |
| 84 |
'id' => 'text_goal_started', |
| 85 |
'type' => 'text', |
| 86 |
'title' => esc_html__( 'When the goal target is between 1-99%', 'merchant' ), |
| 87 |
'default' => esc_html__( 'Spend {spending_goal} more to get a {discount_amount} discount', 'merchant' ), |
| 88 |
'desc' => esc_html__( 'Default is: Spend {spending_goal} more to get a {discount_amount} discount', 'merchant' ), |
| 89 |
), |
| 90 |
|
| 91 |
array( |
| 92 |
'id' => 'text_goal_reached', |
| 93 |
'type' => 'text', |
| 94 |
'title' => esc_html__( 'When the goal target is at 100%', 'merchant' ), |
| 95 |
'default' => esc_html__( 'Congratulations! You get a discount of {discount_amount} on this order!', 'merchant' ), |
| 96 |
'desc' => esc_html__( 'Default: Congratulations! You get a discount of {discount_amount} on this order!', 'merchant' ), |
| 97 |
), |
| 98 |
), |
| 99 |
) ); |
| 100 |
|
| 101 |
// Style Settings |
| 102 |
Merchant_Admin_Options::create( array( |
| 103 |
'module' => Merchant_Spending_Goal::MODULE_ID, |
| 104 |
'title' => esc_html__( 'Style', 'merchant' ), |
| 105 |
'fields' => array( |
| 106 |
|
| 107 |
array( |
| 108 |
'id' => 'gradient_start', |
| 109 |
'type' => 'color', |
| 110 |
'title' => esc_html__( 'Gradient start', 'merchant' ), |
| 111 |
'default' => '#5e5e5e', |
| 112 |
), |
| 113 |
|
| 114 |
array( |
| 115 |
'id' => 'gradient_end', |
| 116 |
'type' => 'color', |
| 117 |
'title' => esc_html__( 'Gradient end', 'merchant' ), |
| 118 |
'default' => '#212121', |
| 119 |
), |
| 120 |
|
| 121 |
array( |
| 122 |
'id' => 'progress_bar', |
| 123 |
'type' => 'color', |
| 124 |
'title' => esc_html__( 'Progress bar color', 'merchant' ), |
| 125 |
'default' => '#d83a3b', |
| 126 |
), |
| 127 |
|
| 128 |
array( |
| 129 |
'id' => 'content_width', |
| 130 |
'type' => 'range', |
| 131 |
'title' => esc_html__( 'Content width', 'merchant' ), |
| 132 |
'min' => 0, |
| 133 |
'max' => 600, |
| 134 |
'step' => 1, |
| 135 |
'unit' => 'px', |
| 136 |
'default' => 300, |
| 137 |
), |
| 138 |
|
| 139 |
array( |
| 140 |
'id' => 'content_bg_color', |
| 141 |
'type' => 'color', |
| 142 |
'title' => esc_html__( 'Content background color', 'merchant' ), |
| 143 |
'default' => '#f9f9f9', |
| 144 |
), |
| 145 |
|
| 146 |
array( |
| 147 |
'id' => 'content_text_color', |
| 148 |
'type' => 'color', |
| 149 |
'title' => esc_html__( 'Content text color', 'merchant' ), |
| 150 |
'default' => '#3c434a', |
| 151 |
), |
| 152 |
), |
| 153 |
) ); |
| 154 |
|