| @@ -10,19 +10,24 @@ | ||
| 10 | 10 | exit; // Exit if accessed directly |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // Settings |
| 14 | -Merchant_Admin_Options::create( array( | |
| 14 | + | |
| 15 | +return array( | |
| 16 | + array( | |
| 15 | 17 | 'title' => esc_html__( 'Settings', 'merchant' ), |
| 16 | 18 | 'module' => Merchant_Size_Chart::MODULE_ID, |
| 17 | 19 | 'fields' => array( |
| 18 | 20 | |
| 19 | 21 | array( |
| 20 | - 'id' => 'global_size_chart', | |
| 21 | - 'type' => 'select_size_chart', | |
| 22 | - 'title' => esc_html__( 'Global size chart (optional)', 'merchant' ), | |
| 22 | + 'id' => 'global_size_chart', | |
| 23 | + 'type' => 'select_size_chart', | |
| 24 | + 'title' => esc_html__( 'Global size chart (optional)', 'merchant' ), | |
| 23 | 25 | /* Translators: 1. Link open tag 2. Link close tag */ |
| 24 | - 'desc' => sprintf( esc_html__( 'Your size charts will appear in this option as you create them. %1$sClick here%2$s to create or modify the available size charts.', 'merchant' ), '<a href="'. esc_url( admin_url( 'edit.php?post_type=merchant_size_chart' ) ) .'">', '</a>' ), | |
| 26 | + 'desc' => sprintf( esc_html__( 'Your size charts will appear in this option as you create them. %1$sClick here%2$s to create or modify the available size charts.', 'merchant' ), '<a href="'. esc_url( admin_url( 'edit.php?post_type=merchant_size_chart' ) ) .'">', '</a>' ), | |
| 27 | + 'ai_meta' => array( | |
| 28 | + 'usage_hint' => 'Selects the fallback size chart shown on all products. Overridden by per-product size chart assignments. Leave empty to show no global chart.', | |
| 29 | + ), | |
| 25 | 30 | ), |
| 26 | 31 | |
| 27 | 32 | array( |
| 28 | 33 | 'id' => 'global_size_chart_categories', |
| @@ -32,8 +37,16 @@ | ||
| 32 | 37 | 'multiple' => true, |
| 33 | 38 | 'options' => Merchant_Admin_Options::get_category_select2_choices(), |
| 34 | 39 | 'placeholder' => esc_html__( 'Select categories', 'merchant' ), |
| 35 | 40 | 'desc' => esc_html__( 'The global size chart will appear only on products within the selected categories. If no categories are selected, the size chart will be displayed on all products.', 'merchant' ), |
| 41 | + 'ai_meta' => array( | |
| 42 | + 'entity' => 'category', | |
| 43 | + 'reference_type' => 'dynamic', | |
| 44 | + 'taxonomy' => 'product_cat', | |
| 45 | + 'value_format' => 'slug', | |
| 46 | + 'abstraction_level' => 3, | |
| 47 | + 'usage_hint' => 'Limits the global size chart to products in these categories. Dynamic: future products added to the category are included. Leave empty to apply to all products.', | |
| 48 | + ), | |
| 36 | 49 | ), |
| 37 | 50 | |
| 38 | 51 | array( |
| 39 | 52 | 'id' => 'text', |
| @@ -94,12 +107,43 @@ | ||
| 94 | 107 | 'title' => esc_html__( 'Icon color hover', 'merchant' ), |
| 95 | 108 | ), |
| 96 | 109 | |
| 97 | 110 | ), |
| 98 | -) ); | |
| 111 | +), | |
| 112 | + array( | |
| 113 | + 'title' => esc_html__( 'Display position', 'merchant' ), | |
| 114 | + 'module' => Merchant_Size_Chart::MODULE_ID, | |
| 115 | + 'fields' => array( | |
| 99 | 116 | |
| 100 | -// Design | |
| 101 | -Merchant_Admin_Options::create( array( | |
| 117 | + array( | |
| 118 | + 'id' => 'display_hook', | |
| 119 | + 'type' => 'hook_select', | |
| 120 | + 'title' => esc_html__( 'Loading position and priority on single product', 'merchant' ), | |
| 121 | + 'desc' => esc_html__( 'Where the button renders on the single product page. A lower priority number moves it higher. The add to cart positions only exist while a product is purchasable and in stock.', 'merchant' ), | |
| 122 | + 'options' => array( | |
| 123 | + '' => esc_html__( 'Default', 'merchant' ), | |
| 124 | + 'woocommerce_single_product_summary' => esc_html__( 'After Product summary', 'merchant' ), | |
| 125 | + 'woocommerce_before_add_to_cart_form' => esc_html__( 'Before add to cart form', 'merchant' ), | |
| 126 | + 'woocommerce_after_add_to_cart_form' => esc_html__( 'After add to cart form', 'merchant' ), | |
| 127 | + 'woocommerce_before_add_to_cart_button' => esc_html__( 'Before add to cart button', 'merchant' ), | |
| 128 | + 'woocommerce_after_add_to_cart_button' => esc_html__( 'After add to cart button', 'merchant' ), | |
| 129 | + ), | |
| 130 | + 'min' => 1, | |
| 131 | + 'max' => 999, | |
| 132 | + 'step' => 1, | |
| 133 | + 'unit' => '', | |
| 134 | + 'order' => true, | |
| 135 | + 'default' => array( | |
| 136 | + 'hook_name' => '', | |
| 137 | + 'hook_priority' => 10, | |
| 138 | + ), | |
| 139 | + 'ai_meta' => array( | |
| 140 | + 'usage_hint' => 'Controls where the size chart button renders on the single product page. Leave hook_name empty to keep the default placement: inside the variation block for variable products, next to the add to cart button otherwise. Valid hook_name values are an empty string, woocommerce_single_product_summary, woocommerce_before_add_to_cart_form, woocommerce_after_add_to_cart_form, woocommerce_before_add_to_cart_button, woocommerce_after_add_to_cart_button. A lower hook_priority renders the button higher on the page.', | |
| 141 | + ), | |
| 142 | + ), | |
| 143 | + ), | |
| 144 | +), | |
| 145 | + array( | |
| 102 | 146 | 'title' => esc_html__( 'Popup Design', 'merchant' ), |
| 103 | 147 | 'module' => Merchant_Size_Chart::MODULE_ID, |
| 104 | 148 | 'fields' => array( |
| 105 | 149 | |
| @@ -205,14 +249,11 @@ | ||
| 205 | 249 | 'default' => '#757575', |
| 206 | 250 | ), |
| 207 | 251 | |
| 208 | 252 | ), |
| 209 | -) ); | |
| 210 | - | |
| 211 | -// Shortcode | |
| 212 | -$merchant_module_id = Merchant_Size_Chart::MODULE_ID; | |
| 213 | -Merchant_Admin_Options::create( array( | |
| 214 | - 'module' => $merchant_module_id, | |
| 253 | +), | |
| 254 | + array( | |
| 255 | + 'module' => Merchant_Size_Chart::MODULE_ID, | |
| 215 | 256 | 'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 216 | 257 | 'fields' => array( |
| 217 | 258 | array( |
| 218 | 259 | 'id' => 'use_shortcode', |
| @@ -228,9 +269,10 @@ | ||
| 228 | 269 | array( |
| 229 | 270 | 'id' => 'shortcode_text', |
| 230 | 271 | 'type' => 'text_readonly', |
| 231 | 272 | 'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 232 | - 'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', | |
| 273 | + 'default' => '[merchant_module_' . str_replace( '-', '_', Merchant_Size_Chart::MODULE_ID ) . ']', | |
| 233 | 274 | 'condition' => array( 'use_shortcode', '==', '1' ), |
| 234 | 275 | ), |
| 235 | 276 | ), |
| 236 | -) ); | |
| 277 | +), | |
| 278 | +); | |