1

I am wanting to understand some things of how Magento "thinks" (i.e. how the designers designed it). One area is related to tax calculations, and when they occur.

Using the OnePage Checkout, I see that the quote is already present (in the database) when you click "Place Order", but it's set into the ::getQuote() object.

I also note that inside function saveOrderAction(), the following line is called if there is payment data:

....
$this->getOnepage()->getQuote()->getPayment()->importData($data);
....

which in turn calls collectTotals()

I notice there is no tax set at this point for the quote - and in fact there are no tax fields in sales_flat_quote like there are in sales_flat_order.

My question: Is the philosophy here basically, "We don't calculate the tax on the quote level because the address may change"? Or is there another reason? Tax fields are basically only in the _order and _invoice sections of sales_flat_..

(Clarification: _tax fields are in the sales_flat_quote_item table, but not in the sales_flat_quote table)

1 Answer 1

2

I'm not completely sure on how Magento "thinks", even after all these years.

The thing with taxes is, that they can change based on the shipping address that the customer enters. Everytime this changes, the tax calculations will change. But only for stuff like the products within the quote and the shipping costs. In the end, you can still fetch them using the quote items. For an order, this will not change anymore. Because the order is only created (based on a quote) when it's actually placed. Making changes to an order will end in canceling that order and creating a new one.

So in the end, a quote is a "living object", which can change when a customer changes something during the checkout, which requires recalculations, etc. An order is uneditable, so everything can be calculated once and saved into the database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.