itx Posted August 23, 2013 Share Posted August 23, 2013 (edited) I have this problem: A customer place order multiple times before the customer pay the previous order(s), then the customer ultimately pay only one order. Thus i have lots of abandoned orders (about one out of ten orders). This is a problem because i have only limited stock. Some products marked as out of stock are actually in stock but held by orders that eventually abandoned. what i want is a customer can't place any more order before the customer pay for the previous order. The customer must pay the previous order (status: payment accepted) or ask the admin to cancel the previous order (status: canceled ) so the customer can place another order. It would be nice if this is a feature of prestashop. thanks for any help Edited August 26, 2013 by itx (see edit history) Link to comment Share on other sites More sharing options...
itx Posted August 26, 2013 Author Share Posted August 26, 2013 anyone? Link to comment Share on other sites More sharing options...
itx Posted August 26, 2013 Author Share Posted August 26, 2013 Finally I can solve the problem after digging in the code. place this inside controllers/front/OrderController.php within function init() if ($orders = Order::getCustomerOrders($this->context->customer->id)) { $statuses=array(1,8,10,11); //ids of the statuses that should be resolved before the customer can add another order. foreach ($orders as &$order) { if (in_array($order['id_order_state'],$statuses)) { if ($order['reference']) $this->errors[] = sprintf( Tools::displayError('You must pay order with the reference %s to place a new order. You can also ask our Customer Service to cancel the order so you can place a new order.'),$order['reference']); else $this->errors[] = Tools::displayError('You must pay your previous order to place a new order. You can also ask our Customer Service to cancel the order so you can place a new order.'); break; } } } of course we can make this patch as overrides. hope this help someone else Link to comment Share on other sites More sharing options...
Recommended Posts