Skip to content

Commit

Permalink
min max issue has been solved
Browse files Browse the repository at this point in the history
  • Loading branch information
codersaiful committed May 20, 2024
1 parent 683f786 commit 2d2ca85
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
39 changes: 39 additions & 0 deletions admin/page-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,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;
Expand Down
2 changes: 1 addition & 1 deletion admin/page/topbar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$min_max_img = WC_MMQ_BASE_URL . 'assets/images/brand/social/min-max.png';

$this->redirect_wpml();
/**
* This following part actually
* for our both version
Expand Down
8 changes: 8 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ Yes, it work with variable, to learn click on this [tutorial link.](https://cod
= Is it working on WooCommerce Cart/Checkout block? =
Yes, it is.

= Is it Compabile with WPML? =
Yes, it is. Min max step need to set only to main product.

= Can I enable ajax add to cart on single product? =
Yes, use `add_filter('wcmmq_ajax_cart_single_page', '__return_true');` for enable ajax add to cart on single page.

Expand Down Expand Up @@ -253,6 +256,11 @@ We’ll provide support via [support ticket](https://codeastrology.com/my-suppor

== Changelog ==

= 6.4 =
* Fully Compabile with wpml.
* Fixed: Code Optimized
* Bug Fixed.

= 6.3 =
* filter hook `wcmmq_zero_min_issue` optiomized
* Fixed: Code Optimized
Expand Down

0 comments on commit 2d2ca85

Please sign in to comment.