![]() |
Order by productcode
Can anyone tell me how to get my products to order by productcode rather than by productid.
Do I need to change an sql query or template or what? I just can't seem to find where the products are ordered for products.tpl. :? |
In the /xcart/customer/ directory: products.php
Original query: Code:
# I believe you just need to add the ORDER BY clause in here, like this: Code:
# hope this helps. |
?
Thanks for the reply! :)
That didn't seem to work. I think that there is some other "order by" statement somewhere that might be overriding this attempt to order. Any other ideas? :?: |
Try this for the $search_query code:
Code:
$search_query = "($sql_tbl[products].categoryid='$cat' or $sql_tbl[products].categoryid1='$cat' or $sql_tbl[products].categoryid2='$cat' or $sql_tbl[products].categoryid3='$cat') and $sql_tbl[products].forsale='Y' group by $sql_tbl[products].productid order by $sql_tbl[products].productcode ".($config["General"]["product_order_reversed"]=="Y"?"desc":"asc")." limit $first_page, ".$config["General"]["products_per_page"]; If that doesn't work, look at this thread regarding sorting the products list: http://forum.x-cart.com/viewtopic.php?t=677 Or this one: http://forum.x-cart.com/viewtopic.php?t=1277 LOTS of info in there - you just have to extrapolate what you need for your purposes. hope this helps. |
Got it!
Thanks for the help. I was able to figure it out using one of those links that you gave me.
Cheers :D |
All times are GMT -8. The time now is 03:21 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.