Need to get the price of an item that has a sales or purchase agreement? The PriceDisc class is here to save us!

PriceDisc: getting prices the right way 1
Trying to catch the best price using the PriceDisc framework

This is one of those reference posts that I’m writing for the Adrià of the future, because it’s something I forget about a lot.

PriceDisc magic!

There’s an obsolete method, I think it was findItemPriceAgreement, to get the price, but it’s obsolete, as I’ve just said. So the easiest way to get a price is to use the PriceDisc class that replaces the obsolete method.

To use it, just instantiate a PriceDiscParameters object and call all the parm methods you need. Finally, create a PriceDisc object using the newFromPriceDiscParameters method and passing the PriceDiscParameters, and… well take a look at the code below:

And that’s all. I know it’s a stupid post, but so am I and forget this kind of things.


Receive an email when a new post is published

Write A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.