Update left column for certain Category/how to set Category Id in layout file
I would like a block that display slide show on left side for certain category. I got the slide show block display in all pages by referencing left column in layout file, however. We need the slide show appear only in certain cat开发者_高级运维egory(id 225) on the left side.
My solution road map so far:
1. rewrite the particular category's url to my customized module/controller/action(test/index/index) 2. In test/index/index layout file test.xml i would like to override catalog handle catalog_category_default(i got this by using Alan Storm Layout Views http://alanstorm.com/category/magento) that will have updated left column with my new slide show block. This is how looks my test.xml fileThis is giving me following error: Fatal error: Call to a member function getMetaTitle() on a non-object in /app/code/local/Mage/Catalog/Block/Category/View.php on line 43
From the error i conclude that the handle is being overided, however there is missing category id because the line 43 is:
if ($title = $this->getCurrentCategory()->getMetaTitle()) {
As you see, i have tried to set the category id in the test.xml layout file but without much success.
How to set category id in layout file? Is this doable solution or right way to do? Am i really overiding the handle?
Thanks Margots
In the admin section, there's a field when editing a category to apply layout updates, you can add your block XML there. If you'd prefer it be in the code, then category pages add a 'handle' that includes their ID, 'CATEGORY_123' for example and you can add your block by referencing that:
<CATEGORY_123>
<reference name="left">
<block type=""> (etc.)
</reference>
</CATEGORY_123>
精彩评论