X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Sort Order of Packing Slip (https://forum.x-cart.com/showthread.php?t=77671)

amy2203 02-25-2020 01:26 PM

Sort Order of Packing Slip
 
Is there a way to change the sort order of the packing slip?

It would be much easier for us to pick.pack if it was sorted by SKU. It seems quite random at the moment

cflsystems 02-25-2020 03:19 PM

Re: Sort Order of Packing Slip
 
I think the default sorting is by item id which is the order products were added to cart. So it is not random but yes makes no sense most of the time.
It could be also product title, can't remember.


You will have to modify the way items are selected within the order and set sorting by whatever you need it to be. It will be a sql query either in func.order.php or func.product.php
But you need to find the starting point that calls the "select orders" for the packing slip.

amy2203 01-10-2021 10:45 AM

Re: Sort Order of Packing Slip
 
the packing slip is difficult as it's not a page in the browser to investigate :(

amy2203 03-08-2021 02:58 AM

Re: Sort Order of Packing Slip
 
I'm still struggling with this, I can't even find func.order.php or func.product.php!

Ed B. 03-09-2021 08:41 AM

Re: Sort Order of Packing Slip
 
I would take a look into /skins/admin/order/packing_slip/parts/body/items.twig classes/XLite/View/PackingSlip.php (these are the files responsible for outputting packing slips) and classes/Model/Repo/Order.php, classes/Model/Repo/Product.php (these are the places where the details of sorting are defined), and maybe classes/Model/Order.php classes/Model/Product.php (these classes should contain sorting methods). Well, I know, this is kind of lots of places to look...

Ed B. 03-12-2021 09:42 AM

Re: Sort Order of Packing Slip
 
OK, here is something that might be more useful. the twig file gives
Code:

  {% 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.


All times are GMT -8. The time now is 01:48 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.