| @@ -12,9 +12,11 @@ | ||
| 12 | 12 | /** |
| 13 | 13 | * Settings. |
| 14 | 14 | * |
| 15 | 15 | */ |
| 16 | -Merchant_Admin_Options::create( array( | |
| 16 | + | |
| 17 | +return array( | |
| 18 | + array( | |
| 17 | 19 | 'title' => esc_html__( 'Settings', 'merchant' ), |
| 18 | 20 | 'module' => 'quick-view', |
| 19 | 21 | 'fields' => array( |
| 20 | 22 | |
| @@ -27,8 +29,11 @@ | ||
| 27 | 29 | 'icon' => esc_html__( 'Icon', 'merchant' ), |
| 28 | 30 | 'icon-text' => esc_html__( 'Icon + text', 'merchant' ), |
| 29 | 31 | ), |
| 30 | 32 | 'default' => 'text', |
| 33 | + 'ai_meta' => array( | |
| 34 | + 'usage_hint' => 'Controls the quick view button appearance. Set to text, icon, or icon-text. This value gates button_text (text|icon-text) and button_icon (icon|icon-text) fields.', | |
| 35 | + ), | |
| 31 | 36 | ), |
| 32 | 37 | |
| 33 | 38 | array( |
| 34 | 39 | 'id' => 'button_text', |
| @@ -59,8 +64,11 @@ | ||
| 59 | 64 | 'after' => esc_html__( 'After - Add to cart', 'merchant' ), |
| 60 | 65 | 'overlay' => esc_html__( 'Overlay', 'merchant' ), |
| 61 | 66 | ), |
| 62 | 67 | 'default' => 'overlay', |
| 68 | + 'ai_meta' => array( | |
| 69 | + 'usage_hint' => 'Where the quick view button appears on the product card. Set to overlay to float over the image (enables position-top/left controls and mobile_position). Before/after place it relative to the add-to-cart button.', | |
| 70 | + ), | |
| 63 | 71 | ), |
| 64 | 72 | |
| 65 | 73 | array( |
| 66 | 74 | 'id' => 'button-position-top', |
| @@ -65,9 +73,9 @@ | ||
| 65 | 73 | array( |
| 66 | 74 | 'id' => 'button-position-top', |
| 67 | 75 | 'type' => 'range', |
| 68 | 76 | 'title' => esc_html__( 'Button position top', 'merchant' ), |
| 69 | - 'min' => 1, | |
| 77 | + 'min' => 0, | |
| 70 | 78 | 'max' => 100, |
| 71 | 79 | 'step' => 1, |
| 72 | 80 | 'default' => 50, |
| 73 | 81 | 'unit' => '%', |
| @@ -77,9 +85,9 @@ | ||
| 77 | 85 | array( |
| 78 | 86 | 'id' => 'button-position-left', |
| 79 | 87 | 'type' => 'range', |
| 80 | 88 | 'title' => esc_html__( 'Button position left', 'merchant' ), |
| 81 | - 'min' => 1, | |
| 89 | + 'min' => 0, | |
| 82 | 90 | 'max' => 100, |
| 83 | 91 | 'step' => 1, |
| 84 | 92 | 'default' => 50, |
| 85 | 93 | 'unit' => '%', |
| @@ -86,8 +94,72 @@ | ||
| 86 | 94 | 'condition' => array( 'button_position', '==', 'overlay' ), |
| 87 | 95 | ), |
| 88 | 96 | |
| 89 | 97 | array( |
| 98 | + 'id' => 'mobile_position', | |
| 99 | + 'type' => 'checkbox', | |
| 100 | + 'label' => esc_html__( 'Mobile position', 'merchant' ), | |
| 101 | + 'default' => 0, | |
| 102 | + 'condition' => array( 'button_position', '==', 'overlay' ), | |
| 103 | + 'ai_meta' => array( | |
| 104 | + 'toggle_for' => 'button-position-top-mobile', | |
| 105 | + 'usage_hint' => 'Enable to set a separate overlay position for mobile. Gates button-position-top-mobile and button-position-left-mobile. Only available when button_position=overlay.', | |
| 106 | + ), | |
| 107 | + ), | |
| 108 | + | |
| 109 | + array( | |
| 110 | + 'id' => 'button-position-top-mobile', | |
| 111 | + 'type' => 'range', | |
| 112 | + 'title' => esc_html__( 'Button position top', 'merchant' ), | |
| 113 | + 'min' => 0, | |
| 114 | + 'max' => 100, | |
| 115 | + 'step' => 1, | |
| 116 | + 'default' => 50, | |
| 117 | + 'unit' => '%', | |
| 118 | + 'conditions' => array( | |
| 119 | + 'relation' => 'AND', | |
| 120 | + 'terms' => array( | |
| 121 | + array( | |
| 122 | + 'field' => 'button_position', | |
| 123 | + 'operator' => '===', | |
| 124 | + 'value' => 'overlay', | |
| 125 | + ), | |
| 126 | + array( | |
| 127 | + 'field' => 'mobile_position', | |
| 128 | + 'operator' => '===', | |
| 129 | + 'value' => true, | |
| 130 | + ), | |
| 131 | + ), | |
| 132 | + ), | |
| 133 | + ), | |
| 134 | + | |
| 135 | + array( | |
| 136 | + 'id' => 'button-position-left-mobile', | |
| 137 | + 'type' => 'range', | |
| 138 | + 'title' => esc_html__( 'Button position left', 'merchant' ), | |
| 139 | + 'min' => 0, | |
| 140 | + 'max' => 100, | |
| 141 | + 'step' => 1, | |
| 142 | + 'default' => 50, | |
| 143 | + 'unit' => '%', | |
| 144 | + 'conditions' => array( | |
| 145 | + 'relation' => 'AND', | |
| 146 | + 'terms' => array( | |
| 147 | + array( | |
| 148 | + 'field' => 'button_position', | |
| 149 | + 'operator' => '===', | |
| 150 | + 'value' => 'overlay', | |
| 151 | + ), | |
| 152 | + array( | |
| 153 | + 'field' => 'mobile_position', | |
| 154 | + 'operator' => '===', | |
| 155 | + 'value' => true, | |
| 156 | + ), | |
| 157 | + ), | |
| 158 | + ), | |
| 159 | + ), | |
| 160 | + | |
| 161 | + array( | |
| 90 | 162 | 'id' => 'icon-color', |
| 91 | 163 | 'type' => 'color', |
| 92 | 164 | 'title' => esc_html__( 'Icon color', 'merchant' ), |
| 93 | 165 | 'default' => '#ffffff', |
| @@ -146,45 +218,104 @@ | ||
| 146 | 218 | 'default' => '#414141', |
| 147 | 219 | ), |
| 148 | 220 | |
| 149 | 221 | ), |
| 150 | -) ); | |
| 151 | - | |
| 152 | - | |
| 153 | -/** | |
| 154 | - * Modal. | |
| 155 | - * | |
| 156 | - */ | |
| 157 | -Merchant_Admin_Options::create( array( | |
| 222 | +), | |
| 223 | + array( | |
| 158 | 224 | 'title' => esc_html__( 'Modal', 'merchant' ), |
| 159 | 225 | 'module' => 'quick-view', |
| 160 | 226 | 'fields' => array( |
| 161 | 227 | array( |
| 162 | - 'id' => 'modal_width', | |
| 163 | - 'type' => 'range', | |
| 164 | - 'title' => esc_html__( 'Modal width', 'merchant' ), | |
| 165 | - 'min' => 1, | |
| 166 | - 'max' => 2000, | |
| 167 | - 'step' => 1, | |
| 168 | - 'default' => 1000, | |
| 169 | - 'unit' => 'px', | |
| 228 | + 'id' => 'modal_layout', | |
| 229 | + 'type' => 'radio', | |
| 230 | + 'title' => esc_html__( 'Modal layout', 'merchant' ), | |
| 231 | + 'options' => array( | |
| 232 | + 'modal' => esc_html__( 'Centered modal', 'merchant' ), | |
| 233 | + 'side-panel' => esc_html__( 'Side panel', 'merchant' ), | |
| 234 | + ), | |
| 235 | + 'default' => 'modal', | |
| 170 | 236 | ), |
| 171 | 237 | |
| 172 | 238 | array( |
| 173 | - 'id' => 'modal_height', | |
| 174 | - 'type' => 'range', | |
| 175 | - 'title' => esc_html__( 'Modal height', 'merchant' ), | |
| 176 | - 'min' => 1, | |
| 177 | - 'max' => 2000, | |
| 178 | - 'step' => 1, | |
| 179 | - 'default' => 500, | |
| 180 | - 'unit' => 'px', | |
| 239 | + 'id' => 'show_navigation_arrows', | |
| 240 | + 'type' => 'switcher', | |
| 241 | + 'title' => esc_html__( 'Show next/previous navigation arrows', 'merchant' ), | |
| 242 | + 'default' => 0, | |
| 181 | 243 | ), |
| 182 | 244 | |
| 183 | 245 | array( |
| 246 | + 'id' => 'sync_url_hash', | |
| 247 | + 'type' => 'switcher', | |
| 248 | + 'title' => esc_html__( 'Update browser URL when quick view opens', 'merchant' ), | |
| 249 | + 'default' => 0, | |
| 250 | + ), | |
| 251 | + | |
| 252 | + array( | |
| 253 | + 'id' => 'modal_width', | |
| 254 | + 'type' => 'range', | |
| 255 | + 'title' => esc_html__( 'Modal width', 'merchant' ), | |
| 256 | + 'desc' => esc_html__( 'Default: 1000 pixels', 'merchant' ), | |
| 257 | + 'min' => 1, | |
| 258 | + 'max' => 2000, | |
| 259 | + 'step' => 1, | |
| 260 | + 'default' => 1000, | |
| 261 | + 'unit' => 'px', | |
| 262 | + 'conditions' => array( | |
| 263 | + 'terms' => array( | |
| 264 | + array( | |
| 265 | + 'field' => 'modal_layout', | |
| 266 | + 'operator' => '===', | |
| 267 | + 'value' => 'modal', | |
| 268 | + ), | |
| 269 | + ), | |
| 270 | + ), | |
| 271 | + ), | |
| 272 | + | |
| 273 | + array( | |
| 274 | + 'id' => 'modal_height', | |
| 275 | + 'type' => 'range', | |
| 276 | + 'title' => esc_html__( 'Modal height', 'merchant' ), | |
| 277 | + 'min' => 1, | |
| 278 | + 'max' => 2000, | |
| 279 | + 'step' => 1, | |
| 280 | + 'default' => 500, | |
| 281 | + 'unit' => 'px', | |
| 282 | + 'conditions' => array( | |
| 283 | + 'terms' => array( | |
| 284 | + array( | |
| 285 | + 'field' => 'modal_layout', | |
| 286 | + 'operator' => '===', | |
| 287 | + 'value' => 'modal', | |
| 288 | + ), | |
| 289 | + ), | |
| 290 | + ), | |
| 291 | + ), | |
| 292 | + | |
| 293 | + array( | |
| 294 | + 'id' => 'side_panel_width', | |
| 295 | + 'type' => 'range', | |
| 296 | + 'title' => esc_html__( 'Side panel width', 'merchant' ), | |
| 297 | + 'desc' => esc_html__( 'Default: 420 pixels', 'merchant' ), | |
| 298 | + 'min' => 280, | |
| 299 | + 'max' => 800, | |
| 300 | + 'step' => 1, | |
| 301 | + 'default' => 420, | |
| 302 | + 'unit' => 'px', | |
| 303 | + 'conditions' => array( | |
| 304 | + 'terms' => array( | |
| 305 | + array( | |
| 306 | + 'field' => 'modal_layout', | |
| 307 | + 'operator' => '===', | |
| 308 | + 'value' => 'side-panel', | |
| 309 | + ), | |
| 310 | + ), | |
| 311 | + ), | |
| 312 | + ), | |
| 313 | + | |
| 314 | + array( | |
| 184 | 315 | 'id' => 'place_product_image', |
| 185 | 316 | 'type' => 'radio', |
| 186 | - 'title' => esc_html__( 'Place product image', 'merchant' ), | |
| 317 | + 'title' => esc_html__( 'Product gallery image placement', 'merchant' ), | |
| 187 | 318 | 'options' => array( |
| 188 | 319 | 'thumbs-at-left' => esc_html__( 'Thumbs at left', 'merchant' ), |
| 189 | 320 | 'thumbs-at-right' => esc_html__( 'Thumbs at right', 'merchant' ), |
| 190 | 321 | 'thumbs-at-bottom' => esc_html__( 'Thumbs at bottom', 'merchant' ), |
| @@ -201,9 +332,9 @@ | ||
| 201 | 332 | |
| 202 | 333 | array( |
| 203 | 334 | 'id' => 'place_product_description', |
| 204 | 335 | 'type' => 'radio', |
| 205 | - 'title' => esc_html__( 'Place product description', 'merchant' ), | |
| 336 | + 'title' => esc_html__( 'Product description placement', 'merchant' ), | |
| 206 | 337 | 'options' => array( |
| 207 | 338 | 'top' => esc_html__( 'Top', 'merchant' ), |
| 208 | 339 | 'bottom' => esc_html__( 'Bottom', 'merchant' ), |
| 209 | 340 | ), |
| @@ -242,15 +373,24 @@ | ||
| 242 | 373 | 'button_text' => esc_html__( 'View Buy Now', 'merchant' ), |
| 243 | 374 | 'button_link' => esc_url( admin_url( 'admin.php?page=merchant&module=buy-now' ) ), |
| 244 | 375 | 'condition' => array( 'show_buy_now_button', '==', '1' ), |
| 245 | 376 | ), |
| 246 | - | |
| 247 | 377 | array( |
| 378 | + 'id' => 'ajax_add_to_cart', | |
| 379 | + 'type' => 'switcher', | |
| 380 | + 'title' => esc_html__( 'Ajax add to cart', 'merchant' ), | |
| 381 | + 'default' => 0, | |
| 382 | + ), | |
| 383 | + array( | |
| 248 | 384 | 'id' => 'show_suggested_products', |
| 249 | 385 | 'pro' => true, // Merchant Pro dependent |
| 250 | 386 | 'type' => 'switcher', |
| 251 | 387 | 'title' => esc_html__( 'Show suggested products', 'merchant' ), |
| 252 | 388 | 'default' => 1, |
| 389 | + 'ai_meta' => array( | |
| 390 | + 'toggle_for' => 'suggested_products_module', | |
| 391 | + 'usage_hint' => 'Enable to display upsell/cross-sell products inside the quick view modal. Gates suggested_products_module and suggested_products_placement fields. Requires Merchant Pro.', | |
| 392 | + ), | |
| 253 | 393 | ), |
| 254 | 394 | array( |
| 255 | 395 | 'id' => 'suggested_products_module', |
| 256 | 396 | 'pro' => true, |
| @@ -269,8 +409,12 @@ | ||
| 269 | 409 | 'value' => true, |
| 270 | 410 | ), |
| 271 | 411 | ), |
| 272 | 412 | ), |
| 413 | + 'ai_meta' => array( | |
| 414 | + 'toggled_by' => 'show_suggested_products', | |
| 415 | + 'usage_hint' => 'Which Merchant module provides the suggested products shown inside quick view. Requires show_suggested_products=true and the chosen module to be active.', | |
| 416 | + ), | |
| 273 | 417 | ), |
| 274 | 418 | array( |
| 275 | 419 | 'id' => 'suggested_products_instructions_bulk_discounts', |
| 276 | 420 | 'pro' => true, |
| @@ -375,5 +519,30 @@ | ||
| 375 | 519 | 'default' => '#999999', |
| 376 | 520 | ), |
| 377 | 521 | |
| 378 | 522 | ), |
| 379 | -) ); | |
| 523 | +), | |
| 524 | + array( | |
| 525 | + 'module' => Merchant_Quick_View::MODULE_ID, | |
| 526 | + 'title' => esc_html__( 'Use shortcode', 'merchant' ), | |
| 527 | + 'fields' => array( | |
| 528 | + array( | |
| 529 | + 'id' => 'use_shortcode', | |
| 530 | + 'type' => 'switcher', | |
| 531 | + 'title' => esc_html__( 'Use shortcode', 'merchant' ), | |
| 532 | + 'default' => 0, | |
| 533 | + ), | |
| 534 | + array( | |
| 535 | + 'type' => 'info', | |
| 536 | + 'id' => 'shortcode_info', | |
| 537 | + '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.', 'merchant' ), | |
| 538 | + ), | |
| 539 | + array( | |
| 540 | + 'id' => 'shortcode_text', | |
| 541 | + 'type' => 'text_readonly', | |
| 542 | + 'title' => esc_html__( 'Shortcode text', 'merchant' ), | |
| 543 | + 'default' => '[merchant_module_' . str_replace( '-', '_', Merchant_Quick_View::MODULE_ID ) . ']', | |
| 544 | + 'condition' => array( 'use_shortcode', '==', '1' ), | |
| 545 | + ), | |
| 546 | + ), | |
| 547 | +), | |
| 548 | +); | |