2

I have a Shopping Cart Price Rule that if a product meets a condition that it applies the rule, simple normal. I have another rule for the same product that is set for a different condition. The issue is that, due to the way the promotion is set up I need to let both rules be applied to the item, but what happens is that only one is applying to the item. I have tested this out by turning one rule off, which I'll see the other be applied, and then flip it and I'll see the other active rule applied.

What needs to happen is that I need to let both be applied to the item for a combined discount. There are like 3 versions of the rules now, and if I was to try to do all the combinations of these current rules, then I'd have like 50 rules to try to account for all the possible conditions. Well not 50 but point is making new rules is not a clean way to deal with this.

Any ideas on how to extend the promotions so that more then one rule may apply? Maybe a simple extension example to be clear?

update 1

It seems to me that I may want to try to extend Mage_SalesRule_Model_Resource_Rule_Collection ? I'm still trying to find the root of where the override should take place to allow for a clean implementation to get more then one rule to apply to an item. I know there will need to be things accounted for like the order/quote to the reports, but the thought here is that if I start at the collection, that it'll apply in all the other places.

update 2 (further inspection of the core)

I have been rooting around to find answer this question:

Where does it stop processing a discount for an item(action)?

This seems to me to be the root area where one would address the solution to the issue, at the time of writing I believe, Mage_SalesRule_Model_Validator->process(). In there it does a

    $appliedRuleIds = array();
    foreach ($this->_getRules() as $rule) {

Which is promising in the sense that Magento is looping over all the rule on the (Mage_Sales_Model_Quote_Item_Abstract)$item and it seems that

        /* @var $rule Mage_SalesRule_Model_Rule */
        if (!$this->_canProcessRule($rule, $address)) {
            continue;
        }

        if (!$rule->getActions()->validate($item)) {
            continue;
        }

is the deciding factor, but I see nothing that indicates a check for a rule that is already applied. At this time, it's not apparent where the "stop we already applied a rule" part is coming in.

Still running it down

I see that if I check

        if ($rule->getStopRulesProcessing()) {
            //$this->_stopFurtherRules = true;
            //break;
        }

in the Mage_SalesRule_Model_Validator->process() it will move on to the next rule, but, it seems to just over ride the next rule (I think) and it's not cumulative. One step forward two steps back

pushing forward

It seems that maybe the issue of the cumulative discount not occurring is that the base discounts are hardcoded to 0.

        $discountAmount = 0;
        $baseDiscountAmount = 0;
        //discount for original price
        $originalDiscountAmount = 0;
        $baseOriginalDiscountAmount = 0;

Is that is in that foreach loop. It would seem that I would want to be getting those from the item object not set as 0

side thought I ran down

So I had a thought.. what if the product in the order that has the qty of 3 (mind you this is what I'm testing) is $25 and the two discounts are $25 and $10. What I'm thinking is that it's not that its 3*25 - 35, but it's that it was only picking up the 1 of 3 and trying to do the math on that so it'd be a - number.. but doesn't seem to be supported in the code, and when I switch it to the off cart fixed mode, it still isn't working..

----------------------------------------------------------

screenshots

----------------------------------------------------------

rule 1

No conditions, Action shown below with item rule

rule 1

rule 2

No conditions, Action shown below with item rule

enter image description here

results

Both discounts show but the total is not matching

enter image description here

  • There is a field called Stop Further Rules Processing, while creating the rule, it might be stoping you to achieve what you want. – mbalparda Aug 28 '14 at 22:40
  • I wish but no that isn't what that does "In this case we entered the priority as 1. Say we had another rule, $5 off all products, which had a priority of 2. If we had selected No on the Stop Further Rules Processing dropdown that $5 discount would take effect on the already 15% discounted price. Since we select yes the $5 discount will still apply to other products, but not Sony products equal or great than $100. " magentocommerce.com/knowledge-base/entry/… In short, it stops the chain, setting the default of no to yes doesn't help – jeremy.bass Aug 29 '14 at 2:24
  • can you please post 1) your magento version 2) both rules action/condition tabs? – Amasty Sep 1 '14 at 19:11
  • it's on 1.9.x at this time and are you asking which I'm looking for? action (which is item based?) for sure but well both ideal I'd guess. – jeremy.bass Sep 1 '14 at 19:57
  • Jeremy, I just want to create the same config at the local pc to be able to debug. Normally 2 shopping cart rules CAN be applied to 1 products. – Amasty Sep 2 '14 at 15:11
2
+50

Here is working example of how 2 shopping cart price rules can affect one item. The final screen uses this module to show discount breakdown.

The setup is straightforward:

Rule #1

Conditions tab:
Conditions 1

Actions tab:
Actions 1

and Rule #2

Conditions tab:
Conditions 2

Actions tab:
Actions 2

Result: result

Please edit your answer in the same way, so I can get better advice step by step. No code, just the Magento version and rules set up.

It's definitely possible to apply several discounts to one product (as shown above).

  • I will make the edit, but it is seeming like an issue of an extension bug. I am using the pro version of that same module, but am not seeing the same results. I will alter the question to reflect the current set up and results. – jeremy.bass Sep 4 '14 at 15:06
  • But if the question includes the extension, just email to the support and reference to this question :) I personally take care it will be solved. Was under impression it's about the magento default promos. – Amasty Sep 5 '14 at 8:57
  • In this case the issue is that FIXED AMOUNT removes full product price from one item, and the next discount sees nothing to remove. So the solution is using different type of action, that takes the amount from all items in small chunks. For example "Fixed discount for products set" – Amasty Sep 5 '14 at 8:59
  • at first I didn't think the question did involve the extension. I did fixed amount on cart and it didn't seem to work to. I'll fiddel some more and get back – jeremy.bass Sep 5 '14 at 16:05
  • Sure, feel free to email me directly. I'm at the Meet Magento Ukraine now, but will be online on Monday. If your support period is over - it's also not a problem at all. – Amasty Sep 5 '14 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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