drxp993551 2015-02-17 23:06
浏览 47

如何在Magento获得没有运费和税收的Grand Total

I need to put the value of "Grand Total without shipping and tax" into a JavaScript on the success.phtml-page. To add the Grand Total i use the following code:

<?php echo $this->__('%s', $this->escapeHtml($this->getGrandTotal())) ?>

I was thinking about using getSubtotal instead, but that will not be correct in case of any Shopping Cart Price Rule being used. So I think the approach must be something like: "GrandTotal minus shipping minus tax"

But how can I add these parameters to the code above?

EDIT: About using getSubtotal... I would then need to know how to subtract any discount given by coupon, anyone know how to do this? I was thinking about something like this:

<?php echo $this->__('%s', Mage::getModel('checkout/cart')->getQuote()->getSubtotal() - getDiscount()); ?>

...however "getDiscount()" should be something more correct..

Thanks -Espen

  • 写回答

1条回答 默认 最新

  • dongxia4880 2015-02-23 09:28
    关注

    You can try below code in javascript

                                                          try {
                                                        var total_ship_tax = parseFloat(parseFloat(cart.shipping_amount) + parseFloat(cart.tax_amount)).toFixed(2);
                                                      }
                                                     catch(er) {
                                                        var total_ship_tax = 0; 
                                                    }
                                                    var total_amount =  parseFloat(parseFloat(cart.total_amount)+total_ship_tax).toFixed(2);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!