| @@ -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,46 +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( |
| 227 | + array( | |
| 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', | |
| 236 | + ), | |
| 161 | 237 | |
| 162 | 238 | array( |
| 163 | - 'id' => 'modal_width', | |
| 164 | - 'type' => 'range', | |
| 165 | - 'title' => esc_html__( 'Modal width', 'merchant' ), | |
| 166 | - 'min' => 1, | |
| 167 | - 'max' => 2000, | |
| 168 | - 'step' => 1, | |
| 169 | - 'default' => 1000, | |
| 170 | - 'unit' => 'px', | |
| 239 | + 'id' => 'show_navigation_arrows', | |
| 240 | + 'type' => 'switcher', | |
| 241 | + 'title' => esc_html__( 'Show next/previous navigation arrows', 'merchant' ), | |
| 242 | + 'default' => 0, | |
| 171 | 243 | ), |
| 172 | 244 | |
| 173 | 245 | array( |
| 174 | - 'id' => 'modal_height', | |
| 175 | - 'type' => 'range', | |
| 176 | - 'title' => esc_html__( 'Modal height', 'merchant' ), | |
| 177 | - 'min' => 1, | |
| 178 | - 'max' => 2000, | |
| 179 | - 'step' => 1, | |
| 180 | - 'default' => 500, | |
| 181 | - 'unit' => 'px', | |
| 246 | + 'id' => 'sync_url_hash', | |
| 247 | + 'type' => 'switcher', | |
| 248 | + 'title' => esc_html__( 'Update browser URL when quick view opens', 'merchant' ), | |
| 249 | + 'default' => 0, | |
| 182 | 250 | ), |
| 183 | 251 | |
| 184 | 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( | |
| 185 | 315 | 'id' => 'place_product_image', |
| 186 | 316 | 'type' => 'radio', |
| 187 | - 'title' => esc_html__( 'Place product image', 'merchant' ), | |
| 317 | + 'title' => esc_html__( 'Product gallery image placement', 'merchant' ), | |
| 188 | 318 | 'options' => array( |
| 189 | 319 | 'thumbs-at-left' => esc_html__( 'Thumbs at left', 'merchant' ), |
| 190 | 320 | 'thumbs-at-right' => esc_html__( 'Thumbs at right', 'merchant' ), |
| 191 | 321 | 'thumbs-at-bottom' => esc_html__( 'Thumbs at bottom', 'merchant' ), |
| @@ -202,9 +332,9 @@ | ||
| 202 | 332 | |
| 203 | 333 | array( |
| 204 | 334 | 'id' => 'place_product_description', |
| 205 | 335 | 'type' => 'radio', |
| 206 | - 'title' => esc_html__( 'Place product description', 'merchant' ), | |
| 336 | + 'title' => esc_html__( 'Product description placement', 'merchant' ), | |
| 207 | 337 | 'options' => array( |
| 208 | 338 | 'top' => esc_html__( 'Top', 'merchant' ), |
| 209 | 339 | 'bottom' => esc_html__( 'Bottom', 'merchant' ), |
| 210 | 340 | ), |
| @@ -229,8 +359,154 @@ | ||
| 229 | 359 | 'default' => 1, |
| 230 | 360 | ), |
| 231 | 361 | |
| 232 | 362 | array( |
| 363 | + 'id' => 'show_buy_now_button', | |
| 364 | + 'type' => 'switcher', | |
| 365 | + 'title' => esc_html__( 'Show buy now button', 'merchant' ), | |
| 366 | + 'default' => 0, | |
| 367 | + ), | |
| 368 | + | |
| 369 | + array( | |
| 370 | + 'id' => 'show_buy_now_button_instructions', | |
| 371 | + 'type' => 'info_block', | |
| 372 | + 'description' => esc_html__( 'You can display a Buy Now button by using Merchant’s Buy Now module.', 'merchant' ), | |
| 373 | + 'button_text' => esc_html__( 'View Buy Now', 'merchant' ), | |
| 374 | + 'button_link' => esc_url( admin_url( 'admin.php?page=merchant&module=buy-now' ) ), | |
| 375 | + 'condition' => array( 'show_buy_now_button', '==', '1' ), | |
| 376 | + ), | |
| 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( | |
| 384 | + 'id' => 'show_suggested_products', | |
| 385 | + 'pro' => true, // Merchant Pro dependent | |
| 386 | + 'type' => 'switcher', | |
| 387 | + 'title' => esc_html__( 'Show suggested products', 'merchant' ), | |
| 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 | + ), | |
| 393 | + ), | |
| 394 | + array( | |
| 395 | + 'id' => 'suggested_products_module', | |
| 396 | + 'pro' => true, | |
| 397 | + 'type' => 'select', | |
| 398 | + 'options' => array( | |
| 399 | + 'bulk_discounts' => esc_html__( 'Bulk Discounts', 'merchant' ), | |
| 400 | + 'buy_x_get_y' => esc_html__( 'Buy X Get Y', 'merchant' ), | |
| 401 | + 'frequently_bought_together' => esc_html__( 'Frequently Bought Together', 'merchant' ), | |
| 402 | + ), | |
| 403 | + 'default' => 'bulk_discounts', | |
| 404 | + 'conditions' => array( | |
| 405 | + 'terms' => array( | |
| 406 | + array( | |
| 407 | + 'field' => 'show_suggested_products', | |
| 408 | + 'operator' => '===', | |
| 409 | + 'value' => true, | |
| 410 | + ), | |
| 411 | + ), | |
| 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 | + ), | |
| 417 | + ), | |
| 418 | + array( | |
| 419 | + 'id' => 'suggested_products_instructions_bulk_discounts', | |
| 420 | + 'pro' => true, | |
| 421 | + 'type' => 'info_block', | |
| 422 | + 'description' => esc_html__( 'You can display suggested products by enabling certain modules (Bulk Discounts, Buy X Get Y or Frequently Bought Together) from Merchant.', 'merchant' ), | |
| 423 | + 'button_text' => esc_html__( 'View Bulk Discounts', 'merchant' ), | |
| 424 | + 'button_link' => esc_url( admin_url( 'admin.php?page=merchant&module=volume-discounts' ) ), | |
| 425 | + 'conditions' => array( | |
| 426 | + 'relation' => 'AND', | |
| 427 | + 'terms' => array( | |
| 428 | + array( | |
| 429 | + 'field' => 'show_suggested_products', | |
| 430 | + 'operator' => '===', | |
| 431 | + 'value' => true, | |
| 432 | + ), | |
| 433 | + array( | |
| 434 | + 'field' => 'suggested_products_module', | |
| 435 | + 'operator' => '===', | |
| 436 | + 'value' => 'bulk_discounts', | |
| 437 | + ), | |
| 438 | + ), | |
| 439 | + ), | |
| 440 | + ), | |
| 441 | + array( | |
| 442 | + 'id' => 'suggested_products_instructions_frequently_bought_together', | |
| 443 | + 'pro' => true, | |
| 444 | + 'type' => 'info_block', | |
| 445 | + 'description' => esc_html__( 'You can display suggested products by enabling certain modules (Bulk Discounts, Buy X Get Y or Frequently Bought Together) from Merchant.', 'merchant' ), | |
| 446 | + 'button_text' => esc_html__( 'View Frequently Bought Together', 'merchant' ), | |
| 447 | + 'button_link' => esc_url( admin_url( 'admin.php?page=merchant&module=frequently-bought-together' ) ), | |
| 448 | + 'conditions' => array( | |
| 449 | + 'relation' => 'AND', | |
| 450 | + 'terms' => array( | |
| 451 | + array( | |
| 452 | + 'field' => 'show_suggested_products', | |
| 453 | + 'operator' => '===', | |
| 454 | + 'value' => true, | |
| 455 | + ), | |
| 456 | + array( | |
| 457 | + 'field' => 'suggested_products_module', | |
| 458 | + 'operator' => '===', | |
| 459 | + 'value' => 'frequently_bought_together', | |
| 460 | + ), | |
| 461 | + ), | |
| 462 | + ), | |
| 463 | + ), | |
| 464 | + array( | |
| 465 | + 'id' => 'suggested_products_instructions_buy_x_get_y', | |
| 466 | + 'pro' => true, | |
| 467 | + 'type' => 'info_block', | |
| 468 | + 'description' => esc_html__( 'You can display suggested products by enabling certain modules (Bulk Discounts, Buy X Get Y or Frequently Bought Together) from Merchant.', 'merchant' ), | |
| 469 | + 'button_text' => esc_html__( 'View Buy X Get Y', 'merchant' ), | |
| 470 | + 'button_link' => esc_url( admin_url( 'admin.php?page=merchant&module=buy-x-get-y' ) ), | |
| 471 | + 'conditions' => array( | |
| 472 | + 'relation' => 'AND', | |
| 473 | + 'terms' => array( | |
| 474 | + array( | |
| 475 | + 'field' => 'show_suggested_products', | |
| 476 | + 'operator' => '===', | |
| 477 | + 'value' => true, | |
| 478 | + ), | |
| 479 | + array( | |
| 480 | + 'field' => 'suggested_products_module', | |
| 481 | + 'operator' => '===', | |
| 482 | + 'value' => 'buy_x_get_y', | |
| 483 | + ), | |
| 484 | + ), | |
| 485 | + ), | |
| 486 | + ), | |
| 487 | + array( | |
| 488 | + 'id' => 'suggested_products_placement', | |
| 489 | + 'pro' => true, | |
| 490 | + 'type' => 'radio', | |
| 491 | + 'title' => esc_html__( 'Suggested products placement', 'merchant' ), | |
| 492 | + 'options' => array( | |
| 493 | + 'before_add_to_cart' => esc_html__( 'Before Add to Cart', 'merchant' ), | |
| 494 | + 'after_add_to_cart' => esc_html__( 'After Add to Cart', 'merchant' ), | |
| 495 | + ), | |
| 496 | + 'default' => 'after_add_to_cart', | |
| 497 | + 'conditions' => array( | |
| 498 | + 'terms' => array( | |
| 499 | + array( | |
| 500 | + 'field' => 'show_suggested_products', | |
| 501 | + 'operator' => '===', | |
| 502 | + 'value' => true, | |
| 503 | + ), | |
| 504 | + ), | |
| 505 | + ), | |
| 506 | + ), | |
| 507 | + | |
| 508 | + array( | |
| 233 | 509 | 'id' => 'sale-price-color', |
| 234 | 510 | 'type' => 'color', |
| 235 | 511 | 'title' => esc_html__( 'Sale price color', 'merchant' ), |
| 236 | 512 | 'default' => '#212121', |
| @@ -243,5 +519,30 @@ | ||
| 243 | 519 | 'default' => '#999999', |
| 244 | 520 | ), |
| 245 | 521 | |
| 246 | 522 | ), |
| 247 | -) ); | |
| 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 | +); | |