PrestashopEnthu Posted March 1, 2018 Share Posted March 1, 2018 (edited) I am executing a default hook called hookActionProductCancel(). The hook is executing my codes well but there is a portion that is executing more than once based on the refund/return quantity sent. Example: If I were to refund/return 3 items (checkboxes), my order will have 3 "Refund" status in order detail history. public function hookActionProductCancel($params) { $query = new DbQuery(); $query->select('id_order_state') ->from('order_state_lang') ->where('name = ' . "'Refund'"); $refund_status = Db::getInstance()->getValue($query); $objOrder = new Order($id_order); $history = new OrderHistory(); $history->id_order = (int)$objOrder->id; $history->id_employee = $cookie->id_employee; $history->changeIdOrderState($refund_status, (int)($objOrder->id)); $history->add(true); $history->save(); } Any guidance is truly appreciated. Thank you. Edited March 1, 2018 by Enthu86 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now