我有一个定制的html,我想将这个html实现到签出购物车页面中。我已经实施了,但我无法得到购物车项目的总价,例如。我手推车里有5件东西。我只更新了一个特定的项目在购物车,然后我没有得到这些具体项目的总价。
默认项目$50 *1 =$50
更新后数量
商品价格:$50 *2=?(我想得到这个特定商品的总数)。
谢谢
发布于 2015-05-27 14:00:34
您可以将价格计算为:
<?php
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
foreach($items as $item) {
$qty = $item->getQty();
$price = $item->getPrice();
$totalPrice = $qty * $price;
}
?>发布于 2015-05-27 13:45:02
要获得购物车项目的具体细节,您可以使用:
$quote = Mage::getSingleton('checkout/session')->getQuote();
foreach ($quote->getAllItems() as $item){
$qty = $item->getQty() ;
$price = $item->getPrice();
$totalPrice = $qty * $price;
}发布于 2015-05-28 06:55:20
我使用默认的magento功能在magento chekout购物车页面中获得特定的商品价格。
<?php if ($canApplyMsrp): ?>
<span class="cart-msrp-subtotal">--</span>
<?php else: ?>
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()); ?>
<?php else: ?>
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
<?php endif; ?>
<?php endif; ?>https://stackoverflow.com/questions/30483799
复制相似问题