How to find a place when shopping cart price rules applied?
Question
I'm looking for place at code where shopping cart price rules are applied. Lets say, I've created a rule and when I add some product to shopping cart which match this rule, this rule will be applied and can change a price. I'm trying to explore module SalesRules
, but without success. Maybe someone can give me a right direction?
Solution
The starting point for all salesrules are in the Observer:
\Mage_SalesRule_Model_Observer::sales_quote_address_discount_item()
There \Mage_SalesRule_Model_Validator::process()
is called, where it is checked whether the rule should be applied:
if (!$this->_canProcessRule($rule, $address)) {
continue;
}
if (!$rule->getActions()->validate($item)) {
continue;
}
and afterwards the discounts are applied.
I hope this helps you on your way into the salesrules.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange