0

I integrated this extension Free Magento Custom Menu for my top navigation but when I add it and I would like to navigate over the menu I have this error message "javascript:void(0)" for redirection.

0

2 Answers 2

2

The error comes from the file app/design/frontend/default/default/template/webandpeople/custommenu/top.phtml.
Replace these lines:

<a href="javascript:void(0);">
    <span>Menu</span>
</a>

With

<a href="#" onclick="return false;">
    <span>Menu</span>
</a>

or better yet:

<a href="#" onclick="return false;">
    <span><?php echo $this->__('Menu');?></span>
</a>
4
  • Ha. Amazing plugin support. Also - default/default?!
    – philwinkle
    Commented Jul 2, 2013 at 16:10
  • @philwinkle Yeah...that's where they placed the file.
    – Marius
    Commented Jul 2, 2013 at 16:14
  • Should be base/default, no?
    – philwinkle
    Commented Jul 2, 2013 at 16:14
  • 1
    It actually works this way also. The only way it doesn't work is if your current interface (package) is not default. The hierarchy is {interface}/{theme}, {interface}/default, base/default. So if the interface name is default (as it is in most cases) this could work. But I agree. The file should be placed in base/default. for the newer versions, but maybe the extension is compatible with older versions, before base/default existed. (before CE 1.4)
    – Marius
    Commented Jul 2, 2013 at 16:27
0

This particular plugin uses the pattern of providing links within the rel attribute of the anchor tag, and providing void(0) for the onclick event.

Their demo site seems to work fairly well.

This leads me to believe that the extension is not installed correctly and you are missing a Javascript include file that would remap these rel attrs to href.

The void(0) pattern is used to prevent the browser from reloading the page via the click on the element - usually to inject some functionality in between the click on the DOM element and the page load.

Aside from not being best-practice I feel like there may be SEO implications to using this pattern - I highly suggest you look into another navigation plugin over on Magento Connect.

For further support, contact the plugin creator.

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.