View Single Post
Old 03-12-2021, 09:42 AM
Ed B. Ed B. is online now

Join Date: Apr 2016
Posts: 429

Default Re: Sort Order of Packing Slip

OK, here is something that might be more useful. the twig file gives
{% for index, item in this.orderItems %} <tr>{{ widget_list('packing_slip.item', item=item) }}</tr> {% endfor %}
And, it doesn't seem that the array $this->getOrderItems() is given any specific sorting order (maybe I have simply been unable to spot the place where it is done). So basically it is your sql server orders that fetches order items by ascending order of product id (which is logic since that is the index column). So I guess you can either decorate the function getOrderItems() in the view class, or you can use php array sorting function to sort the array $this->getOrderItems() once fed to the twig file.
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote