First of all i created an order total module that alters the product price according to a quantity range, but now i'd like to know if it is possible to show the discount directly on item description.
I need to show something like
Name of the item!
1 x 17 €
15 x 16 €
30+ x 15 €
But i didnt find out how to do it without having to go through an order to get the getApplicableProducts() and the promotion.
Is it possible to get all the promotions? how can i do that?
Is there another way more direct to get the discounts for each product?
Thansk in advance,
Pedro
The promotions normally need the order information to be calculated correctly because they could depend on a minimum order amount or there could be multiple active promotions and only one can be selected etc.
Maybe what you should do is to make your promotion discounts data driven based on configuration variables for the promotion and to read the same variables in the application in order to display the correct prices.
And how can i get the list of all promotions of certain type without going throuhg an order.
If I can read all the promotions set on konakartadmin i can then show the price based on the items it affects.
The Admin API will give you a list of promotions if you just want a simple list. However, the powerful aspect of passing an order to the API is that it will figure out whether the promotion actually applies to the order by evaluating the list of rules attached to the promotion.
Yeah but i need to show on items the promotions, so that client knows of the promotion.
For example on konakartadmin i will have a promotion for a +10 pencils that will cost 1€ instead of 2€.
On pencil detail i will have the following:
buy 1 per 2€
buy 10 for 1€ each
After that when the order is made the discount is applied.
So how can i get a list of the promotions?
The following code works for konakart:
try {
server = new URL("http://localhost:8080/konakart/services/KKWebServiceEng");
} catch (MalformedURLException e) {
out.print(e);
}
KKWSEngIf eng = new KKWSEngIfServiceLocator().getKKWebServiceEng(server);
Can i do something similiar for konakartadmin?
Thanks
Yes, the Admin Eng has a full set of SOAP APIs.
Why can't use this directly on opencms?
URL server = null;
try {
server = new URL("http://localhost:8080/konakartadmin/services/KKWSAdmin");
} catch (MalformedURLException e) {
}
//KKAdminCustomEng
// Get the products from the KonaKart engine using a SOAP call
KKWSAdminIf eng = new KKWSAdminIfServiceLocator().getKKWSAdmin(server);