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)
-   -   Alphabetizing the products on search (https://forum.x-cart.com/showthread.php?t=1553)

Blackhawk 02-18-2003 12:32 PM

Alphabetizing the products on search
 
Has anyone written a script to alphabetize the products on the search and on the category drill downs?

B00MER 02-19-2003 01:09 PM

Not that I'm aware of, it should only be a matter of modifing the SQL query for the search to ORDER BY a certain field.

;)

funkydunk 02-19-2003 11:21 PM

The file to amend is the the customer/products.php file

Line 61 is:

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].orderby ".($config["General"]["product_order_reversed"]=="Y"?"desc":"asc")." limit $first_page, ".$config["General"]["products_per_page"];



Change this to:

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[pricing].product ".($config["General"]["product_order_reversed"]=="Y"?"desc":"asc")." limit $first_page, ".$config["General"]["products_per_page"];


Blackhawk 02-20-2003 05:56 AM

Thx
 
Thanks Funky I'll try this out now.

tcatrainer 03-04-2003 01:14 PM

one (big) step further?
 
I have what info my search results display by modifiing products.tpl
I added a header row that has
Manufacturer / Part Number / Description / Price US$ (Euro) /

Can you do an advanced search and then make each of these headers a link that does an "order by" by that field in the db. The problem here in I think is that the search has already been done. we would need to re-execute the search and the order by would be determined by which link the user clicks. The trick is to save what choices and text teh user entered when the first did teh advanced search.

basically want to make the results display as in mysimon.com: http://www.mysimon.com/isrch/index.jhtml?c=videogamesrevised&pgid=shop&InputTit le=rugby&InputKeyword=&In...036_0251543705

funkydunk 03-04-2003 10:43 PM

This is possible but would rather some changes to the PHP scripts aswell as the templates.

If we are talking about the SEARCH side of things then I would put a hidden field in the advanced search template and the search part in head.tpl called something like 'sortby' and set this to be 'product'.

Then within the search.php file amend the sql query to order by $sortby.

Then make the links at the top of each column in your results links that pass on the existing string of variables and a new $sortby variable.


All times are GMT -8. The time now is 04:16 PM.

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