Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Sort Order of Packing Slip

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 02-25-2020, 01:26 PM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default 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
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #2  
Old 02-25-2020, 03:19 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

Default 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.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 01-10-2021, 10:45 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: Sort Order of Packing Slip

the packing slip is difficult as it's not a page in the browser to investigate
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #4  
Old 03-08-2021, 02:58 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Re: Sort Order of Packing Slip

I'm still struggling with this, I can't even find func.order.php or func.product.php!
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #5  
Old 03-09-2021, 08:41 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default 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...
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #6  
Old 03-12-2021, 09:42 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default 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.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:12 AM.

   

 
X-Cart forums © 2001-2020