OpenCart 3: Sorting product list in invoice

Most of orders contain 1-2 items, but there could be 10+ and it becomes a problem to follow the invoice and picking items from the shelves. Any field of your choice: model, sku, etc. Here is an example how to update invoice and packing list (vqmod format):

<?xml version="1.0" encoding="utf-8"?>
  <id>For OpenCart</id>
  <author>alex cherednichenko</author>

  <file name="admin/controller/sale/order.php">
    <operation error="skip">
      <search position="before" index="2,3">
        $data['orders'][] = array(
// alcher
        array_multisort(array_map(function($element) {
          return $element['model'];
        }, $product_data), SORT_ASC, $product_data);
// alcher				

Source: 3 solutions for sorting multidimensional arrays by child keys or values in PHP

Leave a Reply

Your email address will not be published. Required fields are marked *