diff --git a/admin/add_options_admin.php b/admin/add_options_admin.php index 418a84b..643bab7 100644 --- a/admin/add_options_admin.php +++ b/admin/add_options_admin.php @@ -8,6 +8,23 @@ * @link https://docs.woocommerce.com/wc-apidocs/source-function-woocommerce_wp_text_input.html#14-79 Details of woocommerce_wp_text_input() from WooCommerce */ function wcmmq_add_field_in_panel(){ + $current_lang = apply_filters( 'wpml_current_language', NULL ); + $lang = apply_filters('wpml_default_language', NULL ); + if(!empty($current_lang) && !empty($lang) && $current_lang != $lang){ + $message = __( 'You have to input Min max and step value in your default language product.', 'wcmmq' ); + if( function_exists( 'woocommerce_wp_note' ) ){ + woocommerce_wp_note([ + 'id' => 'wcmmq_note_for_wpml', + 'class' => 'wcmmq_note_for_wpml', + 'message' => $message, + 'type' => 'warning', + 'label' => __( 'Important:', 'wcmmq' ), + + ]); + } + return; + } + $is_pro = defined('WC_MMQ_PRO_VERSION'); $data_type = 'decimal'; $tip_color = 'wcmmq-tips-note'; diff --git a/admin/page-loader.php b/admin/page-loader.php index ae599e1..65a57cb 100644 --- a/admin/page-loader.php +++ b/admin/page-loader.php @@ -84,7 +84,7 @@ public function handle_columns( $columns ) $new_columns['title'] = $columns['title']; - $controller = new Min_Max_Controller(); + $controller = Min_Max_Controller::init(); $new_columns[$controller->min_quantity] = $columns[$controller->min_quantity]; $new_columns[$controller->max_quantity] = $columns[$controller->max_quantity]; $new_columns[$controller->product_step] = $columns[$controller->product_step]; @@ -146,8 +146,11 @@ public function admin_menu() add_submenu_page( $this->main_slug, $this->module_controller->menu_title . $proString, $this->module_controller->menu_title, $capability, 'wcmmq_modules', [$this, 'module_page_html'] ); add_submenu_page( $this->main_slug, esc_html__( 'Min Max Bulk Edit', 'wcmmq' ) . $proString, __( 'Min Max Bulk Edit', 'wcmmq' ), $capability, 'wcmmq-product-quick-edit', [$this, 'product_quick_edit'] ); - add_submenu_page( $this->main_slug, esc_html__( 'Browse Plugins', 'wcmmq' ) . $proString, __( 'Browse Plugins', 'wcmmq' ), $capability, 'wcmmq-browse-plugins', [$this, 'browse_plugins_html'] ); - add_submenu_page( $this->main_slug, esc_html__( 'Addons', 'wcmmq' ) . $proString, __( 'Addons', 'wcmmq' ), $capability, 'wcmmq-addons-list', [$this, 'addons_list_html'] ); + add_submenu_page( $this->main_slug, esc_html__( 'Temp Pro Demo', 'wcmmq' ), esc_html__( 'Temp Pro Demo', 'wcmmq' ), 'read', 'https://codeastro.live/?site=wcmmq&utm=PluginDashboard' ); + + + add_submenu_page( $this->main_slug, esc_html__( 'Browse Plugins', 'wcmmq' ) . $proString, __( 'Browse Plugins', 'wcmmq' ), 'read', 'wcmmq-browse-plugins', [$this, 'browse_plugins_html'] ); + add_submenu_page( $this->main_slug, esc_html__( 'Addons', 'wcmmq' ) . $proString, __( 'Addons', 'wcmmq' ), 'read', 'wcmmq-addons-list', [$this, 'addons_list_html'] ); add_submenu_page($this->main_slug, 'Documentation' . $proString, 'Documentation', 'read','https://codeastrology.com/min-max-quantity/documentation/'); if($this->is_pro){ @@ -163,6 +166,45 @@ public function admin_menu() } } + /** + * This is specially for WPML page + * + * Redirects the user to the default language version of the current URL if the 'lang' parameter is not set or is different from the default language. + * + * @return void + */ + public function redirect_wpml() { + $default_lang = apply_filters('wpml_default_language', NULL); + if ( empty( $default_lang ) ) return; + // Get the current URL + $current_url = $_SERVER['REQUEST_URI']; + + // Parse the URL to get its components + $parsed_url = parse_url($current_url); + + // Parse the query string into an associative array + $query_params = []; + if (isset($parsed_url['query'])) { + parse_str($parsed_url['query'], $query_params); + } + + // Check if the 'lang' parameter is set + if (!isset($query_params['lang']) || ( isset($query_params['lang'] ) && $query_params['lang'] != $default_lang ) ) { + // If not set, add the 'lang' parameter with 'en' as its value + $query_params['lang'] = $default_lang; + + // Build the new query string + $new_query_string = http_build_query($query_params); + + // Construct the new URL + $new_url = $parsed_url['path'] . '?' . $new_query_string; + + // Redirect to the new URL + wp_redirect($new_url); + exit; + } + return; + } public function admin_enqueue_scripts() { global $current_screen; @@ -395,9 +437,9 @@ public function renew_license_notice() $message = esc_html__( ' Renew it to get latest update.', 'wpt_pro' ) . ''; ob_start(); ?> -
Free Download, Install and Activate to get following table. https://codeastrology.com/downloads/product-stock-sync...
- Get Premium Version. Just Click on - Purchase Now
+ Free Download
+ Just Install and Activate. No need to integrate with Google Sheet for Min max Edit.