Jump to content

hookActionProductCancel - Get All id_order_detail


Recommended Posts

I am trying to get the total amount of refund. I have tried the following and successfully achieve 1 item refund amount based on the refund quantity from back-office.

Can anyone point out how can I list all the id_order_detail based on the selection from refund checkboxes? It is currently only returning the latest checkbox checked for id_order_detail.

I am stuck at this point. My code are as follow:

$order = $params['order'];
$id_order = (int)$order->id;
$order_detail = new OrderDetail((int) $params['id_order_detail']);
$products = $order_detail->getList($id_order);
$id_order_detail = $order_detail->id;
$cancel_quantity = Tools::getValue('cancelQuantity');

$key = array_search($id_order_detail, array_column($products, 'id_order_detail'));
$refund = $products[$key]['unit_price_tax_incl'] * (int) $cancel_quantity[$id_order_detail];

Any guidance is truly appreciated. Hope someone has an experience handling this previously.

Thank you.

Edited by Enthu86 (see edit history)
Link to comment
Share on other sites

To got information about the returning items you need use the  OrdenReturn class I dont sure right now but I think is a function on the Order to return the id to use on the other class


Take a look on the OrderReturnController to see how they work



Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...