gpt4 book ai didi

Magento 结帐 : Get Subtotal Value without iterating

转载 作者:行者123 更新时间:2023-12-04 01:18:24 27 4
gpt4 key购买 nike

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

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com