OpenCart 3: Sorting product list in invoice

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

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"?>
  <modification>
  <id>For OpenCart</id>
  <version>3.0.3.2</version>
  <vqmver>2.5.1</vqmver>
  <author>alex cherednichenko</author>
  <link><![CDATA[https://www.alcher.info]]></link>

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


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

Yandex.Metrica