When changing the language multiple times on the "Add Product" page, the URL accumulates multiple ?lang= parameters, leading to a broken or confusing URL structure.
The language change script doesn’t remove the previous ?lang= parameter before adding the new one, causing the issue.
How to fix:
Update the JavaScript to remove any existing lang parameter from the URL before appending the new one. Example fix:
var actionUrl = $('#ajaxReloadForm').attr('action').replace(/\/action.
$/, '').replace(/(\?|&)lang=[^&]
/, '');
var separator = actionUrl.indexOf('?') === -1 ? '?' : '&';
window.location = actionUrl + separator + 'lang=' + $(this).val();
This will ensure only one ?lang= parameter is in the URL at any time.