4

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?

  • 2
    Block titles can also be translated by using the .csv language files located in [your_magento_install_dir]/app/locale/yourlanguage_YOURLANGUAGE/. But for this to work the translate="label" attribute has to be in place and the block title has to be in between <label> tags. This tells Magento to pass the value in the <label> tag through the translate method before displaying it on the screen. – ForMat Aug 6 '15 at 9:18
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.