I have a multlanguage site, and I need to add a link of a category in phtml file. How can I do it?


This won't be optimal and elegant solutions since you provided no information about layout structure so generally you can generate any link to a category on frontend like this:

$categoryUrl = Mage::getModel('catalog/category')->load($categoryId)->getUrl();

It is very likely however that this url is already in the menu. I would create an observer for page_block_html_topmenu_gethtml_after and fetch the category data from the Menu object passed to that event.

  • Hi, with this solution I show all category in another position. I need to make a link at one specific category can I adapt it to call the category by ID? – Joso Apr 6 '17 at 11:47
  • I am not sure what you mean. In the solution I provided you need to get somehow id of a category as load() method accepts that by default. You do not show "all" category but only takes a link to it. – Zefiryn Apr 6 '17 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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