| Michael Peacock 2004-08-17, 5:56 pm |
| Hi all :
WCS BE 5.4 -
We have a requirement to display bracket pricing for items in the
ResultListAvailability and in the RequisitionListUpdate pages. The price
bracket quantities are stored in the Offer.MinimumQuantity and
Offer.MaximumQuantity columns for each catentry, and the price for each
bracket is stored in the OfferPrice.Price column.
Now the fun part - we need to be able to display the price brackets using
the price adjustments based on the current active contract.
For example, if item A has 3 price brackets like so:
1-99 : $10.00
100-999: $9.00
1000 and more : $8.00
and the current contract has a discount of 10%, we need to be able to
display:
1-99 : $9.00
100-999 : $8.10
1000 and more : $7.20
So - here's where I am:
I can easily pull the price bracket quantities by using the offer like so
(assume theCatEntryID is the id of the current item, prices in USD):
Enumeration offerAccessBeans = new OfferAccessBean().findByItem( new
Long( theCatEntryID ));
if (offerAccessBeans != null && offerAccessBeans.hasMoreElements() )
{
while (offerAccessBeans.hasMoreElements())
{
OfferAccessBean theOffer = (OfferAccessBean)
offerAccessBeans.nextElement();
String minBreak = theOffer.getMinimumQuantity() ;
String maxBreak = theOffer.getMaximumQuantity() ;
String price = theOffer.getPrice("USD").getPrice();
}
// Add to collection for display - omitted
}
Fine - now I have base prices. What I need to be able to do is get the
contract price for the quantity specified in the current offer's
MinimumQuantity field.
I *think* I'm going to have to extend the
com.ibm.commerce.catalog.beans.ItemDataBean and add a method similar to
getCalculatedContractPrice() but which would return the calculated contract
price for each offer quantity.
Anyone have a comment on whether this is a workable approach - or if there's
a better approach? Also - any pitfalls I should be aware of here? The
whole contract/terms and conditions/ offers system is a bit daunting at
first glance.
Cheers, Michael
|