Author Topic: Saving a new order, not using normal checkout  (Read 4108 times)

sashwill

  • Full Member
  • ***
  • Posts: 58
    • View Profile
Re: Saving a new order, not using normal checkout
« Reply #15 on: December 01, 2009, 09:13:49 AM »
This is how I fixed it because there is a bug in the save order method. I placed this in the CheckoutServerPaymentSubmitAction class just before save is called.

Code: [Select]
OrderProductIf[] orderProducts = order.getOrderProducts();
  for (OrderProductIf op : orderProducts) {
     int scale = new Integer(order.getCurrency().getDecimalPlaces()).intValue();
     op.setFinalPriceExTax(op.getPrice().multiply(new BigDecimal(op.getQuantity())).setScale(scale + 1, BigDecimal.ROUND_HALF_UP));
 }

This makes sure that when they divide in the save method it comes out with a number that is valid.

ejaen

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Re: Saving a new order, not using normal checkout
« Reply #16 on: February 11, 2010, 02:55:19 PM »
Thk's for the solution i've the same problem

impiastro

  • Jr. Member
  • **
  • Posts: 24
    • View Profile
Re: Saving a new order, not using normal checkout
« Reply #17 on: May 19, 2010, 03:38:38 AM »
Thank you sashwill, it was so helpful me too.

The trevor solution about decimal places in currency does not solve my issue.