bigpedro Posted January 8, 2013 Share Posted January 8, 2013 Have a client who would like to display the products on the packing sheet in numerical order sorted by the product code. Does anybody have any idea how I would do this? I assume it would be in the templates/print.receipt file? Quote Link to comment Share on other sites More sharing options...
bsmither Posted January 8, 2013 Share Posted January 8, 2013 There are two ways to do this: Modify the query used to pull the items for an order to sort the resulting recordset. Build a complex Smarty plugin function as a modifier to sort the array of items that was given to the template engine. In the admin file /sources/orders.index.inc.php, at around line 423, find: if (($inventory = $GLOBALS['db']->select('CubeCart_order_inventory', false, array('cart_order_id' => $summary['cart_order_id']))) !== false) { add the new part: if (($inventory = $GLOBALS['db']->select('CubeCart_order_inventory', false, array('cart_order_id' => $summary['cart_order_id']), array('product_code'=>'ASC'))) !== false) { There is no single PHP function that will sort an array based on the kth-dimension value. So we will skip that effort. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.