KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: Iruñea on December 22, 2008, 10:58:16 am

Title: new order total
Post by: Iruñea on December 22, 2008, 10:58:16 am
Hello

Ive created a new order total module. Into the method
public OrderTotal getOrderTotal(Order order, boolean dispPriceWithTax, Locale locale){...}

I want to know how many products are in the order but when I try to get this by order.getNumProducts() it gives me 0.
If I make a order.getId() it also gives me 0.

However when I make order.getSubTotalExTax() it gives the correct amount so, the cuestion is; how can I get the full populated Order ??

Thanks!
Title: Re: new order total
Post by: trevor on December 22, 2008, 11:23:21 am
The order hasn't been saved yet at this point so we don't have an id. The array of OrderProducts contains all of the products.
Title: Re: new order total
Post by: Iruñea on December 22, 2008, 11:40:21 am
Perfect, thanks a lot !
Title: Re: new order total
Post by: Iruñea on December 22, 2008, 12:50:15 pm
Ive still a problem. The order total amount is calculated correctly but iIt doesn't add this price automatically to the TOTAL PRICE OF THE ORDER. In theory this add to be done automatically:

Quote...You don't need to do anything else as long as the "Total" module is placed at the bottom of the list of order total modules. In this case it should automatically create a total using your new module(s) as well as any other modules above it (i.e. discount, shipping, sub total etc.)


But it does not. So the cuestion is: In which class/method is sumed all this amounts to the total Price of the order??
If its in order.getTotalIncTax(), where can I find it?


Thank you
Title: Re: new order total
Post by: trevor on December 22, 2008, 12:59:34 pm
Ok. What you need to do is to get your Order Total module to to add or subtract its amount from the total of the order when it is called.

e.g. order.setTotalIncTax(order.getTotalIncTax().subtract(myOt.getValue()));
Title: Re: new order total
Post by: Iruñea on December 22, 2008, 01:05:21 pm
Thank you Trevor,
thats the answer I was looking for !!
:)