I want to change the template with block name "persistent.remember.me", but there are two blocks with that same name under the same handle:


    <reference name="checkout.onepage.login">
        <action method="setTemplate"><template>persistent/checkout/onepage/login.phtml</template></action>
        <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
    <reference name="checkout.onepage.billing">
        <action method="setTemplate"><template>persistent/checkout/onepage/billing.phtml</template></action>
        <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
        <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />

I have created a local.xml with the following contents:


    <reference name="persistent.remember.me">
        <action method="setTemplate"><template>mytheme/persistent/remember_me.phtml</template></action>

And everything works fine; Only the template of the last reference ("checkout.onepage.billing") gets updated, which is exactly what I want, but I'm not sure why it does this. I was under the impression that block names should always be unique. Is this a bug in Magento? What could happen to this code if I upgrade Magento?

2 Answers 2


Erfan is right that the html is outputted twice, once as a child of 'checkout.onepage.login' and once as a child of 'checkout.onepage.billing'

Thus there are two child blocks with the same name. Each can have a different template, and each gets rendered as a child of the parent.

To change the persistent block in either of the parent blocks, you need to target the parent block directly such as:

    <reference name="checkout.onepage.login">
            <block type="persistent/form_remember" name="persistent.remember.me" template="my/custom/template.phtml" />

The above will only change the template in the login block.

If you only target the child block 'persistent.remember.me' then magento seems to only change the occurrence of the first found block. Start Speculation: This is most likely in order or alpha occurrence , with 'checkout.onepage.billing' appearing alphabetically before 'checkout.onepage.login', in whatever array is used to store the block internally. The fact that .billing is rendered after .login just makes it look like it is only changing the second occurrence. :) End Speculation


No this is no bug. I bet there is only one block on the site out of "checkout.onepage.billing" and "checkout.onepage.login".

So there is only one block "persistent.remember.me".

  • But the HTML gets outputted twice? Also, if I change anything in app/design/frontend/mytheme/default/mytheme/persistent/remember_me.phtml only the last one changes? If I change app/design/frontend/base/default/persistent/remember_me.phtml only the first one changes...
    – Erfan
    Commented Feb 28, 2013 at 1:23
  • Another example where two blocks with the same name are output on the same page is on the cart in the checkout_cart_index handle. Both checkout.cart.top_methods and checkout.cart.methods have a block named checkout.cart.methods.onepage.
    – pcronin
    Commented Mar 31, 2016 at 17:51

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.