Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Shopping cart price rule, subtotal condition after discounts? 
 
mawe
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2008-02-05
 

Hello there,

I have four shopping cart price rules, three apply a discount, another one activates free shipping.

Based on their priority it looks like this:

1. 5 %
2. 8 %
3. 10 %
4. free shipping

Free shipping triggers on a condition if subtotal < 350, regardless of any discounts applied to this.

If I have 350.30 in my cart and 5 % discount is applied that would result in 332.785. I want the subtotal condition in rule #4 applied to 332.785.

Is this possible? Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

Magento calculates discounts based on the original cart value I’m afraid. Try however in the class app\code\core\Mage\Sales\Model\Quote\Address.php, method requestShippingRates()

change

$this->getBaseSubtotal()
with
$this->getBaseSubtotalWithDiscount()
 
Magento Community Magento Community
Magento Community
Magento Community
 
mawe
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2008-02-05
 

Hey, thanks for the answer. Unfortunately this didn’t help.

I found out that $request->setFreeShipping($this->getFreeShipping()); in the method you mentioned is the switch that sets free shipping (who would’ve thought …). That led me to the table sales_flat_quote_address but figuring out what is done there is clearly beyond my abilities.

Any further hints or ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Calin Sargan
Jr. Member
 
Total Posts:  1
Joined:  2011-02-17
 

To add ‘subtotal with discount’ conditional tag in price rules, do following:

Overwrite Mage/SalesRule/Model/Rule/Condition/Address.php

Check for line 41, after it insert:

'base_subtotal_with_discount' => Mage::helper('salesrule')->__('Subtotal with discount'),

Now, overwrite Mage/Sales/Model/Quote/Address.php

Here, you have to insert this line:

$this->setData('base_subtotal_with_discount',$this->getBaseSubtotalWithDiscount());

I’ve give it a try and insert it at line 103 in _beforeSave() function body and it works.

If anyone have a right suggestion for this statement, please reply.

Now go to Promotions/Shopping cart price rules, add a rule and start do conditions by Subtotal with discount.

Waiting for feedback.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
luckyknight
Jr. Member
 
Total Posts:  22
Joined:  2010-09-10
 
Calin Sargan - 20 October 2011 10:54 AM


Now, overwrite Mage/Sales/Model/Quote/Address.php

Here, you have to insert this line:

$this->setData('base_subtotal_with_discount',$this->getBaseSubtotalWithDiscount());

I’ve give it a try and insert it at line 103 in _beforeSave() function body and it works.

Can’t get this to work for me - where exactly in _beforeSave() did you put it? On second try - it does work but only works sometimes on refresh and sometimes it doesn’t!!!

I.e. I press refresh - discount gone. Press refresh - discount there. Press refresh - discount gone.

Might be something to do with amrules extension

 
Magento Community Magento Community
Magento Community
Magento Community
 
luckyknight
Jr. Member
 
Total Posts:  22
Joined:  2010-09-10
 

Any ideas as I really need this to work!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
luckyknight
Jr. Member
 
Total Posts:  22
Joined:  2010-09-10
 

The issue I am getting is that it’s necessary to refresh the cart page before any discounts using subtotal_with_discount will work? Any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
koraykupe
Jr. Member
 
Avatar
Total Posts:  2
Joined:  2012-04-03
 

Is there any working fix for this issue?

 
Magento Community Magento Community
Magento Community
Magento Community
 
raym0nd
Member
 
Total Posts:  45
Joined:  2010-06-23
 
luckyknight - 30 March 2012 05:34 AM

Calin Sargan - 20 October 2011 10:54 AM


Now, overwrite Mage/Sales/Model/Quote/Address.php

Here, you have to insert this line:

$this->setData('base_subtotal_with_discount',$this->getBaseSubtotalWithDiscount());

I’ve give it a try and insert it at line 103 in _beforeSave() function body and it works.

Can’t get this to work for me - where exactly in _beforeSave() did you put it? On second try - it does work but only works sometimes on refresh and sometimes it doesn’t!!!

I.e. I press refresh - discount gone. Press refresh - discount there. Press refresh - discount gone.

Might be something to do with amrules extension

 
Magento Community Magento Community
Magento Community
Magento Community
 
raym0nd
Member
 
Total Posts:  45
Joined:  2010-06-23
 
luckyknight - 30 March 2012 05:34 AM

Calin Sargan - 20 October 2011 10:54 AM


Now, overwrite Mage/Sales/Model/Quote/Address.php

Here, you have to insert this line:

$this->setData('base_subtotal_with_discount',$this->getBaseSubtotalWithDiscount());

I’ve give it a try and insert it at line 103 in _beforeSave() function body and it works.

Can’t get this to work for me - where exactly in _beforeSave() did you put it? On second try - it does work but only works sometimes on refresh and sometimes it doesn’t!!!

I.e. I press refresh - discount gone. Press refresh - discount there. Press refresh - discount gone.

Might be something to do with amrules extension

I have encountered the same problem “I press refresh - discount gone. Press refresh - discount there. Press refresh - discount gone.”.

any fixed so far?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nyozz
Jr. Member
 
Total Posts:  5
Joined:  2013-04-21
 

I have the same problem. would be nice if someone find a solution. I’ve worked on this problem for a long time and still didn’t found a solution

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nyozz
Jr. Member
 
Total Posts:  5
Joined:  2013-04-21
 

I’ve found the solution.

 
Magento Community Magento Community
Magento Community
Magento Community
 
raym0nd
Member
 
Total Posts:  45
Joined:  2010-06-23
 
Nyozz - 02 July 2013 02:44 AM

I’ve found the solution.

perhaps you can share your solution with us?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nyozz
Jr. Member
 
Total Posts:  5
Joined:  2013-04-21
 
raym0nd - 02 July 2013 04:16 AM

Nyozz - 02 July 2013 02:44 AM
I’ve found the solution.

perhaps you can share your solution with us?

Sorry I was at work and hadn’t the time to post.

this->getBaseSubtotalWithDiscount() returns sometimes 0 and sometimes the right value.

I’ve used $this->getGrandTotal() - $this->getShippingAmount() and I get the right value every time.

$this->setData('base_subtotal_with_discount',$this->getGrandTotal() - $this->getShippingAmount());

Best regards,
Henry

 
Magento Community Magento Community
Magento Community
Magento Community
 
raym0nd
Member
 
Total Posts:  45
Joined:  2010-06-23
 
Nyozz - 11 July 2013 02:30 AM

raym0nd - 02 July 2013 04:16 AM
Nyozz - 02 July 2013 02:44 AM
I’ve found the solution.

perhaps you can share your solution with us?

Sorry I was at work and hadn’t the time to post.

this->getBaseSubtotalWithDiscount() returns sometimes 0 and sometimes the right value.

I’ve used $this->getGrandTotal() - $this->getShippingAmount() and I get the right value every time.

$this->setData('base_subtotal_with_discount',$this->getGrandTotal() - $this->getShippingAmount());

Best regards,
Henry

Thanks for sharing, your solution works with one of my previous rule.

I tried to create a new shopping cart price rule and the refreshing bug still appear:
- No Coupon
Conditions
- If subtotal with discount is equal or more than 115
Actions
- 10 percent discount

Frontend Test
Add 5 X $25 product = $125
Discount applied $12.50
Refresh
Discount disappear
Refresh
Discount applied $12.50

 
Magento Community Magento Community
Magento Community
Magento Community
 
yldziner
Member
 
Total Posts:  52
Joined:  2008-04-20
 

How can I create an action to discount only 1 sku in category A, even if 10 different skus from that category are in the cart? Any one of those skus should be eligible for the discount, but once 1 sku is in the cart, the rest are excluded from the discount.

For example we want to give a 30% discount on sunglasses and accessories. We sell several diferent sunglasses but we only want to allow the discount on 1 sunglass. We will apply the discount to multiple accessories. If someone orders more than 1 sunglass the order will be submitted but only 1 of the sunglasses will be at the discounted price. Additional sunglasses will be at the standard price and all accessories will receive the discount.

Any thoughts on this?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2