I'm trying to display Update Shopping Cart on checkout page, is there any way I can display?
<?php echo $this->getChildHtml('form_before') ?>
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
<?php echo $this->getBlockHtml('formkey'); ?>
<button type="submit" name="update_cart_action" value="update_qty" title="<?php echo $this->__('Update Shopping Cart'); ?>" class="button btn-update"><?php echo $this->__('Update Shopping Cart'); ?></button>
</form>
First you need to add the form for the Cart update action in your template. Please be aware that you must add it outside of any other forms. Then you will need to add own module with own front controller and action that will wait for the form submission and will redirect the user back to checkout. The action of the form should be: <form action="<?php echo $this->getUrl('frontNameOfYourController'); ?>" method="post"> //Don't forget to add a session key to this form. <div><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /></div>
In your etc/config.xml add this: <frontend> <routers> <modulename> <use>standard</use> <args> <module>Package_Modulename</module> <frontName>frontNameOfYourController</frontName> </args> </modulename> </routers> </frontend>
Then in your controllers/ folder add the IndexController.php: class Package_Modulename_IndexController extends Mage_Core_Controller_Front_Action { //Method for submitting the action public function indexAction() { //This action should receive the posted data from the form, please refer to the methods: public function updatePostAction(), protected function _updateShoppingCart() for updating the cart and protected function _emptyShoppingCart() for emptying the cart in code/core/Mage/Checkout/controllers/CheckoutController.php //The difference in your method should be that it should redirect to your checkout page once the form is submitted. } }
I think this will do the job for you. If you want more explanation about how the methods should be written leave a comment.
Add the following code in local.xml file
app/design/frontend/YOURPACKAGE/YOURTHEME/layout/local.xml
<checkout_onepage_index translate="label">
<reference name="right">
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">
<action method="addItemRender">
<type>simple</type>
<block>checkout/cart_item_renderer</block>
<template>checkout/cart/sidebar/default.phtml</template>
</action>
<action method="addItemRender">
<type>grouped</type>
<block>checkout/cart_item_renderer_grouped</block>
<template>checkout/cart/sidebar/default.phtml</template>
</action>
<action method="addItemRender">
<type>configurable</type>
<block>checkout/cart_item_renderer_configurable</block>
<template>checkout/cart/sidebar/default.phtml</template>
</action>
<block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
<label>Shopping Cart Sidebar Extra Actions</label>
</block>
</block>
</reference>
</checkout_onepage_index>