2

I am currently using a CMS Block to add more details on my product page. I had the following block (product_custom) added inside catalog.xml:

<catalog_product_view translate="label">
    <!--- ... --->
    <reference name="content">
        <!--- ... --->
        <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
            <block type="cms/block" name="product.info.custom" as="product_custom">
                <action method="setBlockId">
                    <block_id>product_custom</block_id>
                </action>
            </block>
        </block>
    </reference>
</catalog_product_view>

Now, I want other products to show different content, so I created another block (product_custom2) and use Design > Custom Layout Update:

<reference name="content">
    <block type="catalog/product_view">
        <block type="cms/block" name="product.info.custom" as="product_custom">
            <action method="setBlockId">
                <block_id>product_custom2</block_id>
            </action>
        </block>
    </block>
</reference>

Unfortunately, the product page is showing previous block instead of the new one. Did I miss something on the custom layout xml? Or is it not allowed? And what would possibly the best solution to this one?

Thanks for the replies.

1 Answer 1

2

You need to change

<reference name="content">
    <block type="catalog/product_view">
        <block type="cms/block" name="product.info.custom" as="product_custom">
            <action method="setBlockId">
                <block_id>product_custom2</block_id>
            </action>
        </block>
    </block>
</reference>

to

<reference name="product.info">
   <!--- <block type="catalog/product_view"> --><!-- remove from here -->
        <block type="cms/block" name="product.info.custom" as="product_custom">
            <action method="setBlockId">
                <block_id>product_custom2</block_id>
            </action>
        </block>
    <!-- </block> --> <!-- remove from here -->
</reference>

According to magento a block children blocks has been update using reference tag of parent block

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.