X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Sort order on order_data.tpl (https://forum.x-cart.com/showthread.php?t=61524)

mcpilot 11-08-2011 07:51 AM

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

qualiteam 11-16-2011 03:04 AM

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.

masada3336 01-15-2012 03:44 PM

Re: Sort order on order_data.tpl
 
Is there a way to order it alphabetically also by category?
Thanks Alex!

qualiteam 01-18-2012 10:28 PM

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.

nmartin 02-06-2012 09:59 AM

Re: Sort order on order_data.tpl
 
Is there a way to sort by SKU?

qualiteam 02-07-2012 01:09 AM

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"); 


nmartin 02-08-2012 08:14 AM

Re: Sort order on order_data.tpl
 
Perfect, thanks for your help.


All times are GMT -8. The time now is 03:54 PM.

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