I want to provide functionality to update product quantity on checkout page of magento. so if user want to update the product quantity he can do it on without reloading checkout page. I want to Provide this functionality without reloading page.
My Try:
I edit item.phtml (template/checkout/onepage/review/item.phtml) after 47th line number
<td class="a-center"><?php echo $_item->getQty() ?></td>
<td class="a-center">
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" name="update_cart_action" id="cup_<?php echo $_item->getId() ?>" class="input-text qty" maxlength="12" />
</td>
<td> <button type="submit" name="update_cart_action" value="update_qty" title="<?php echo $this->__('shopping-cart-table'); ?>" id="up_<?php echo $_item->getId() ?>" class="button btn-update"><span><span><?php echo $this->__('Update'); ?></span></span></button><td>
This is My Jquery code which i put at the end of item
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(".btn-update").click(function(){
var id = "#c"+this.id;
var quan = jQuery(id).val();
var lastChar = id.substr(id.length - 1);
jQuery.ajax({
url: "<?php echo Mage::getBaseUrl(); ?>checkout/cart/updatePosts/",
data: "cart["+lastChar+"][qty]="+quan,
async: false,
success: function(html){
location.reload();
}
})
})
})
</script>
Than I Override cartcontroller.php and place all the functions of the original cartcontroller.php and rename function updatePostAction by function updatePostsAction. and change the redirect path to $this->_redirect('checkout/onepage');
But this is not working the error comes in console which i unable to solved and there are some problem inshort.