Thr*_*igh 3 product totals magento cart subtotal
我想在购物车中显示每种产品的总价格(按ID).
qty | single price | total
2 | $ 2.00 | $ 4.00 <-- that's what i need
3 | $ 5.00 | $ 15.00
| Subtotals: | $ 19.00 <-- that's what i get with the code below
$totals = Mage::getSingleton("checkout/cart")->getQuote()->getTotals();
$subtotal = $totals["subtotal"]->getValue();
echo Mage::helper('checkout')->formatPrice($subtotal);
Run Code Online (Sandbox Code Playgroud)
欢迎任何帮助.
您可以使用:
$productId = 5;//put here the product id you want the price
$quote = Mage::getSingleton('checkout/session')->getQuote();
$items = $quote->getAllItems();
foreach ($items as $item) {
if ($item->getProductId() == $productId) {
$priceInclVat = $item->getRowTotalInclTax();
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9772 次 |
| 最近记录: |