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

Sort order on order_data.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-08-2011, 07:51 AM
 
mcpilot mcpilot is offline
 

Advanced Member
  
Join Date: Dec 2004
Location: Cincinnati
Posts: 68
 

Default Sort order on order_data.tpl

I'd like to sort my products alphabetically in the invoice that gets emailed out

Is this possible in 4.1.8? I am looking at order_data.tpl

Thanks
__________________
thebookfarminc.com
Version 4.7.0
Reply With Quote
  #2  
Old 11-16-2011, 03:04 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Sort order on order_data.tpl

Yes, but you should modify the "include/func/func.order.php" script "func_order_data" function.

Replace this code fragment:
PHP Code:
$products func_query("SELECT $sql_tbl[order_details].itemid, $sql_tbl[products].*, $sql_tbl[order_details].*, IF($sql_tbl[products].productid IS NULL, 'Y', '') as is_deleted, IF($sql_tbl[order_details].product = '', $sql_tbl[products].product, $sql_tbl[order_details].product) as product $fields FROM $sql_tbl[order_details] LEFT JOIN $sql_tbl[products] ON $sql_tbl[order_details].productid = $sql_tbl[products].productid $join WHERE $sql_tbl[order_details].orderid='$orderid'"); 

with this one:
PHP Code:
$products func_query("SELECT $sql_tbl[order_details].itemid, $sql_tbl[products].*, $sql_tbl[order_details].*, IF($sql_tbl[products].productid IS NULL, 'Y', '') as is_deleted, IF($sql_tbl[order_details].product = '', $sql_tbl[products].product, $sql_tbl[order_details].product) as product $fields FROM $sql_tbl[order_details] LEFT JOIN $sql_tbl[products] ON $sql_tbl[order_details].productid = $sql_tbl[products].productid $join WHERE $sql_tbl[order_details].orderid='$orderid' ORDER BY $sql_tbl[products].product"); 

Note: the products sort order will be changed in all the places where this function is used.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 01-15-2012, 03:44 PM
 
masada3336 masada3336 is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 115
 

Default Re: Sort order on order_data.tpl

Is there a way to order it alphabetically also by category?
Thanks Alex!
__________________
4.4.5 - with Customized Smart Template
Reply With Quote
  #4  
Old 01-18-2012, 10:28 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Sort order on order_data.tpl

Yes, you should alter the same function and change the SQL query.
I suppose it will slow down the query, depending on the category number in the store.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #5  
Old 02-06-2012, 09:59 AM
 
nmartin nmartin is offline
 

Member
  
Join Date: Mar 2010
Posts: 12
 

Default Re: Sort order on order_data.tpl

Is there a way to sort by SKU?
__________________
nmartin
Reply With Quote
  #6  
Old 02-07-2012, 01:09 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Sort order on order_data.tpl

Yes, sure. You should change the order by statement in SQL to productcode:

PHP Code:
$products func_query("SELECT $sql_tbl[order_details].itemid, $sql_tbl[products].*, $sql_tbl[order_details].*, IF($sql_tbl[products].productid IS NULL, 'Y', '') as is_deleted, IF($sql_tbl[order_details].product = '', $sql_tbl[products].product, $sql_tbl[order_details].product) as product $fields FROM $sql_tbl[order_details] LEFT JOIN $sql_tbl[products] ON $sql_tbl[order_details].productid = $sql_tbl[products].productid $join WHERE $sql_tbl[order_details].orderid='$orderid' ORDER BY $sql_tbl[products].productcode"); 
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #7  
Old 02-08-2012, 08:14 AM
 
nmartin nmartin is offline
 

Member
  
Join Date: Mar 2010
Posts: 12
 

Default Re: Sort order on order_data.tpl

Perfect, thanks for your help.
__________________
nmartin
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not 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 04:05 AM.

   

 
X-Cart forums © 2001-2020