| @@ -52,8 +52,33 @@ | ||
| 52 | 52 | */ |
| 53 | 53 | protected $has_analytics = true; |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | + * Initialize the module's option group definitions. | |
| 57 | + * | |
| 58 | + * @return array<int, array<string, mixed>> Array of option group arrays. | |
| 59 | + */ | |
| 60 | + protected function init_option_groups() { | |
| 61 | + return require MERCHANT_DIR . 'inc/modules/' . self::MODULE_ID . '/admin/options.php'; | |
| 62 | + } | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * Fire action before rendering option groups. | |
| 66 | + * | |
| 67 | + * @return void | |
| 68 | + */ | |
| 69 | + protected function before_render_option_groups() { | |
| 70 | + /** | |
| 71 | + * Fires before module options are rendered. | |
| 72 | + * | |
| 73 | + * @since 1.0 | |
| 74 | + * | |
| 75 | + * @param string $module_id The module ID. | |
| 76 | + */ | |
| 77 | + do_action( 'merchant_admin_before_include_modules_options', self::MODULE_ID ); | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 56 | 81 | * Constructor. |
| 57 | 82 | * |
| 58 | 83 | * @param Merchant_Pre_Orders_Main_Functionality $main_func The main functionality instance. |
| 59 | 84 | */ |
| @@ -80,8 +105,19 @@ | ||
| 80 | 105 | |
| 81 | 106 | // Module data. |
| 82 | 107 | $this->module_data = Merchant_Admin_Modules::$modules_data[ self::MODULE_ID ]; |
| 83 | 108 | |
| 109 | + // AI prompt examples. | |
| 110 | + $this->ai_examples = array( | |
| 111 | + 'blurb' => esc_html__( 'See what AI can do for your pre-orders, from launching a new campaign to adjusting the discount, shipping date, or button text on one already running.', 'merchant' ), | |
| 112 | + 'prompts' => array( | |
| 113 | + esc_html__( 'Explore the abilities WPVibe gives you access to, then create a pre-order for the Galaxy Pro Headphones with an expected shipping date of March 15, 2026', 'merchant' ), | |
| 114 | + esc_html__( 'Check what abilities you have available through WPVibe, then set up a pre-order for the entire Spring Collection category with a fixed $10 discount instead of a percentage', 'merchant' ), | |
| 115 | + esc_html__( "Look at your available WPVibe abilities, then change the button text on the Galaxy Pro Headphones pre-order to 'Reserve Yours'", 'merchant' ), | |
| 116 | + esc_html__( 'See what abilities WPVibe exposes, then exclude the Wired Earbuds product from the Spring Collection pre-order', 'merchant' ), | |
| 117 | + ), | |
| 118 | + ); | |
| 119 | + | |
| 84 | 120 | // Module options path. |
| 85 | 121 | $this->module_options_path = MERCHANT_DIR . 'inc/modules/' . self::MODULE_ID . '/admin/options.php'; |
| 86 | 122 | |
| 87 | 123 | // Is module preview page. |
| @@ -436,8 +472,21 @@ | ||
| 436 | 472 | return array(); |
| 437 | 473 | } |
| 438 | 474 | |
| 439 | 475 | /** |
| 476 | + * Get the WooCommerce orders screen URL, aware of HPOS. | |
| 477 | + * | |
| 478 | + * @return string The orders screen URL. | |
| 479 | + */ | |
| 480 | + private function orders_screen_url() { | |
| 481 | + if ( class_exists( \Automattic\WooCommerce\Utilities\OrderUtil::class ) && \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled() ) { | |
| 482 | + return admin_url( 'admin.php?page=wc-orders' ); | |
| 483 | + } | |
| 484 | + | |
| 485 | + return admin_url( 'edit.php?post_type=shop_order' ); | |
| 486 | + } | |
| 487 | + | |
| 488 | + /** | |
| 440 | 489 | * Display a help banner in the module settings page. |
| 441 | 490 | * |
| 442 | 491 | * @param string $module_id The module ID. |
| 443 | 492 | * |
| @@ -444,8 +493,9 @@ | ||
| 444 | 493 | * @return void |
| 445 | 494 | */ |
| 446 | 495 | public function help_banner( $module_id ) { |
| 447 | 496 | if ( $module_id === self::MODULE_ID ) { |
| 497 | + $orders_url = $this->orders_screen_url(); | |
| 448 | 498 | ?> |
| 449 | 499 | <div class="merchant-module-page-setting-fields"> |
| 450 | 500 | <div class="merchant-module-page-setting-field merchant-module-page-setting-field-content"> |
| 451 | 501 | <div class="merchant-module-page-setting-field-inner"> |
| @@ -458,9 +508,9 @@ | ||
| 458 | 508 | 'merchant' |
| 459 | 509 | ); |
| 460 | 510 | printf( |
| 461 | 511 | '<a href="%1s" target="_blank">%2s</a>', |
| 462 | - esc_url( admin_url( 'edit.php?post_type=shop_order' ) ), | |
| 512 | + esc_url( $orders_url ), | |
| 463 | 513 | esc_html__( 'View Pre-Orders', 'merchant' ) |
| 464 | 514 | ); |
| 465 | 515 | ?></p> |
| 466 | 516 | </div> |