0

I have bought a custom extension to use in my shopping cart but i want to change the position. At the moment the element/block is positioned underneath the whole cart form where as i want it to be placed right under or inside the coupon code block as shown in this pic:

enter image description here The extension xml file to originally position the extension is:

<checkout_cart_index>
  <reference name="content">
        <block type="ext/custom" name="ext.custom"></block>         
  </reference>
</checkout_cart_index>

In my checkout.xml file my coupon section looks like:

<checkout_cart_index translate="label">
    <reference name="content">
        ......
        <block type="checkout/cart" name="checkout.cart">
            <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
        </block>
        ......
    </reference>
</checkout_cart_index>
2

The only places you can put your extension block in the checkout only via the checkout is above everything, below everything and above the coupon code block.
To put it above the coupon you need to change the extension layout to this:

<checkout_cart_index>
  <reference name="checkout.cart">
        <block type="ext/custom" name="checkout.cart.extra"></block>         
  </reference>
</checkout_cart_index>

The name of the custom block must be checkout.cart.extra.
In order to position it below the coupon section change the layout to this:

<checkout_cart_index>
     <reference name="checkout.cart">
        <block type="ext/custom" name="ext.custom" as="ext.custom"></block>         
     </reference>
</checkout_cart_index>

then edit app/design/frontend/{package}/{theme}/template/checkout/cart.phtml and add this line:

 <?php echo $this->getChildHtml('ext.custom')?>

right below

 <?php echo $this->getChildHtml('coupon') ?>
1

You can try

<checkout_cart_index translate="label">
   <reference name="content"> 
    <block type="checkout/cart" name="checkout.cart"> 
       <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template= "checkout/cart/coupon.phtml"/><block name="custom.block" as="custom_block" /> 
   </block> 
 </reference> 

In your coupon.phtml call as

$this->getChildHtml('custom_block');

Always better to use local.xml for any layout updates in your custom theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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