Magento 结帐 : Get Subtotal Value without iterating

标签 magento

<?php
foreach($this->getTotals() as $total)
{
    if ($total->getCode() == 'subtotal')
    {
        $subtotal = $total->getValue();
        break;
    }
}
echo $subtotal;
?>

有什么办法可以直接得到小计?

最佳答案

根据 this site :

You can get the subtotal with:

$totals = Mage::getSingleton('checkout/cart')->getQuote()->getTotals();
$subtotal = $totals["subtotal"]->getValue();

关于Magento 结帐 : Get Subtotal Value without iterating,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2245436/

相关文章:

具有 Paypal 标准的Magento?

magento - 创建发货不会更新商品发货数量且订单未完成

magento - 如何在 Magento 1.6 中更改客户发票模板

regex - 将 domain.tld/index.php 重定向到 domain.tld(删除 index.php,然后删除 301)

magento - 网格没有出现在 Magento 的自定义管理模块中

php - 使用 magento 进行验证码

php - 将外部脚本添加到一个 Magento 页面

magento - 设置envif主机Magento多个商店

php - Magento 以编程方式更改库存可用性

magento - CentOs Magento 文件创建为目录?