ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Len Shein" <lsh...@solveda.com>
Subject RE: virtual/variants price rules / calculation
Date Tue, 28 May 2013 15:40:51 GMT

There are two issues using the price Rules engine in trying to resolve this:

1. The Quantity Price Product rule (PRIP_PRODUCT_ID) does not consider the
virtual product when the variant product id is added to the cart.  Therefore
the quantity comparison is not even checked.

2. The Price engine does not sum the 'quantity' in the cart for either the
virtual or the variant product.  It is simply comparing the quantity entered
on each cart line against the quantity break rule. This logic works with
'Finished goods' since there can only be 1 cart line in the cart per product
(Finished Good).  For example if you add Product 'Finished_Good_A' with a
quantity of '2' and then again add the same Finished_Good_A with a quantity
of '3' the shopping cart would contain 1 cart line with Finished_Good_A and
a  quantity of '5'.  Since variant products are added to the cart on
separate cart lines the Price Rule Engine Quantity break rules do NOT work.


I have a similar issue and instead of using the Price Rules Engine I am
trying to resolve using the Promotion Engine.  The Promotion Engine does sum
the 'quantity in the cart' as well honors the virtual/variant relationship.

Using your example: 


o        Hat price = 10$

o        Qty >= 2, action: Price = 9$


Promotion Engine Rules:

o        Condition: 

o        Cart-Sub Total is > 0

o        Action:     

o        X Quantity for Y Discount

o        Quantity: 2  Amount: 1.00

o        Product Include: Virtual Hat


Add the following to the cart:

o        1 Quantity of yellow hat (variant)

o        1 Quantity of red hat (variant)


Cart Results

o        1 Yellow Hat price of $9.00

o        1 Red Hat price of $9.00


I understand this seems like the solution, however in my testing, I have
found the Quantity on the 'Action' rule acts as 'equal to' or a 'minimum'.
In my example above all works fine when a sum of quantity for the variant
product is '2'.  However if the sum of quantity was '3' then only 2 of the 3
products get the discount.


Cart Results

o        2 Yellow Hat price of $9.00

o        1 Red Hat price of $10.00



I have not noticed a way in the promotion engine to provide a 'range' of
quantity in providing the discount.




-----Original Message-----
From: greg jocher [mailto:greg@jocher.ch] 
Sent: Monday, May 27, 2013 2:07 AM
To: user@ofbiz.apache.org
Subject: Re: virtual/variants price rules / calculation


Hi all


and thank you for your answer Rishi.

I think,  the first way (assign variants to price_rules) will cause 

performance problems: We have products with more than a thousand variants.

So, I gave the category way a try yesterday, but it seems, that this way 

do not calculate the price like we need it.

The price rule (qty >= 2) was activated if I added 2 yellow hats or 2 

red hats to the cart, but not, if I added one of each variant.


I have done the following:


Created a category (type: internal)

Added a price_rule with shopid==XX and categoryid==XX and a price 

override action.


Then I tested with the following category members:

1. virtual and variants

2. virtual only

3. variants only





Hat price = 10$

Qty >= 2, action: Price = 9$


Result of calculated Prices:

1 yellow + 1 red = 20$

2 yellow  = 18$


How we need it:

1 yellow + 1 red = 18$

2 yellow  = 18$


Where is my fault?








On 05/25/2013 10:11 AM, Rishi Solanki wrote:

> Either you need to add all variant products in the rule or you need to

> setup a category specific to price rule add virtual product in it and

> finally link that virtual product to category.


> These are the two possible solution to your problem.


> Rishi Solanki

> Manager, Enterprise Software Development

> HotWax Media Pvt. Ltd.

> Direct: +91-9893287847

> http://www.hotwaxmedia.com



> On Sat, May 25, 2013 at 3:22 AM, greg jocher<greg@jocher.ch>  wrote:


>> Hi All


>> We use price rules to override prices by product and quantity.

>> All prices and pricerules are set on the virtual product.


>> Is there a simple way to count/sum the quantity of different variants to

>> get the overridden price?


>> Simple example:


>> virtual: hat

>> variant 1: red-hat

>> variant 2: yellow-hat


>> If the customer puts a red and a yellow hat to the cart, the price_rule

>> for qty >= 2 should be used.


>> Regards

>> Greg







  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message