magento - How to display a list of all categories on the home page -
i want display list of categories on home page links, when clicks go page.
i tried this: put code on content of cms -> home page
{{block type="catalog/navigation" name="catalog.category" template="catalog/category/view.phtml"}} {{block type="catalog/product_list" category_id="2" template="catalog/product/list.phtml"}}
but displays nothing.. home page becomes blank, when put this:
{{block type="catalog/navigation" name="catalog.category" template="catalog/category/view.phtml"}}
then products displayed correctly..
depending on wish place these links, there many ways achieve this.
adding categories content
if wish place category links in content of homepage can achieved heading cms > pages > homepage: design tab , adding following layout update xml:
<reference name="content"> <block type="core/text_list" name="top.menu" as="topmenu" translate="label"> <label>navigation bar</label> <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"> <block type="page/html_topmenu_renderer" name="catalog.topnav.renderer" template="page/html/topmenu/renderer.phtml"/> </block> </block> </reference>
then have style liking (to avoid duplicate menu look).
adding categories sidebar
if homepage follows multi-column layout , wish add links 1 of sidebars little more tricky.
the best way create own module here. after head app/design/frontend/yourpackage/yourtemplate/layout/ , add following xml layout:
<default> <reference name="left"> <block type="core/text_list" name="top.menu" as="topmenu" translate="label"> <label>navigation bar</label> <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"> <block type="page/html_topmenu_renderer" name="catalog.topnav.renderer" template="page/html/topmenu/renderer.phtml"/> </block> </block> </reference> </default>
depending on layout homepage conforms replace default tag page_two_columns_left, page_two_columns_right, page_three_columns etc. again you'll have style liking.
i hope helps
Comments
Post a Comment