Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Page 1 of 2
Add ‘is divisible by’ to price rules conditions
 
Flowstack
Sr. Member
 
Total Posts:  130
Joined:  2008-01-30
London, United Kingdom
 

This would be a handy condition when doing 3 for 2 or BOGOF offers.

At the moment, to do a 3 for 2 offer you have to do:

If ALL of these conditions are TRUE:
    If 
an item is FOUND in the cart with ANY of these conditions true:
        
Quantity in cart is 3
        Quantity in cart is 6
        Quantity in cart is 9
        
<< insert more if needed >>

Obviously this is a pain.

Ideally I could do this:

If ALL of these conditions are TRUE:
    If 
an item is FOUND in the cart with ANY of these conditions true:
        
Quantity in cart is divisible by 3

 
Magento Community Magento Community
Magento Community
Magento Community
 
David at Varien
Magento Team
 
Total Posts:  4
Joined:  2008-01-18
 

This is a very interesting suggestion, as it is a shopping cart price rule that many Magento users will likely want to enable. Your suggestion of ‘is divisible by’ certainly is a shortcut for having to enter each number manually (3, 6, 9, etc.). However, this would not actually be the best condition to enter in order to create a “buy 3 get one free” rule. With either of the condition sets shown here, the rule will only account for orders containing exactly 3, 6, 9 etc. items. Most Magento users would probably not want to penalize the customer for purchasing 4 items, or 10 items, because you always want to encourage your customers to buy more products, but in this case they would receive no discount at all. This issue needs further attention, as this is such a common marketing tactic.

Assuming you want your rule to apply to all quantities, currently the best way to create a “buy 3 get one free” rule that applies to each factor of 3 would be to create a separate rule for each factor. The first rule would be for quantity greater than or equal to 3 and less than or equal to five, with a fixed amount discount equal to the price of one quantity of that product. The second rule would be for quantity between 6 and 8 with a fixed amount discount equal to the price of two quantities of that product, and so on.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1771
Joined:  2007-08-07
Los Angeles
 

We’ve added for next release “Buy X get Y free” rule action, which will work the following way:

Buy 3 get 1 free:
1-30 free
4
-61 free
7
-92 free
...

Buy 5 get 2 free:
1-5  0 free
6    
1 free
7
-12 2 free
13   
3 free
14
-194 free
20   
5 free
...
Maximum quantity for discount is still available.

Also, fixed discount for whole shopping cart action was added.

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
Garrone
Sr. Member
 
Avatar
Total Posts:  103
Joined:  2007-11-03
Lauria
 

I don’t understand the above rules.
About ‘is divisible by’ rule I’m agree because we sell wines bottles and packaging is for 6 bottles. For this quantity we optimize the packaging costs and we can make a discount to the customer.

 Signature 

La Compagnia del Cavatappi, Prodotti Tipici, vini e Vendita Vini.
Se cerchi un Agriturismo in Italia visita Vacanze in Agriturismo.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Flowstack
Sr. Member
 
Total Posts:  130
Joined:  2008-01-30
London, United Kingdom
 

@Moshe - Thanks! Glad to know are suggestions are being incorporated to make the product even greater.

@Garrone - Sounds like you want a discount if someone buys an exactly multiple of 6 bottles. Maybe a modulus rule is needed. E.g. If numbers of items in cart % 6 = 0, then give discount.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Garrone
Sr. Member
 
Avatar
Total Posts:  103
Joined:  2007-11-03
Lauria
 
Flowstack - 18 March 2008 03:09 AM

@Garrone - Sounds like you want a discount if someone buys an exactly multiple of 6 bottles. Maybe a modulus rule is needed. E.g. If numbers of items in cart % 6 = 0, then give discount.

Yes, as you said in the first topic.

 Signature 

La Compagnia del Cavatappi, Prodotti Tipici, vini e Vendita Vini.
Se cerchi un Agriturismo in Italia visita Vacanze in Agriturismo.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1771
Joined:  2007-08-07
Los Angeles
 

@Garrone: in 0.9.17740 you can set:

Apply: Percent of product price discount
Discount Qty Step: 6

and it will apply discount amount for packs of 6

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
Garrone
Sr. Member
 
Avatar
Total Posts:  103
Joined:  2007-11-03
Lauria
 

I get an error, however it’s a very good possibility.

Fatal error: Call to a member function getFrontendInput() on a non-object in /home/tradizio/domains/tradizionidelsud.it/public_html/shop/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php on line 142

 Signature 

La Compagnia del Cavatappi, Prodotti Tipici, vini e Vendita Vini.
Se cerchi un Agriturismo in Italia visita Vacanze in Agriturismo.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Flowstack
Sr. Member
 
Total Posts:  130
Joined:  2008-01-30
London, United Kingdom
 

Very cool Moshe, thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
seDev
Member
 
Total Posts:  47
Joined:  2008-01-22
 
Garrone - 21 March 2008 01:53 AM

I get an error, however it’s a very good possibility.

Fatal error: Call to a member function getFrontendInput() on a non-object in /home/tradizio/domains/tradizionidelsud.it/public_html/shop/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php on line 142

I get this error also, any time I try to select one of the 3 “Cart Item Attributes”. It happens with any Checkout Price Rule I try to create in ver. 0.9.17740.

Séamus

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1771
Joined:  2007-08-07
Los Angeles
 

@Garrone: please replace with attached file: app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php
Which attributes did you use in your price rule?

@seDev: you can’t be getting the same error when using Checkout Price rules, because the error above applies only to catalog price rules.
Could you please paste your error message?

File Attachments
Product.php  (File Size: 8KB - Downloads: 53)
 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
seDev
Member
 
Total Posts:  47
Joined:  2008-01-22
 

Hi Moshe,

Here is the error:

Fatal error: Call to a member function getFrontendInput() on a non-object in /home/auth5t0/public_html/UK/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php on line 142

Thanks for your help,

Séamus

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1771
Joined:  2007-08-07
Los Angeles
 

@seDev: could you try the file attached?

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
seDev
Member
 
Total Posts:  47
Joined:  2008-01-22
 

Hi Moshe,

I replaced the file and now I get this error:

Fatal error: Call to a member function usesSource() on a non-object in /home/auth5t0/public_html/UK/app/code/core/Mage/CatalogRule/Model/Rule/Condition/Product.php on line 97

(I cleared the cache just in case.)

Thanks,

Séamus

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1771
Joined:  2007-08-07
Los Angeles
 

@seDev: I’ve reuploaded the file to same post, could you please try again?

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
seDev
Member
 
Total Posts:  47
Joined:  2008-01-22
 

That worked!

Thanks very much, Moshe.

Séamus

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
53271 users|857 users currently online|107367 forum posts