Add a block below discount code form
1 Answer
You can try the steps describe below to add a block in checkout cart page
Step 1)
Edit you Magento 1 Theme file checkout.xml.
I assume your current theme is "rwd default" So you need to edit the checkout.xml file under YOUR-MAGENTO-ROOT/app/design/frontend/rwd/default/layout
Insert <block type="core/template" name="checkout.cart.donation" as="donation" template="checkout/cart/donation.phtml"/> under parent block "checkout.cart.coupon" as below
...........
...........
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="checkout/cart" name="checkout.cart">
<action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
<action method="chooseTemplate"/>
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/item/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/item/default.phtml</template></action>
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/item/default.phtml</template></action>
<block type="core/text_list" name="checkout.cart.empty.widget" as="checkout_cart_empty_widget" translate="label">
<label>Empty Shopping Cart Content Before</label>
</block>
<block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
<label>Payment Methods Before Checkout Button</label>
<block type="checkout/onepage_link" name="checkout.cart.methods.onepage.top" template="checkout/onepage/link.phtml" after="-" />
</block>
<block type="page/html_wrapper" name="checkout.cart.form.before" as="form_before" translate="label">
<label>Shopping Cart Items Before</label>
</block>
<block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
<label>Payment Methods After Checkout Button</label>
<block type="checkout/onepage_link" name="checkout.cart.methods.onepage.bottom" template="checkout/onepage/link.phtml"/>
<block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
<remove name="checkout.cart.methods.onepage" />
</block>
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
<block type="core/text_list" name="checkout.cart.extra" translate="label">
<!-- Add Custom Donation Block-->
<block type="core/template" name="checkout.cart.donation" as="donation" template="checkout/cart/donation.phtml"/>
<label>Checkout Forms Extra</label>
</block>
<block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>
<block type="core/text_list" name="checkout.cart.widget" as="checkout_cart_widget" translate="label">
<label>Shopping Cart Items After</label>
</block>
<block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>
<block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
</block>
</reference>
<block type="core/text_list" name="additional.product.info" translate="label">
<label>Additional Product Info</label>
</block>
</checkout_cart_index>
............ ............
Step 2)
Create the phtml file donation.phtml under the active theme's checkout/cart.
I assume your current theme is "rwd default" So you need to create the donation.phtml file under
YOUR-MAGENTO-ROOT/app/design/frontend/rwd/default/template/checkout/cart/
File : donation.phtml
<form id="donation-form" name="donation-form" action="#" method="post">
<div class="donation">
<div class="donation-form">
<div class="field-wrapper">
<input class="input-checknot" type="checkbox" id="is_donate" name="is_donate" value="" /> Donate
<button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Add Donate')) ?>"
class="button btn-donate"><span><span><?php echo Mage::helper('core')->quoteEscape($this->__('Add Donate')) ?></span></span></button>
</div>
</div>
</div>
</form>
<div class="clearer"> </div>
<style type="text/css">
#donation-form
{
width: 100%;
box-sizing: border-box;
margin: 0;
padding: 0;
ont-family: "Helvetica Neue", Verdana, Arial, sans-serif;
color: #636363;
font-size: 14px;
line-height: 1.5;
padding: 10px;
background-color: #f4f4f4;
border: 1px solid #cccccc;
}
</style>
Note: Please change the phtml file as per your needs
-
-
Then how to get custom donation amount from user and add to total page Oct 9, 2019 at 9:42
-
To taking the donation and display the donation amount you need to create a separate module with controller, Model, DB Setup. The answer was given to show the custom block only. Thank you. Oct 9, 2019 at 10:26
-
-
How to get form value from phtml and save it to total in checkout page Oct 10, 2019 at 4:34