سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top