tags:

views:

275

answers:

1

Hi,

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 category(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 file

This 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

A: 

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>
Greg
Thank You Greg..it worked when putting in code, but i was not able in admin section. In admin section under -Custom Layout Update- i insert this code <reference name="left"> <block type="core/template" name="slideshow_show" as="slideshow" template="slideshow/show.phtml"/></reference>What am i doing wrong?I tried to vote for you but it did not let me. Do I have to do anything else to accept your post as the answer?Thank you for helping
latvian