BJ Not much chance this bit of code will be useful to the extended community. This is pretty weird from most of my customers. But, I hang on to it just in case.
Skip -----Original Message----- From: BJ Freeman [mailto:[EMAIL PROTECTED] Sent: Sunday, September 30, 2007 11:17 AM To: [email protected] Subject: Re: Complicated pricing it would seem the easiest to so put your service in your module /specilized/skipdever/servicedefs and call it calculateProductPrice_mod you code can then call it. should your code be accepted by the community then change it to calculateProductPrice send a patch via the jira [EMAIL PROTECTED] sent the following on 9/30/2007 10:50 AM: > Jonathon > > Thanks for the input. However, I guess I didn't ask the question right. > "calculateProductPrice" is defined as a service in services_pricepromo.xml > as: > > <service name="calculateProductPrice" engine="java" > location="org.ofbiz.product.price.PriceServices" > invoke="calculateProductPrice" auth="false" use-transaction="false"> > ... > > and this is loaded from ...product/ofbiz-component.xml as > <service-resource type="model" loader="main" > location="servicedef/services_pricepromo.xml"/> > > The question is, how can I override the original definition without > modifying Ofbiz code. i.e. can I put an identically named service > definition in hot-deploy or somewhere and have all of Ofbiz use my new > calculateProductPrice? > > Skip > > > -----Original Message----- > From: Jonathon -- Improov [mailto:[EMAIL PROTECTED] > Sent: Sunday, September 30, 2007 2:39 AM > To: [email protected] > Subject: Re: Complicated pricing > > > Yes, overriding that method will mean you won't touch the OFBiz codes. That > could mean you can > continue to use your custom method, while still conveniently watching the > community's updates to > the original method. > > Such a method override will also kinda "document" your custom method as > "being related to some > original OFBiz method", so you know what original OFBiz codes to use for > side-by-side comparisons > of your codes. Making huge overhauls to the original method can make it > difficult to do such > comparisons. > > One gotcha here. Make sure you fully understand the original method you're > overriding, so that you > don't break any dependencies on that method. > > As far as possible, I do try to touch as few OFBiz codes as possible. If any > OFBiz codes need to > be enhanced, it is possibly to make them more generic and more base-level or > more fine-grained or > more customizable building blocks. > > Jonathon > > [EMAIL PROTECTED] wrote: >> I have had another discussion about pricing with my customer today and the >> pricing is more complicated that I remembered. Their pricing is based on > a >> percentage above cost and package quantity, i.e. 30% above cost for one >> package (12 pieces), 25% above cost for 2 packages (24 pieces), and 100 >> percent above cost for any broken package plus a fixed abount depending on >> cost, i.e. + a buck for all below 1 dollar, + 2 for all below 5 and > nothing >> for above 10. >> >> This is outside what I see in the ofbiz pricing module in >> PriceServices.java, and so it appears as if I will have to write my own >> price calculation service. >> >> What I would like to do is write a subclass of PriceServices so my >> "calculateProductPrice" subclass gets called whenever >> runSync("calculateProductPrice") gets called. I would like to do this in >> such a way that I don't bother the core Ofbiz code as I'll still be using >> the shoppingcart, etc. >> >> Can anyone offer any advice or point me to samples? >> >> Skip >> >> > > > > >
