clarkk Posted August 21, 2013 Share Posted August 21, 2013 (edited) I need to execute some code each time an order becomes an invoice.. Also the script needs to execute on both credit card transactions and bank transfer Have looked in the docs and it looks like its the "actionOrderStatusUpdate" hook I need to use? Prestashop 1.5 Hook::exec('actionOrderStatusUpdate', array( 'newOrderStatus' => $new_os, 'id_order' => (int)$order->id )); Prestashop 1.4 Hook::updateOrderStatus((int)($new_order_state), (int)($id_order)); Questions: 1. In Prestashop 1.5 I need to get $args['newOrderStatus']->id in the hook-method to check the status? 2. In Prestashop 1.4 I need to get the first argument in the hook-method to check the status? 3. How does the list of status codes look like!? Is this the correct way to do it? class My_module extends Module { // Prestashop 1.5 public function hookActionOrderStatusUpdate($params){ // Get order status echo 'new_order_status = '.$params['newOrderStatus']->id; // Get order id echo 'order_id = '.$params['id_order']; } // Prestashop 1.4 public function hookUpdateOrderStatus($new_order_status, $order_id){ // Get order status echo 'new_order_status = '.$new_order_status; // Get order id echo 'order_id = '.$order_id; } } Edited August 21, 2013 by clarkk (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts