dongzhidian3538 2015-05-01 16:02
浏览 47

如何在Magento Checkout页面上显示更新购物车?

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>
  • 写回答

2条回答 默认 最新

  • doumanshan6314 2015-05-02 18:59
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录