Custom Design Layout Update Not Working On Child Elements In Magento

Related to our recent post “How To Use The Custom Layout Update In Magento“, it turns out Magento has a bug that keeps design layouts from working on child elements. So if you did the custom layout update to your category as described, it worked fine in that category, but would not go down to the product level even though that was selected. So if you wanted, you could put in that custom layout update on every product manually, but for us that would be a huge undertaking because of the number of products in the category. Besides, that’s just not the way it should be.

So after wasting tons of time researching the forums, we finally came up with this great fix. It comes from another website out there, called Exanto.de. Under Exanto.de/magento-module-und-hacks.html, this guy has made a complete package to fix this bug. Problem is (nothing’s easy), the site is in German or Dutch, not sure which. If you speak whatever language it is, I guess it’s not a problem. Unfortunately I only know english and a little bit of spanish “Una mas cervesa, pour some more” (haha).

Anyway, back to the solution. I went ahead and got brave. I clicked on a few of the links and figured I would try the one here:

http://www.exanto.de/svn/magento-free/trunk/modules/mod_reclayup/

I’m not going to spend the time explaining from here, but basically, if you’ll drill down through all the links in that section, he has provided all the files you need to fix this bug.

Thanks modman for showing us how to fix the bug, “Custom Design Layout Update Not Working On Child Elements In Magento”

How To Use The Custom Layout Update In Magento

As anyone who uses Magento may know, getting a grasp on how things work with Magento can be pretty mind boggling at times. But along with that, I have to say it’s pretty nice when things work out for you. One of those cases is figuring out how to use custom layout updates on categories or products in magento. Turns out it can be pretty simple.

Recently, we wanted to do a custom layout update to Real Work Trucks.com that announced an $80 rebate on select Warn Winches. We wanted it to appear on the applicable category as well as all of the products in that category.

First, we went to Magento Admin > CMS > Static Blocks

Select Add New Block

Put in you block title. In this case we named it Warn Rebate

Next enter the identifier. This is what will be used in you actual code. This one for us is warn_rebate

Make status “Enabled”

For content we made it <h1>$80 Mail In Rebate on select Warn Winches. Offer ends 7-31-11</h1>

Save your block.

Next go to your category under Catalog > Mange Categories

Select the category, in this case it was “Warn Winches and Hoists“. Under the “Custom Design” tab, you’ll see the box called “Custom Layout Update”. Put your code in that box to call your CMS Static Block. The code we used looks like this:

<reference name=”left”><block type=”cms/block” name=”warn_rebate” before=”-”><action method=”setBlockId”><block_id>warn_rebate</block_id></action></block></reference>

With the “Apply To” drop down menu, we selected “This category and it’s products only”

Click save category. There you go, you’re all set. Refresh your cache in Magento Admin then go to your website category to see the changes.

That’s it, that’s how you “Use The Custom Layout Update In Magento

That’s how