简体   繁体   English

更新退货页面magento上的产品数量

[英]update product quantity on check out page magento

I want to provide functionality to update product quantity on checkout page of magento. 我想在magento的结帐页面上提供更新商品数量的功能。 so if user want to update the product quantity he can do it on checkout page rather to go back on cart page. 因此,如果用户要更新产品数量,可以在结帐页面上进行操作,而不必返回购物车页面。

you can do it by editing item.phtml (template/checkout/onepage/review/item.phtml) and these lines after line no #47 您可以通过编辑item.phtml (template/checkout/onepage/review/item.phtml)和第47号行之后的这些行来实现

    <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>

and put Jquery code at the end 

    <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>

now override cartcontroller.php and place all the functions of the original cartcontroller.php and rename function updatePostAction by function updatePostsAction . 现在覆盖cartcontroller.php ,然后将原稿的所有功能cartcontroller.php和重命名功能updatePostAction按功能updatePostsAction and change the redirect path to $this->_redirect('checkout/onepage'); 并将重定向路径更改为$this->_redirect('checkout/onepage');

that's all. 就这样。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM