VM 4.6.8: Product Details menu items append product slug in multilingual URLs

Started by Georgios Kolomvos, June 14, 2026, 11:26:47 AM

Previous topic - Next topic

Georgios Kolomvos

Environment
- Joomla 5.4.6
- VirtueMart 4.6.8 build 11258
- Multilingual site (EL, EN, FR, ES)
- Product Details Layout menu items associated across languages

Problem
When a Product Details menu item exists and is associated with corresponding menu items in other languages, VirtueMart appends the product slug to the generated multilingual URL although the menu item already uniquely identifies the product.

Example
Expected URL:  /en/product-menu-item
Generated URL: /en/product-menu-item/product-slug
The appended product slug is unnecessary and causes incorrect hreflang and language-switch URLs.

Investigation
After debugging router.php, I found that Product Details menu items are correctly detected using the $ismenue flag. However, the product slug is appended unconditionally:

if($virtuemart_product_id)
    $segments[] = self::getProductName($virtuemart_product_id);
This code executes even when a matching Product Details menu item has already been found.

Suggested fix
Replace:
if($virtuemart_product_id)
    $segments[] = self::getProductName($virtuemart_product_id);
with:
if(!$ismenue && $virtuemart_product_id)
    $segments[] = self::getProductName($virtuemart_product_id);

After applying the patch:
- hreflang URLs are correct
- language-switch URLs are correct
- no unnecessary product slug is appended
- products without Product Details menu items continue to work normally
Georgios Kolomvos
Patras, Greece

Milbo

Great, I directly added it to the core. Looks just like a smart fix.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/