You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Ingo Wolfmayr <in...@wolfix.at> on 2017/06/26 18:15:42 UTC

Variant Price Calculation

Hi everybody,

I have a question regarding the pricecalculation.

Virtual product: 1000X
Variants:
ID 10001: Default Price 100 €
ID 10002: Default Price 100 €
ID 10003: Default Price 100 €

Variant 10002 is on sales with a pricerule that calculates 20% off. (Product category with a price rule)

Therefore: 10002: 80  €

The price calculation service does not take into account price rules on variants. Therefore it displays 100€ unless I select the variant.

Is there a solution/proposal how this can be done? (without changing the price).

Thanks for any pointer,

Ingo

AW: Variant Price Calculation

Posted by Ingo Wolfmayr <in...@wolfix.at>.
I did explore the system. The logic for virtual product price display works as I stated below:

1.) walk through variants
2.) check smallest default price (Database ProductPrice entity) - not checking if the pricerule does any changes

I already changed the price calculation service to my needs on my local environment - just wanted to know if the current behavior is wanted by the community or my be changes to the calculation logic proposed.

Best regards,
Ingo

-----Ursprüngliche Nachricht-----
Von: Rishi Solanki [mailto:rishisolankii@gmail.com] 
Gesendet: Dienstag, 27. Juni 2017 16:40
An: ofbizuser <us...@ofbiz.apache.org>
Betreff: Re: Variant Price Calculation

As I said in my first reply the price engine works for the variant as well.
But while displaying the prices only virtual product id passed and that is why it is not showing up. You just need to call the service with proper parameters service will give you desired output I believe. Please try to explore how system is showing the price after calculation and how it uses the price on variant selection and added to cart.

I believe you just need to call the price engine with correct params and no improvement required to achieve your requirement. Please refer out parameters :
https://demo-trunk.ofbiz.apache.org/webtools/control/ServiceList?sel_service_name=calculateProductPrice




Rishi Solanki
Sr Manager, Enterprise Software Development HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com

On Tue, Jun 27, 2017 at 6:52 PM, Ingo Wolfmayr <in...@wolfix.at>
wrote:

> Thanks for sharing the details. I belive it would be an improvment to 
> have the price calulation service calulate the price for every variant 
> (including price rules) instead of just taking them from the database.
>
> now:
> 1.) walk through variants
> 2.) check smallest default price (Database ProductPrice)
>
> improvement?
> 1.) walk through variants
> 2.) calculate price for variant and check for smallest price
>
> To take the example from before:
>
> If the price is changed from 100€ to 80€ the product price is 
> displayed as "from 80 €".
> If I add a price rule with -20% from 100€ it says "100€" as the price 
> rule is not considered.
>
> The actual logic of the price calculation service looks up the 
> smallest price, but without considering a price rule behind a variant. 
> I think it would be nice if it does, or am I wrong?
>
> Ingo
>
> -----Ursprüngliche Nachricht-----
> Von: Rishi Solanki [mailto:rishisolankii@gmail.com]
> Gesendet: Dienstag, 27. Juni 2017 11:52
> An: ofbizuser <us...@ofbiz.apache.org>
> Betreff: Re: Variant Price Calculation
>
> Details you have shared for the price rule working, is working as 
> expected and implemented accordingly. That means, the price engine 
> returns the exact price when we pass the variant id to it. So I think 
> on purchase you should able to get the product as per the rule setup.
>
> I guess your problem is not functional and you want to show the 
> variant price/discount before adding them to the cart. And as while 
> rendering the product system uses the virtual id to extract the price 
> information so it is not showing.
>
> In general, if product and price setup is as per the details shared in 
> the email by you. You may need to extract product price for the 
> product you want to show before rendering and customize the product 
> rendering logic accordingly.
>
> Alternatively, change the product setup treat them as separate 
> finished good. System will automatically render the discounted product price.
>
>
> Alternative way is not recommended as we are manipulating the virtual 
> variant associated products to consider them as finished good. But it 
> should quickly resolve your problem
>
>
>
> Rishi Solanki
> Sr Manager, Enterprise Software Development HotWax Systems Pvt. Ltd.
> Direct: +91-9893287847
> http://www.hotwaxsystems.com
>
> On Mon, Jun 26, 2017 at 11:45 PM, Ingo Wolfmayr 
> <in...@wolfix.at>
> wrote:
>
> > Hi everybody,
> >
> > I have a question regarding the pricecalculation.
> >
> > Virtual product: 1000X
> > Variants:
> > ID 10001: Default Price 100 €
> > ID 10002: Default Price 100 €
> > ID 10003: Default Price 100 €
> >
> > Variant 10002 is on sales with a pricerule that calculates 20% off.
> > (Product category with a price rule)
> >
> > Therefore: 10002: 80  €
> >
> > The price calculation service does not take into account price rules 
> > on variants. Therefore it displays 100€ unless I select the variant.
> >
> > Is there a solution/proposal how this can be done? (without changing 
> > the price).
> >
> > Thanks for any pointer,
> >
> > Ingo
> >
>

Re: Variant Price Calculation

Posted by Rishi Solanki <ri...@gmail.com>.
As I said in my first reply the price engine works for the variant as well.
But while displaying the prices only virtual product id passed and that is
why it is not showing up. You just need to call the service with proper
parameters service will give you desired output I believe. Please try to
explore how system is showing the price after calculation and how it uses
the price on variant selection and added to cart.

I believe you just need to call the price engine with correct params and no
improvement required to achieve your requirement. Please refer out
parameters :
https://demo-trunk.ofbiz.apache.org/webtools/control/ServiceList?sel_service_name=calculateProductPrice




Rishi Solanki
Sr Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com

On Tue, Jun 27, 2017 at 6:52 PM, Ingo Wolfmayr <in...@wolfix.at>
wrote:

> Thanks for sharing the details. I belive it would be an improvment to have
> the price calulation service calulate the price for every variant
> (including price rules) instead of just taking them from the database.
>
> now:
> 1.) walk through variants
> 2.) check smallest default price (Database ProductPrice)
>
> improvement?
> 1.) walk through variants
> 2.) calculate price for variant and check for smallest price
>
> To take the example from before:
>
> If the price is changed from 100€ to 80€ the product price is displayed as
> "from 80 €".
> If I add a price rule with -20% from 100€ it says "100€" as the price rule
> is not considered.
>
> The actual logic of the price calculation service looks up the smallest
> price, but without considering a price rule behind a variant. I think it
> would be nice if it does, or am I wrong?
>
> Ingo
>
> -----Ursprüngliche Nachricht-----
> Von: Rishi Solanki [mailto:rishisolankii@gmail.com]
> Gesendet: Dienstag, 27. Juni 2017 11:52
> An: ofbizuser <us...@ofbiz.apache.org>
> Betreff: Re: Variant Price Calculation
>
> Details you have shared for the price rule working, is working as expected
> and implemented accordingly. That means, the price engine returns the exact
> price when we pass the variant id to it. So I think on purchase you should
> able to get the product as per the rule setup.
>
> I guess your problem is not functional and you want to show the variant
> price/discount before adding them to the cart. And as while rendering the
> product system uses the virtual id to extract the price information so it
> is not showing.
>
> In general, if product and price setup is as per the details shared in the
> email by you. You may need to extract product price for the product you
> want to show before rendering and customize the product rendering logic
> accordingly.
>
> Alternatively, change the product setup treat them as separate finished
> good. System will automatically render the discounted product price.
>
>
> Alternative way is not recommended as we are manipulating the virtual
> variant associated products to consider them as finished good. But it
> should quickly resolve your problem
>
>
>
> Rishi Solanki
> Sr Manager, Enterprise Software Development HotWax Systems Pvt. Ltd.
> Direct: +91-9893287847
> http://www.hotwaxsystems.com
>
> On Mon, Jun 26, 2017 at 11:45 PM, Ingo Wolfmayr <in...@wolfix.at>
> wrote:
>
> > Hi everybody,
> >
> > I have a question regarding the pricecalculation.
> >
> > Virtual product: 1000X
> > Variants:
> > ID 10001: Default Price 100 €
> > ID 10002: Default Price 100 €
> > ID 10003: Default Price 100 €
> >
> > Variant 10002 is on sales with a pricerule that calculates 20% off.
> > (Product category with a price rule)
> >
> > Therefore: 10002: 80  €
> >
> > The price calculation service does not take into account price rules
> > on variants. Therefore it displays 100€ unless I select the variant.
> >
> > Is there a solution/proposal how this can be done? (without changing
> > the price).
> >
> > Thanks for any pointer,
> >
> > Ingo
> >
>

AW: Variant Price Calculation

Posted by Ingo Wolfmayr <in...@wolfix.at>.
Thanks for sharing the details. I belive it would be an improvment to have the price calulation service calulate the price for every variant (including price rules) instead of just taking them from the database.

now:
1.) walk through variants 
2.) check smallest default price (Database ProductPrice)

improvement?
1.) walk through variants
2.) calculate price for variant and check for smallest price

To take the example from before:

If the price is changed from 100€ to 80€ the product price is displayed as "from 80 €".
If I add a price rule with -20% from 100€ it says "100€" as the price rule is not considered.

The actual logic of the price calculation service looks up the smallest price, but without considering a price rule behind a variant. I think it would be nice if it does, or am I wrong?

Ingo

-----Ursprüngliche Nachricht-----
Von: Rishi Solanki [mailto:rishisolankii@gmail.com] 
Gesendet: Dienstag, 27. Juni 2017 11:52
An: ofbizuser <us...@ofbiz.apache.org>
Betreff: Re: Variant Price Calculation

Details you have shared for the price rule working, is working as expected and implemented accordingly. That means, the price engine returns the exact price when we pass the variant id to it. So I think on purchase you should able to get the product as per the rule setup.

I guess your problem is not functional and you want to show the variant price/discount before adding them to the cart. And as while rendering the product system uses the virtual id to extract the price information so it is not showing.

In general, if product and price setup is as per the details shared in the email by you. You may need to extract product price for the product you want to show before rendering and customize the product rendering logic accordingly.

Alternatively, change the product setup treat them as separate finished good. System will automatically render the discounted product price.


Alternative way is not recommended as we are manipulating the virtual variant associated products to consider them as finished good. But it should quickly resolve your problem



Rishi Solanki
Sr Manager, Enterprise Software Development HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com

On Mon, Jun 26, 2017 at 11:45 PM, Ingo Wolfmayr <in...@wolfix.at>
wrote:

> Hi everybody,
>
> I have a question regarding the pricecalculation.
>
> Virtual product: 1000X
> Variants:
> ID 10001: Default Price 100 €
> ID 10002: Default Price 100 €
> ID 10003: Default Price 100 €
>
> Variant 10002 is on sales with a pricerule that calculates 20% off.
> (Product category with a price rule)
>
> Therefore: 10002: 80  €
>
> The price calculation service does not take into account price rules 
> on variants. Therefore it displays 100€ unless I select the variant.
>
> Is there a solution/proposal how this can be done? (without changing 
> the price).
>
> Thanks for any pointer,
>
> Ingo
>

Re: Variant Price Calculation

Posted by Rishi Solanki <ri...@gmail.com>.
Details you have shared for the price rule working, is working as expected
and implemented accordingly. That means, the price engine returns the exact
price when we pass the variant id to it. So I think on purchase you should
able to get the product as per the rule setup.

I guess your problem is not functional and you want to show the variant
price/discount before adding them to the cart. And as while rendering the
product system uses the virtual id to extract the price information so it
is not showing.

In general, if product and price setup is as per the details shared in the
email by you. You may need to extract product price for the product you
want to show before rendering and customize the product rendering logic
accordingly.

Alternatively, change the product setup treat them as separate finished
good. System will automatically render the discounted product price.


Alternative way is not recommended as we are manipulating the virtual
variant associated products to consider them as finished good. But it
should quickly resolve your problem



Rishi Solanki
Sr Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com

On Mon, Jun 26, 2017 at 11:45 PM, Ingo Wolfmayr <in...@wolfix.at>
wrote:

> Hi everybody,
>
> I have a question regarding the pricecalculation.
>
> Virtual product: 1000X
> Variants:
> ID 10001: Default Price 100 €
> ID 10002: Default Price 100 €
> ID 10003: Default Price 100 €
>
> Variant 10002 is on sales with a pricerule that calculates 20% off.
> (Product category with a price rule)
>
> Therefore: 10002: 80  €
>
> The price calculation service does not take into account price rules on
> variants. Therefore it displays 100€ unless I select the variant.
>
> Is there a solution/proposal how this can be done? (without changing the
> price).
>
> Thanks for any pointer,
>
> Ingo
>