You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by darrell73s <da...@gmail.com> on 2014/09/09 16:12:32 UTC

Product Pricing From Order Date

Hi All,

I am wondering if there is a configuration somewhere which can change the
behavior I am getting with an out of the box instance of OFBiz in order to
retrieve the active product prices off of the order date stamp (assuming
it's an existing order and orderDate is available) rather than the current
date stamp. 

Here's my test case:

Using demo data, I have a default price configured for GZ-1000 of $15.99,
and a default price for GZ-1001 of $25.99. I then place an order with (1)
GZ-1000 for $15.99. 

After order placement, I put a thrudate on the GZ-1001 $25.99 price, which
is AFTER the order date, and configure a new product price of $49.99. 

If I now add (1) GZ-1001 to the existing order through "Edit Items" in the
order view, the $49.99 price is added. I understand that this is because the
$49.99 price is the CURRENTLY active price, but am wondering if there's a
configuration to recalculate using the product price as it was at the time
of the order? Essentially I'm looking to add the GZ-1001 with the old price
($25.99) since that's what it was at order time.

If there's no configuration that can be changed, could this be accomplished
somehow using a price rule, or some other similar out of box functionality?

Thanks!



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Product-Pricing-From-Order-Date-tp4655035.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Product Pricing From Order Date

Posted by Vikas Mayur <vi...@gmail.com>.
OFBiz has an interesting feature to enable entity audit and you can perhaps use this to keep track of product pricing changes in database. Using a custom product price calculation service you can compare the pricing (old vs new) and provide the desired pricing to the customer. The other option would be check the pricing of the item for comparison from any earlier order but the prices here can be manipulated by the pricing engine so the first approach is correct.

Vikas

On Sep 9, 2014, at 7:42 PM, darrell73s <da...@gmail.com> wrote:

> Hi All,
> 
> I am wondering if there is a configuration somewhere which can change the
> behavior I am getting with an out of the box instance of OFBiz in order to
> retrieve the active product prices off of the order date stamp (assuming
> it's an existing order and orderDate is available) rather than the current
> date stamp. 
> 
> Here's my test case:
> 
> Using demo data, I have a default price configured for GZ-1000 of $15.99,
> and a default price for GZ-1001 of $25.99. I then place an order with (1)
> GZ-1000 for $15.99. 
> 
> After order placement, I put a thrudate on the GZ-1001 $25.99 price, which
> is AFTER the order date, and configure a new product price of $49.99. 
> 
> If I now add (1) GZ-1001 to the existing order through "Edit Items" in the
> order view, the $49.99 price is added. I understand that this is because the
> $49.99 price is the CURRENTLY active price, but am wondering if there's a
> configuration to recalculate using the product price as it was at the time
> of the order? Essentially I'm looking to add the GZ-1001 with the old price
> ($25.99) since that's what it was at order time.
> 
> If there's no configuration that can be changed, could this be accomplished
> somehow using a price rule, or some other similar out of box functionality?
> 
> Thanks!
> 
> 
> 
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Product-Pricing-From-Order-Date-tp4655035.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Product Pricing From Order Date

Posted by Anil Patel <an...@hotwaxmedia.com>.
Darrell,
Your business requirements are not addressed in current implementation. We will try to take steps in one of our next community weekends. 

Regards
Anil Patel


On Sep 16, 2014, at 1:01 PM, darrell73s <da...@gmail.com> wrote:

> Ron, Pierre, thanks for the followup
> 
> Pierre, using the 'customMethod' approach was actually my first choice
> (which is what the "Custom Price Calc Service" in Product Pricing uses). 
> 
> I mentioned in a previous post that customAttributes is empty when
> "calculateProductPrice" is being called from the shopping cart, which I
> discovered from tracing the calls back to ShoppingCartItem.updatePrice(). I
> saw the patch when the optional "customAttributes" was added to the service
> here: https://issues.apache.org/jira/browse/OFBIZ-1747. However, it doesn't
> look like any of the existing calls to the service actually populate
> "customAttributes"; just wondering if the intention was for
> "customAttributes" to be used with existing calls to "calculateProductPrice"
> or simply for future expansion. It would be helpful for example, when doing
> the custom price calc, to have a reference to the cart object, or cart
> attributes.
> 
> Just to give you a bit more insight as to what I'm trying to accomplish.
> Essentially I have an order flow where a particular customer can submit an
> order, and the customer can affix special instructions to an order which
> must be reviewed by staff before the order is marked as Approved. During
> this review process (pre-Approval), staff may add/remove products from the
> order to accomodate the special instructions. This process is required as
> some products are not visible to the customer, and must be added to the
> order manually by staff. This is why I'm trying to price the products
> retroactively to the order date, since the end user will not be able to
> select these products during order time, but still did intend on ordering
> those products at the time.
> 
> Thanks,
> Darrell
> 
> 
> 
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Product-Pricing-From-Order-Date-tp4655035p4655310.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Product Pricing From Order Date

Posted by darrell73s <da...@gmail.com>.
Ron, Pierre, thanks for the followup

Pierre, using the 'customMethod' approach was actually my first choice
(which is what the "Custom Price Calc Service" in Product Pricing uses). 

I mentioned in a previous post that customAttributes is empty when
"calculateProductPrice" is being called from the shopping cart, which I
discovered from tracing the calls back to ShoppingCartItem.updatePrice(). I
saw the patch when the optional "customAttributes" was added to the service
here: https://issues.apache.org/jira/browse/OFBIZ-1747. However, it doesn't
look like any of the existing calls to the service actually populate
"customAttributes"; just wondering if the intention was for
"customAttributes" to be used with existing calls to "calculateProductPrice"
or simply for future expansion. It would be helpful for example, when doing
the custom price calc, to have a reference to the cart object, or cart
attributes.

Just to give you a bit more insight as to what I'm trying to accomplish.
Essentially I have an order flow where a particular customer can submit an
order, and the customer can affix special instructions to an order which
must be reviewed by staff before the order is marked as Approved. During
this review process (pre-Approval), staff may add/remove products from the
order to accomodate the special instructions. This process is required as
some products are not visible to the customer, and must be added to the
order manually by staff. This is why I'm trying to price the products
retroactively to the order date, since the end user will not be able to
select these products during order time, but still did intend on ordering
those products at the time.

Thanks,
Darrell



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Product-Pricing-From-Order-Date-tp4655035p4655310.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Product Pricing From Order Date

Posted by Pierre Smits <pi...@gmail.com>.
Darrell,

You can adjust the price manually in the order after having the product
added to it. But apparently doing it manually is not enough.

You could write your own custom method that satisfies your need and tie
that in. Just search for 'customMethod' in code and documentation.

Best regards,

Pierre Smits

*ORRTIZ.COM <http://www.orrtiz.com>*
Services & Solutions for Cloud-
Based Manufacturing, Professional
Services and Retail & Trade
http://www.orrtiz.com

On Tue, Sep 16, 2014 at 4:23 PM, darrell73s <da...@gmail.com> wrote:

> Hi Anil,
>
> Thanks for the tip, I've seen that tutorial previously, but could not find
> a
> way to leverage it for what I'm trying to accomplish. Hopefully you have
> some insight on this:
>
> Essentially, an example of the scenario that I'm trying to handle is: a
> customer places an order on 09/01 with some product (shouldn't matter for
> this example). The customer calls on 09/08 and decides they want a GZ-1000
> added to the order. The GZ-1000 was $5 when the customer placed the order
> on
> 09/01, but as of 09/08 when they called, the price has increased to $10.
>
> When the GZ-1000 is added to the order, I would like to automatically give
> the customer the GZ-1000 for the price it was as of the time of the order,
> since had it been ordered at the time of order placement, it would have
> been
> at the $5 price.
>
> However, newly placed orders should still use the product prices as of the
> current time, when the items are added to the cart.
>
> Any ideas on how to accomplish something like this?
>
> Thanks,
> Darrell
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Product-Pricing-From-Order-Date-tp4655035p4655297.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Re: Product Pricing From Order Date

Posted by Ron Wheeler <rw...@artifact-software.com>.
Sounds like this should just be a line-item discount or special price 
override since it could be quite difficult to sort out which open order 
actually earns the right to use the lower price.
Do orders that are open because an item is on backorder for a few weeks 
earn this discount.
What about open orders?

Do all products fall under this policy.
Product margin might make a difference since you do not want to do this 
with stocks or industrial commodities such as gold or other precious 
metals that typically have small margins and daily price fluctuations.

When prices go down, do you charge the old higher price (not likely a 
winning policy).

Can an automatic rule be specified that covers all the cases?
Would the rule be tied to particular products or particular customers or 
particular types of open orders.

Ron

On 16/09/2014 10:23 AM, darrell73s wrote:
> Hi Anil,
>
> Thanks for the tip, I've seen that tutorial previously, but could not find a
> way to leverage it for what I'm trying to accomplish. Hopefully you have
> some insight on this:
>
> Essentially, an example of the scenario that I'm trying to handle is: a
> customer places an order on 09/01 with some product (shouldn't matter for
> this example). The customer calls on 09/08 and decides they want a GZ-1000
> added to the order. The GZ-1000 was $5 when the customer placed the order on
> 09/01, but as of 09/08 when they called, the price has increased to $10.
>
> When the GZ-1000 is added to the order, I would like to automatically give
> the customer the GZ-1000 for the price it was as of the time of the order,
> since had it been ordered at the time of order placement, it would have been
> at the $5 price.
>
> However, newly placed orders should still use the product prices as of the
> current time, when the items are added to the cart.
>
> Any ideas on how to accomplish something like this?
>
> Thanks,
> Darrell
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Product-Pricing-From-Order-Date-tp4655035p4655297.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


Re: Product Pricing From Order Date

Posted by darrell73s <da...@gmail.com>.
Hi Anil,

Thanks for the tip, I've seen that tutorial previously, but could not find a
way to leverage it for what I'm trying to accomplish. Hopefully you have
some insight on this:

Essentially, an example of the scenario that I'm trying to handle is: a
customer places an order on 09/01 with some product (shouldn't matter for
this example). The customer calls on 09/08 and decides they want a GZ-1000
added to the order. The GZ-1000 was $5 when the customer placed the order on
09/01, but as of 09/08 when they called, the price has increased to $10.

When the GZ-1000 is added to the order, I would like to automatically give
the customer the GZ-1000 for the price it was as of the time of the order,
since had it been ordered at the time of order placement, it would have been
at the $5 price.

However, newly placed orders should still use the product prices as of the
current time, when the items are added to the cart.

Any ideas on how to accomplish something like this?

Thanks,
Darrell



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Product-Pricing-From-Order-Date-tp4655035p4655297.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Product Pricing From Order Date

Posted by Anil Patel <an...@hotwaxmedia.com>.
Darrell,
I am confident that Product Price engine will get you want you want. Little more information on your "use-case” will make it easy to help you. 

May be this tutorial might be of your help, http://www.hotwaxmedia.com/apache-ofbiz-blog/ofbiz-tutorial-price-rules/

Regards
Anil Patel 

 
On Sep 14, 2014, at 6:26 PM, darrell73s <da...@gmail.com> wrote:

> Hi folks,
> 
> I couldn't find any way to leverage price rules for what I'm looking to do.
> 
> After some more research, I came across the "Custom Price Calc Service" in
> Product Pricing. It appears that this may be able to be used to accomplish
> what I'm looking for with a point in time price calculation for a product.
> However, I traced the code, and when the custom service is invoked from the
> "calculateProductPrice" service, there are limited parameters which are
> passed to the custom service, namely:
> 
> -userLogin
> -product
> -initialPrice
> -currencyUomId
> -quantity
> -amount
> -surveyResponseId
> -customAttributes
> 
> Out of these available parameters, I don't see any way to perform the
> calculation without additional parameters defining the point in time (i.e.
> order date) which to calculate the price for. 
> 
> For this, I was thinking of leveraging customAttributes to pass in either a
> timestamp to perform a point in time price calculation, or something like an
> orderId. Unfortunately, any of the out of the box calls to
> "calculateProductPrice" (such as from ShoppingCartItem) don't appear to pass
> in any "customAttributes". 
> 
> Is there any way to inject information into a customAttributes such as the
> timestamp, or orderId without modifying code? 
> 
> Alternatively, perhaps there's something already existing in the parameter
> list which would give me the information I need about what point in time the
> price should be calculated for?
> 
> Thanks for the help
> 
> 
> 
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Product-Pricing-From-Order-Date-tp4655035p4655213.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: Product Pricing From Order Date

Posted by darrell73s <da...@gmail.com>.
Hi folks,

I couldn't find any way to leverage price rules for what I'm looking to do.

After some more research, I came across the "Custom Price Calc Service" in
Product Pricing. It appears that this may be able to be used to accomplish
what I'm looking for with a point in time price calculation for a product.
However, I traced the code, and when the custom service is invoked from the
"calculateProductPrice" service, there are limited parameters which are
passed to the custom service, namely:

-userLogin
-product
-initialPrice
-currencyUomId
-quantity
-amount
-surveyResponseId
-customAttributes

Out of these available parameters, I don't see any way to perform the
calculation without additional parameters defining the point in time (i.e.
order date) which to calculate the price for. 

For this, I was thinking of leveraging customAttributes to pass in either a
timestamp to perform a point in time price calculation, or something like an
orderId. Unfortunately, any of the out of the box calls to
"calculateProductPrice" (such as from ShoppingCartItem) don't appear to pass
in any "customAttributes". 

Is there any way to inject information into a customAttributes such as the
timestamp, or orderId without modifying code? 

Alternatively, perhaps there's something already existing in the parameter
list which would give me the information I need about what point in time the
price should be calculated for?

Thanks for the help



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Product-Pricing-From-Order-Date-tp4655035p4655213.html
Sent from the OFBiz - User mailing list archive at Nabble.com.