Question

I need to list all the categories on the home page and is not working, I used:

{{block type="catalog/navigation" name="catalog.category" template="catalog/category/list_home.phtml"}}

I also just in case tried using other calls on the homepage and does not work as well:

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="2" template="catalog/product/list.phtml"}}

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="3" template="catalog/product/list.phtml"}}

{{block type="catalog/product_list" column_count="4" category_id="3" template="catalog/product/list.phtml"}}

Someone can explain me wrong? I am using the theme RWD.

I have never seen that in my life in magento, but are experiencing this error.

I need to show the categories on the home page as the error first, i test try a workaround with two examples.

Était-ce utile?

La solution

If your Magento version is Magento 1.9.2 or greater, then you need to whitelist catalog/product_list block type. You can do that through

System > Permissions > Blocks

After do that, the last block directive is enough to show category in the Home page.

{{block type="catalog/product_list" column_count="4" category_id="3" template="catalog/product/list.phtml"}}

Side Note : Don't forget remove cache before you load your home page

Autres conseils

Here what I did to get mine to work, I just add these below codes to Homepage->Design->Layout Update XML

<reference name="content">
<block type="catalog/product_list" name="featured1" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>5</category_id></action>
<action method="setColumnCount"><count>5</count></action>
</block>
</reference>
<category_id>5</category_id>
<reference name="content">
<block type="catalog/product_list" name="featured2" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>6</category_id></action>
<action method="setColumnCount"><count>5</count></action>
</block>
</reference>
<category_id>6</category_id>

I only have two categories in my case, but if you have more you can keep adding the block and change the category id.

Also, if you want your category title to show add this code to your list.phtml

</div><div class="list-title">
<?php echo Mage::getModel('catalog/category')->load($this->getCategoryId())- 
>getName(); ?>
</div>

Hopefully, this can help you, good luck.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top