문제

How can i get total value in cart without flat rate?

That means by using this code:

$totals = Mage::getSingleton('checkout/cart')->getQuote()->getTotals();
$subtotal = $totals["subtotal"]->getValue();

i got each products sub total.

So i used this code:

$subtotal = $this->helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()); 

now i got the total value that included the flat-rate also.

for example:

here i got 35 as total but this include 20 product price + 15 flat-rate.

So i want to get only the total of all products price in carts.

How can i get this?

도움이 되었습니까?

해결책

you want to get the subtotal then

Mage::getSingleton('checkout/cart')->getQuote()->getSubtotal(); 

don't be afraid to use xdebug and debugging sessions within your IDE to observe what values the variables have inside objects. Simplest way to see what you need is to dump variables to display like

print_r(Mage::getSingleton('checkout/cart')->getQuote()->getData()); 

and just see which variable has the value you need.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top