Magento Certified Developer GuideCategory: 8. CheckoutHow can the priority of total model execution be customized
Manish Prakash Staff asked 2 years ago

The totals models are first called with the code $quote->collectTotals();

This code in turn gets a list of all address in a quote model and then again calls $address->collectTotals()

This function in turns creates an object of “Mage_Sales_Model_Quote_Address_Total_Collector”.
The constructor of this class create objects of all totals models are sorts them.

Totals model are divided into two parts
1. Collector : these are only responsible for calling the “collect()” function, and add/subtract price from order total.
2. Retrievers: these are responsible for calling “fetch()” function and are used for display purposes.

Collectors are sorted based on “after” and “before” tags we can specify in config.xml when define an order total.

Retrieves are sorted based on “sales/totals_sort” which we can define in config.xml or system configuration