Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:07:48+00:00 2026-05-31T04:07:48+00:00

Having trouble setting a block template in Magento’s layout xml. I’m attempting to set

  • 0

Having trouble setting a block template in Magento’s layout xml. I’m attempting to set the template of a child block, not the entire page layout (almost all docs out there explain how to set template of the layout).

Background: I’m updating a layout handle in my custom action, using the <update /> tag in my module’s layout xml.

Essentially, I want to reuse the layout and blocks of the built in product view action, but provide custom templates for a few blocks. (Not just overrides, these need to be brand new templates that are only triggered on my custom action and are themselves overrideable).

My layout html:

<?xml version="1.0"?>
<layout version="0.1.0">
<mymodule_product_index>
    <update handle="catalog_product_view" />
    <reference name="content">
        <block type="catalog/product_view" 
        name="product.info" output="toHtml" template="mymodule/product.phtml" />
        </reference>

    <reference name="product.info.bundle">
        <action method="setTemplate"><template>mymodule/customtemplate.phtml</template></action>
    </reference>
</mymodule_product_index>
</layout>

The setTemplate on product.info.bundle never works; it doesn’t seem to affect layout at all. I’ve tried wrapping the <reference> in other <reference> nodes from parent blocks with no effect. Is it possible to replace block templates in this way? I feel that my problem stems from the fact I’m using an <update />.

By the way, I know my layout xml is being loaded and there are no errors, the rest of the file is working fine, caching is disabled, have cleared cache anyway, etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:07:50+00:00Added an answer on May 31, 2026 at 4:07 am

    Your approach is almost correct.
    Two things:
    1. Set a new template instead of instantiating a new block
    Instead of just assigning a different template to the product.info block, you are creating a new instance with the same name, replacing the original instance, and then the new template is set on that. Instead use this:

    <mymodule_product_index>
        <update handle="catalog_product_view" />
        <reference name="product.info">
            <action method="setTemplate">
                <template>mymodule/product.phtml</template>
            </action>
        </reference>
    </mymodule_product_index>
    

    That should take care of the product view template in a clean way.

    2. Handle processing order
    If you look at where the view block product.info.bundle for the bundled products is declared, you will see it happens in the bundle.xml file, in a layout update handle called <PRODUCT_TYPE_bundle>.

    Your code is referencing the block from the <[route]_[controller]_[action]> layout handle, i.e. <mymodule_product_index>.

    The thing to be aware of here is the processing order of layout handles.
    Roughly it is:

    1. <default>
    2. <[route]_[controller]_[action]>
    3. <custom_handles>

    The <PRODUCT_TYPE_bundle> handle belongs to the third type of layout handles, which means it is processed after the <mymodule_product_index> handle.
    In essence, you are referencing the block product.info.bundle before it has been declared.

    To fix this you will need to use the <PRODUCT_TYPE_bundle> handle as well. Of course this will effect every bundled product display. Using layout XML only there is no clean way around that.

    Here are a few suggestions how to solve that problem.

    You could create a separate route in your module to show the bundled products, and then include the <PRODUCT_TYPE_bundle> handle using an update directive for that page, too.

    In your custom action controller, you could add another layout update handle that is processed after <PRODUCT_TYPE_bundle>.

    You could use an event observer to set the template on the product.info.bundle block if it is instantiated. One possibility would be the event controller_action_layout_generate_blocks_after.

    You get the idea, there are many ways to work around this, but they require PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble setting the path to a DLL that is not in the
I'm using Model-View-Presenter framework. When Loading a page, I'm having trouble setting the selected
I am having trouble setting up a Fluent NHibernate HasMany collection. I have set
I'm having trouble setting up the Android SDK. I've set up Eclipse before but
I am having trouble setting the path to jquery in an mvc app. In
We're having trouble setting window captions using cyrillic or japanese characters. We either see
I am having trouble setting my ContentProperty to Text. The error I am given
I'm having trouble setting up my svn. I used apt-get install subversion to install
I'm having trouble setting the command-line arguments in Eclipse. I've searched around the Internet
I'm using KVC to iterating through a few views. Having trouble setting BOOL properties:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.