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

Alphabetizing the products on search

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-18-2003, 12:32 PM
 
Blackhawk Blackhawk is offline
 

Senior Member
  
Join Date: Dec 2002
Location: United States
Posts: 101
 

Default Alphabetizing the products on search

Has anyone written a script to alphabetize the products on the search and on the category drill downs?
Reply With Quote
  #2  
Old 02-19-2003, 01:09 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

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.

__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #3  
Old 02-19-2003, 11:21 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

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"];
__________________
ex x-cart guru
Reply With Quote
  #4  
Old 02-20-2003, 05:56 AM
 
Blackhawk Blackhawk is offline
 

Senior Member
  
Join Date: Dec 2002
Location: United States
Posts: 101
 

Default Thx

Thanks Funky I'll try this out now.
Reply With Quote
  #5  
Old 03-04-2003, 01:14 PM
 
tcatrainer tcatrainer is offline
 

Advanced Member
  
Join Date: Nov 2002
Location: LI, NY
Posts: 50
 

Default 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
Reply With Quote
  #6  
Old 03-04-2003, 10:43 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

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.
__________________
ex x-cart guru
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:29 AM.

   

 
X-Cart forums © 2001-2020