i’m using the MageDelight Megamenu extension for a website with different stores in different countries, ex:
mystore.com/en_uk/
mystore.com/en_us/
While creating the menu in admin i put the relative path in each category’s URL box (see screenshot) instead of the absolute path so that i don’t have to create a menu instance for each country :
Now if i click on a category in the menu i will be sent to the correct page based on the country i’m in, ex:
mystore.com/en_uk/about-us.html
But there’s a problem: i have a category called ‘New Season’ which contains subcategories.
If i click on one of them ,let’s say Woman i get sent CORRECTLY to the woman subcategory of new season and the url will look like this:
mystore.com/en_uk/new-season/woman.html
The problem is that, since i added a relative path, from here if i click on another category (ex: About Us) i will be sent to a 404 page because the link will look like this:
mystore.com/en_uk/new-season/woman/about-us.html
instead of just:
mystore.com/en_uk/about-us.html
How can i fix it without having to create a menu for each country with absolute paths?
Here’s the relevant block of code:
<?php
$megaMenuLink = $item->getItemLink() ? : '#';
?>
<a href="<?= /* @noEscape */ $megaMenuLink ?>" <?= $open_in_newtab_text ?>>
<span class="megaitemicons"><?= /* @noEscape */ $item->getItemFontIcon() ?></span>
<?= /* @noEscape */ __($megaMenuName) ?>
</a>