So I want to change a code block (discount vouchers) on the cart page. I need to create a new file to style this block.
The existing layout file (XML) has the following code:
<checkout_cart_index>
<reference name="checkout.cart.coupon">
<action method="setTemplate">
<template>rewardpoints/coupons.phtml</template>
</action>
<block type="rewardpoints/coupon" name="checkout_cart_coupon_normal" as="coupon_points" template="rewardpoints/reward_coupon.phtml">
<block type="checkout/cart_coupon" name="checkout_cart_coupon_reward" as="coupon_original" template="checkout/cart/coupon.phtml"/>
</block>
</reference>
</checkout_cart_index>
I'm trying to copy that by adding the following below that:
<reference name="checkout.cart.coupon.short">
<action method="setTemplate">
<template>rewardpoints/coupons_short.phtml</template>
</action>
<block type="rewardpoints/coupon" name="cart_coupon_points_short" as="coupon_points_short" template="rewardpoints/reward_coupon_short.phtml">
<block type="checkout/cart_coupon" name="cart_coupon_points_cart" as="coupon_points_cart" template="checkout/cart/coupon_cart.phtml"/>
</block>
</reference>
I have created the new phtml files and for now, they contain exactly the same data. There are no ID conflicts.
These are being called with the $this->getChildHtml('coupon_points_short'); code. Needless to say, the page is just empty. White. Nothing.
Could someone please advise me how to proceed.
-
I just cracked it! This file was actually correct, but it was referenced higher up in another layout template (checkout.xml) first. I put a block in there: <block type="checkout/cart_coupon" name="checkout.cart.coupon.short" as="coupon_short" template="checkout/cart/coupon_short.phtml"/> ...now it works like a charm. Thanks for taking a look.Jongosi– Jongosi2013年05月29日 15:08:36 +00:00Commented May 29, 2013 at 15:08
-
2Please add this as an answer, mark it in two days as correct. You should be able to answer your own question when I remember correct (15 reputation)Fabian Blechschmidt– Fabian Blechschmidt2013年05月29日 19:07:26 +00:00Commented May 29, 2013 at 19:07
1 Answer 1
I just cracked it! This file was actually correct, but it was referenced higher up in another layout template (checkout.xml) first. I put a block in there: ...now it works like a charm. Thanks for taking a look.
This is the answer, and the question can be marked as closed.