Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Subtotal and BaseSubtotal?

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?

like image 581
kojiro Avatar asked Mar 14 '12 15:03

kojiro


People also ask

What is the difference between total and subtotal?

One really easy tip to help you remember is to remember which one is higher. “Total” is higher than “subtotal” because “total” is the overall and final sum of a list of numbers. “Subtotal” only weighs up a few numbers and won’t take into account the whole thing.

What is the difference between sum and subtotal in Python?

Another difference between the two functions is that while SUM is limited to addition, you can perform other functions within the SUBTOTAL function. For example, we can perform an average instead of the total by specifying the correct function code.

What is the meaning of the prefix “subtotal”?

This implies that they are attached and integrated into the word itself, so “subtotal” is the correct option. Here are some other examples of the sub- prefix and how they modify the meaning of the base word to emphasize this point further. A generation plant responsible for creating electricity that powers a city or feeds into the national grid.

What are the advantages of the subtotal function?

The third advantage of the Subtotal function is that it excludes other subtotals. So, for example, if you had a monthly report that has a lot of report sections such as Sales, Cost of Goods Sold, Operating Expenses, Non-Operating Gains (Losses) , typically you add up each grouping and then create a grand total.


1 Answers

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

like image 70
OSdave Avatar answered Oct 04 '22 00:10

OSdave