Magento: Retrieve quote total excluding tax

Little code snippet that retrieves the quote total excluding tax for current customer, it will make you maybe win the next half hour I lost figuring out how to make. :)

<?php
public function getTotalExclTax()
{
    $total = 0;
    $quote = Mage::getModel('checkout/session')->getQuote();
    $address = $quote->getShippingAddress();
    if ($address) {
        $total = $address->getGrandTotal() - $address->getTaxAmount();
    }
 
    return max($total, 0);
}

To format the price on the frontend from a template:

<?php echo $this->helper('core')->formatPrice($this->getTotalExclTax(), false); ?>

3 Responses to “Magento: Retrieve quote total excluding tax”

  1. [...] 2 – Source : le très bon article de Johann Reinke la récupération du montant total HT du panier] Tags: cart, [...]

  2. Merci !
    Je vous pique le morceau de code et le rajoute :
    – dans mon article sur mon site http://www.martinez-frederic.fr/2010/03/02/jouer-avec-le-panier-de-magento/
    – dans mon article global sur Magentix (ça arrive) http://www.magentix.fr/divers/variables-et-conditions-utiles-magento.html#p1-11

  3. Hello dear,
    i want to print my pdf invoice from backend of magento admin panel

    ___________________________________________________________________
    P-Name SKU Price Net-Price Excise other VAT Subtotal
    ———————————————————————————————–
    pro-1 dsd1 5000 5500 ? ? ? 5500

    Please explain me how to print this type of invoice in magent i unable to find to get this from lost of googling my ? answer
    Please help me bro

Leave a Reply

* Required fields

Categories