| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Volume Discounts Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
Merchant_Admin_Options::create( array( |
| 14 |
'title' => esc_html__( 'Settings', 'merchant' ), |
| 15 |
'module' => Merchant_Volume_Discounts::MODULE_ID, |
| 16 |
'fields' => array( |
| 17 |
array( |
| 18 |
'id' => 'single_product_placement', |
| 19 |
'type' => 'select', |
| 20 |
'title' => esc_html__( 'Placement on product page', 'merchant' ), |
| 21 |
'options' => array( |
| 22 |
'after-cart-form' => esc_html__( 'After add to cart form', 'merchant' ), |
| 23 |
'before-cart-form' => esc_html__( 'Before add to cart form', 'merchant' ), |
| 24 |
), |
| 25 |
'default' => 'before-cart-form', |
| 26 |
), |
| 27 |
), |
| 28 |
) ); |
| 29 |
|
| 30 |
Merchant_Admin_Options::create( array( |
| 31 |
'title' => esc_html__( 'Text Formatting Settings', 'merchant' ), |
| 32 |
'module' => Merchant_Volume_Discounts::MODULE_ID, |
| 33 |
'fields' => array( |
| 34 |
|
| 35 |
array( |
| 36 |
'id' => 'table_title', |
| 37 |
'type' => 'text', |
| 38 |
'title' => esc_html__( 'Title', 'merchant' ), |
| 39 |
'default' => __( 'Buy more, save more!', 'merchant' ), |
| 40 |
), |
| 41 |
|
| 42 |
array( |
| 43 |
'id' => 'save_label', |
| 44 |
'type' => 'text', |
| 45 |
'title' => esc_html__( 'Save label', 'merchant' ), |
| 46 |
'default' => esc_html__( 'Save {amount}', 'merchant' ), |
| 47 |
), |
| 48 |
|
| 49 |
array( |
| 50 |
'id' => 'buy_text', |
| 51 |
'type' => 'text', |
| 52 |
'title' => esc_html__( 'Buy text', 'merchant' ), |
| 53 |
'default' => esc_html__( 'Buy {amount}, get {discount} off each', 'merchant' ), |
| 54 |
), |
| 55 |
|
| 56 |
array( |
| 57 |
'id' => 'item_text', |
| 58 |
'type' => 'text', |
| 59 |
'title' => esc_html__( 'Item text', 'merchant' ), |
| 60 |
'default' => esc_html__( 'Per item:', 'merchant' ), |
| 61 |
), |
| 62 |
|
| 63 |
array( |
| 64 |
'id' => 'total_text', |
| 65 |
'type' => 'text', |
| 66 |
'title' => esc_html__( 'Total text', 'merchant' ), |
| 67 |
'default' => esc_html__( 'Total price:', 'merchant' ), |
| 68 |
), |
| 69 |
|
| 70 |
array( |
| 71 |
'id' => 'cart_title_text', |
| 72 |
'type' => 'text', |
| 73 |
'title' => esc_html__( 'Cart item discount title', 'merchant' ), |
| 74 |
'default' => esc_html__( 'Discount', 'merchant' ), |
| 75 |
'desc' => esc_html__( 'This is displayed on the cart page.', 'merchant' ), |
| 76 |
), |
| 77 |
|
| 78 |
array( |
| 79 |
'id' => 'cart_description_text', |
| 80 |
'type' => 'text', |
| 81 |
'title' => esc_html__( 'Cart item discount description', 'merchant' ), |
| 82 |
'default' => esc_html__( 'A discount of {amount} has been applied.', 'merchant' ), |
| 83 |
'desc' => esc_html__( 'This is displayed on the cart page.', 'merchant' ), |
| 84 |
), |
| 85 |
), |
| 86 |
) ); |
| 87 |
|
| 88 |
|
| 89 |
Merchant_Admin_Options::create( array( |
| 90 |
'title' => esc_html__( 'Style Settings', 'merchant' ), |
| 91 |
'module' => Merchant_Volume_Discounts::MODULE_ID, |
| 92 |
'fields' => array( |
| 93 |
|
| 94 |
array( |
| 95 |
'id' => 'title_font_weight', |
| 96 |
'type' => 'select', |
| 97 |
'title' => esc_html__( 'Title font weight', 'merchant' ), |
| 98 |
'options' => array( |
| 99 |
'lighter' => esc_html__( 'Light', 'merchant' ), |
| 100 |
'normal' => esc_html__( 'Normal', 'merchant' ), |
| 101 |
'bold' => esc_html__( 'Bold', 'merchant' ), |
| 102 |
), |
| 103 |
'default' => 'normal', |
| 104 |
), |
| 105 |
|
| 106 |
array( |
| 107 |
'id' => 'title_font_size', |
| 108 |
'type' => 'range', |
| 109 |
'title' => esc_html__( 'Title font size', 'merchant' ), |
| 110 |
'min' => 0, |
| 111 |
'max' => 100, |
| 112 |
'step' => 1, |
| 113 |
'unit' => 'px', |
| 114 |
'default' => 16, |
| 115 |
), |
| 116 |
|
| 117 |
array( |
| 118 |
'id' => 'title_text_color', |
| 119 |
'type' => 'color', |
| 120 |
'title' => esc_html__( 'Title text color', 'merchant' ), |
| 121 |
'default' => '#212121', |
| 122 |
), |
| 123 |
|
| 124 |
|
| 125 |
array( |
| 126 |
'id' => 'table_item_bg_color', |
| 127 |
'type' => 'color', |
| 128 |
'title' => esc_html__( 'Choose background color', 'merchant' ), |
| 129 |
'default' => '#fcf0f1', |
| 130 |
), |
| 131 |
|
| 132 |
array( |
| 133 |
'id' => 'table_item_border_color', |
| 134 |
'type' => 'color', |
| 135 |
'title' => esc_html__( 'Choose border color', 'merchant' ), |
| 136 |
'default' => '#d83b3b', |
| 137 |
), |
| 138 |
|
| 139 |
array( |
| 140 |
'id' => 'table_item_text_color', |
| 141 |
'type' => 'color', |
| 142 |
'title' => esc_html__( 'Choose text color', 'merchant' ), |
| 143 |
'default' => '#3c434a', |
| 144 |
), |
| 145 |
|
| 146 |
array( |
| 147 |
'id' => 'table_label_bg_color', |
| 148 |
'type' => 'color', |
| 149 |
'title' => esc_html__( 'Choose label background color', 'merchant' ), |
| 150 |
'default' => '#d83b3b', |
| 151 |
), |
| 152 |
|
| 153 |
array( |
| 154 |
'id' => 'table_label_text_color', |
| 155 |
'type' => 'color', |
| 156 |
'title' => esc_html__( 'Choose label text color', 'merchant' ), |
| 157 |
'default' => '#ffffff', |
| 158 |
), |
| 159 |
|
| 160 |
), |
| 161 |
) ); |
| 162 |
|
| 163 |
// Shortcode |
| 164 |
$merchant_module_id = Merchant_Volume_Discounts::MODULE_ID; |
| 165 |
Merchant_Admin_Options::create( array( |
| 166 |
'module' => $merchant_module_id, |
| 167 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 168 |
'fields' => array( |
| 169 |
array( |
| 170 |
'id' => 'use_shortcode', |
| 171 |
'type' => 'switcher', |
| 172 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 173 |
'default' => 0, |
| 174 |
'desc' => 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.', |
| 175 |
'merchant' ), |
| 176 |
), |
| 177 |
array( |
| 178 |
'id' => 'shortcode_text', |
| 179 |
'type' => 'text_readonly', |
| 180 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 181 |
'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', |
| 182 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 183 |
), |
| 184 |
), |
| 185 |
) ); |
| 186 |
|