0

I am trying to update the media template via XML in Magento. Somehow my method is not working:

First I included <?php var_dump($this->getNameInLayout()); ?>in the template to get the correct block name. In this case the output is: "product.info.media"

Second step is to updated the product design via manage products > Product > Design > Custom Layout Update. Here I try to update the xml for this single product:

<reference name="product.info.media">
    <action method="setTemplate"><name>ecommerceteam/cloud-zoom/catalog/product/view/media-venst.phtml</name></action>
</reference>

This is not working.

Update: This is what happens in the catalog.xml

    <reference name="content">
        <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
            <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>

Update:

I was not able to update a child block via the product xml layout. I resorted to switching the theme.

8
  • The second step works only for simple products, may be a bug.
    – Piyush
    Commented Nov 8, 2017 at 12:29
  • you can try using helper function, like I did in this answer - magento.stackexchange.com/a/196465/20064
    – Piyush
    Commented Nov 8, 2017 at 12:31
  • This is a simple product. Somehow using reference name="product.info" does work. Commented Nov 8, 2017 at 13:17
  • though its working, check once in your theme's catalog.xml for block product.info , if it has child blocks they will be replaced too
    – Piyush
    Commented Nov 8, 2017 at 13:24
  • I added a part off the catalog.xml to the original question. I looks like product.info.media is a child block off product.info. Commented Nov 8, 2017 at 13:37

1 Answer 1

0

You can update for example with this:

<reference name="content">
<block type="cms/block" name="your_name">
    <action method="setBlockId"><block_id>your_blockid</block_id></action>
</block>
</reference>

If you want to put a block in your template. Or you can update with a .phtml from for example from your template folder:

<reference name="content">
<block type="core/template" name="your_name" as="your_page"  template="page/html/your.phtml" >
</block>
</reference>

Your Answer

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

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