Question

I'm using the pages that come with the default installation of Magento. The customer wants to have different contents on the right column of those pages. For instance, on the "customer-service" page they want to have the top FAQ's but on "contacts" they want to have the telephone and mail information.

How can I achieve that? I've been trying to change the 2columns-right layout, on the right column, to each page but I was unable to find a way to do that.

Was it helpful?

Solution

In the "Design" tab you can not only choose the page layout (2columns-right) but also add arbitrary layout updates with XML.

The following example adds a simple text block (type="core/text") with a phone number to the right column (reference name="right"):

<reference name="right">
    <block name="telephone" type="core/text">
        <action method="setText"><![CDATA[Phone: 555-666-777]]></action>
    </block>
</reference>

The name attribute is important, but its value can be anything as long as it is unique.

screenshot

For more complex content or content that you want to reuse across several pages, you should create a a static block. Static blocks then can be added with layout update XML like this:

<reference name="right">
    <block type="cms/block" name="telephone">
        <action method="setBlockId"><block_id>telephone_block</block_id></action>
    </block>
</reference>

where telephone_block is the identifier of the static block.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top