如何获得结帐车特定商品的总价?

how to get checkout cart specific item totat price?

我有一个自定义 html 我想将此 html 实施到结帐购物车页面中。我已经实施了,但我无法获得购物车商品的总价,例如。我的购物车中有 5 件商品。我只更新了购物车中的一件特定商品,然后我没有得到这些特定商品的总价。

默认商品 $50 *1 =$50

更新后数量

商品价格:50 美元 * 2 = ??(我想获得该特定商品的总价)。

谢谢

要获取购物车项目的特定详细信息,您可以使用:

$quote = Mage::getSingleton('checkout/session')->getQuote();
foreach ($quote->getAllItems() as $item){
   $qty = $item->getQty() ;
   $price = $item->getPrice();
   $totalPrice =  $qty * $price; 
}

您可以计算价格为:

<?php 
    $items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
    foreach($items as $item) {
       $qty = $item->getQty();
       $price = $item->getPrice();
       $totalPrice =  $qty * $price; 
    }
?>

我正在使用默认的 magento 功能来获取 magento 结帐购物车页面中的特定商品价格

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