i'm using the MageDelight Megamenu extension for a website with different stores in different countries, ex:



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 : enter image description here

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:


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:


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:


instead of just:


How can i fix it without having to create a menu for each country with absolute paths?

Here's the relevant block of code:

    $megaMenuLink = $item->getItemLink() ? : '#';
    <a href="<?= /* @noEscape */ $megaMenuLink ?>" <?= $open_in_newtab_text ?>>
            <span class="megaitemicons"><?= /* @noEscape */ $item->getItemFontIcon() ?></span>
            <?= /* @noEscape */ __($megaMenuName) ?>

1 Answer 1


You can use the getBaseUrl() method and concatenate the $megaMenuLink to it.

Refer to this answer for more information on the method: https://magento.stackexchange.com/a/84982/101146

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.