2011-11-11 8 views
3

장바구니에 각 제품의 총 가격 (ID 별)을 표시하고 싶습니다.Magento - 장바구니에있는 단일 제품의 부분합을 얻는 방법?

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

도움이됩니다.

답변

6

당신은 사용할 수 있습니다 : 그것은

$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(); 
    } 
} 
+1

의 그! 대단히 감사합니다 :-) – tecmec