Magento – Layout update handle per storeview

layout-updatestore-viewxml

I'd like to change the title of certain blocks per storeview in my local.xml, however, I've tried numerous things and it doesn't seem to pick up on my changes, not even when I 'unset' the data, and then add nothing.

This is what I have so far:

  <reference name="content">
        <block type="catalog/product_list" name="product_list_bars"  template="catalog/product/list_custom.phtml">
            <action method="setData">
                <name>category_custom_id</name>
                <value>18</value>
            </action>
            <action method="setData">
                <name>category_custom_title</name>
                <value>German</value>
            </action>
        </block>

This is what sets the default block title. This works for the default storeview. But then, I want to change the title to English for the English storeview as follows:

  <STORE_english_eu>
    <reference name="product_list_bars">
        <action method="unsetData">
            <name>category_custom_title</name>
        </action>
    </reference>
</STORE_english_eu>

So to test it, I'm trying to unset it first, and then set it. That doesn't seem to work. What am I missing?

Best Answer

Everything at first glance looks good on the coding side of things.

Make sure your store code is correct. english_eu.

Instead of unsetting the data, did you try just overwriting the data? the setData() method updates the data whether or not it is already set.

Try this:

<layout>
    <default>
       <reference name="content">
        <block type="catalog/product_list" name="product_list_bars"  template="catalog/product/list_custom.phtml">
            <action method="setData">
                <name>category_custom_id</name>
                <value>18</value>
            </action>
            <action method="setData">
                <name>category_custom_title</name>
                <value>German</value>
            </action>
        </block>
    </default>
    <STORE_english_eu>
        <reference name="product_list_bars">
            <action method="setData">
                <key>category_custom_title</key>
                <value>English EU Title</value>
            </action>
        </reference>
    </STORE_english_eu>
</layout>

If this does not work, please paste your entire local.xml into your question, so we can catch any other areas that may be affecting it.