Magento 1.8 – How to Get Store Category URL

categorygeturl

how can I get the store category url?

I know I can get the store direct url like this,

<a href="{{store direct_url="contacts"}}">Contact Us</a>

But what about the store's categories?

The categories I have in my store, such as 'Wines', 'Food', etc, so if I do this,

{{store direct_url="wines"}} // returns http://mystore/wine

I will get a 404 error page. Because the url should be like this,

http://mystore/wine.html

Any idea?

Best Answer

If you know the id of the category you get the url using widgets:

{{widget type="catalog/category_widget_link" template="catalog/category/widget/link/link_inline.phtml" id_path="category/8"}}

the value of template can be:

  1. catalog/category/widget/link/link_block.phtml
  2. catalog/category/widget/link/link_inline.phtml
Related Topic