Jump to content

Weird cart/order validation behaviour


Recommended Posts

I'm trying to be out in good time and update some of my modules for 1.5, but I've hit a rock. I have a payment module that worked wonders in 1.4.x and added an extra fee for invoice. It works like this:

 

- Send customer to payment processor.

- Charges invoice fee along with the order total.

- When the customer returns to the validation.php we have to add the invoice fee that was just debited, along with the cart products and shipping.

 

Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'cart_product (id_cart, id_product, id_product_attribute, quantity, date_add) VALUES('.intval($cart->id).','.$feeproduct->id.',0,1,\''.pSql(date('Y-m-d h:i:s')).'\')');
$cart = new Cart((int)$cart->id);

 

- Then we call the validation, $obj_invoice->validateOrder(...

 

In 1.5 the order seems to be created before the products were added to the cart. The cart itself is updated when I check under Shopping Carts, but the order only contains the products and gives error about customer having paid too much.

 

Any ideas?

Link to comment
Share on other sites

×
×
  • Create New...