Question

At the controller checkout_cart_index with the reference content, I want to replace this:

<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>

With this:

<block type="multicoupon/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>

What happens is instead of replacing the block, it adds a new one. I've spent hours looking into this to no avail. Is there a way to do this with my own module using just the layout or will I have to write the change to a different file?

Was it helpful?

Solution

Because unsetChild isn't working in this case, I suggest the nuclear option:

<checkout_cart_index>
    <remove name="checkout.cart.coupon"></remove>
</checkout_cart_index>

This will remove the block entirely. Not such a big deal because you'll immediately re-create it:

<checkout_cart_index>
    <remove name="checkout.cart.coupon"></remove>
    <reference name="checkout.cart">
        <block type="multicoupon/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
    </reference>
</checkout_cart_index>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top