11

Magento has a rich Sales module with a ton of options, and it's well-documented for high-level things, but I'm stuck when it comes to subtle distinctions. I'm trying to put together some order analytics software, but I haven't been able to figure out exactly how a Magento order's subtotal and baseSubtotal differ, nor have I been able to find API documentation to that level of detail.

The only thing I have been able to find is in the source code at app/code/core/Mage/Sales/Model, but it would seem to indicate that the values are always the same.

Order/Creditmemo/Total/Subtotal.php:        $creditmemo->setSubtotal($subtotal);
Order/Creditmemo/Total/Subtotal.php:        $creditmemo->setBaseSubtotal($baseSubtotal);
Order/Invoice/Total/Subtotal.php:        $invoice->setSubtotal($subtotal);
Order/Invoice/Total/Subtotal.php:        $invoice->setBaseSubtotal($baseSubtotal);
Quote.php:        $this->setSubtotal(0);
Quote.php:        $this->setBaseSubtotal(0);
Quote.php:            $address->setSubtotal(0);
Quote.php:            $address->setBaseSubtotal(0);
Quote.php:            $this->setSubtotal((float) $this->getSubtotal() + $address->getSubtotal());
Quote.php:            $this->setBaseSubtotal((float) $this->getBaseSubtotal() + $address->getBaseSubtotal());
Recurring/Profile.php:            ->setBaseSubtotal($billingAmount)
Recurring/Profile.php:            ->setSubtotal($billingAmount)

Do they ever differ, and if so, how?

kojiro
  • 74,557
  • 19
  • 143
  • 201

1 Answers1

33

the difference is that Subtotal is the subtotal in the customer's currency and BaseSubtotal is the subtotal in your shop's base currency.
So if you have euros and dollars installed in your shop, dollar being the base currency, when one of your european customer place an order for, let's say 100€, Subtotal will be 100.0000 and BaseSubtotal will be 150.0000 (for this example 1€ == $1.5)
HTH

OSdave
  • 8,538
  • 7
  • 45
  • 60
  • 1
    How/where did you find this out? – kojiro Mar 14 '12 at 15:15
  • 3
    @kojiro I have been working for the last 3 years, I don't remember the moment I figured that particular point out. But probably I did a google search + digged in the code + xdebuging session. – OSdave Mar 14 '12 at 15:18
  • 2
    @kojiro this link explains the subject very well: http://classyllama.com/magento/a-guide-to-currency-prices-for-orders-invoices-and-quotes/ – OSdave Mar 15 '12 at 19:39