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

Improved Search Function

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #71  
Old 08-06-2004, 12:36 PM
 
longhorn180 longhorn180 is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Richmond, Virginia
Posts: 187
 

Default

I started another thread on the search function for 4.0.1, but realize that this is probably where i should post my concerns and issues. When I search for books by author on my site I have to input the name into the search field like this: 'king, stephen' or just 'king' to get results. If I enter 'stephen king' then I get no matches. Obviously the author field is in the lastname, firstname format in the database, but I've got too many products to go back and change them all now. I don't have this issue on my live store(3.4.14) because of the code I used from this thread. If there is anyone with knowledge of php willing to make the changes necessary to the include/search.php to allow a more user friendly search in 4.0.1, I would sure appreciate the help.
Reply With Quote
  #72  
Old 08-08-2004, 05:43 AM
 
nfc5382 nfc5382 is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 478
 

Default

oh man, not again with 4.0! xcart should really change the search capabilities in the current code baseline...
__________________
-----------------------
x-cart v4.7.6 [LIVE]
x-cart v4.0.18 [retired 2004-2016]
x-cart v3.5.13 [retired]
x-cart v3.4.14 [retired]
Reply With Quote
  #73  
Old 08-08-2004, 08:47 AM
 
NuAlpha NuAlpha is offline
 

X-Adept
  
Join Date: Aug 2003
Location: US
Posts: 598
 

Default

Quote:
Originally Posted by nfc5382
oh man, not again with 4.0! xcart should really change the search capabilities in the current code baseline...

It is harder than you might think to write a real quality search algorithm. Look how long it took for a "Google" to show up on the scene. Though I do admit, a little more work and the search function in Xcart could do a whole lot better.
__________________
X-Cart Pro 4.5.5 Platinum
X-Payments 1.0.6
PHP 5.3.14
MySQL 5.1.68
Apache 2.2.23
Reply With Quote
  #74  
Old 08-27-2004, 03:10 PM
 
longhorn180 longhorn180 is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Richmond, Virginia
Posts: 187
 

Default

Has anyone been able to find a solution to this yet?
__________________
4.1.9 (Linux) Live Store
www.thecrackedbook.com
Find used books and out of print books.
Reply With Quote
  #75  
Old 09-01-2004, 05:11 AM
 
longhorn180 longhorn180 is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Richmond, Virginia
Posts: 187
 

Default

OK, still under development with 4.0.3 and I've manually gone in and added more product fields instead of using the extra fields option since I don't like the way you have to import into extra fields. I then went into the customer/search.tpl and edited that to show the extra fiels in the search options. Then I edited include/search.php and changed the code under the substring by changing this:

Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["extra_fields"])) { $search_data["products"]["by_title"] = $data["by_title"] = "Y"; $flag_save = true; } # Search for substring in some fields... if (!empty($data["by_title"])) $condition[] = "$sql_tbl[products].product LIKE '%".$data["substring"]."%'"; if (!empty($data["by_shortdescr"])) $condition[] = "$sql_tbl[products].descr LIKE '%".$data["substring"]."%'"; if (!empty($data["by_fulldescr"])) $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$data["substring"]."%'";

to this:

Code:
if (empty($data["by_title"]) && empty($data["by_author"]) && empty($data["by_isbn"]) && empty($data["by_subtitle"]) && empty($data["by_series"]) && empty($data["by_publisher"]) && empty($data["extra_fields"])) { $search_data["products"]["by_title"] = $data["by_title"] = "Y"; $flag_save = true; } # Search for substring in some fields... if (!empty($data["by_title"])) $condition[] = "$sql_tbl[products].product LIKE '%".$data["substring"]."%'"; if (!empty($data["by_author"])) $condition[] = "$sql_tbl[products].author LIKE '%".$data["substring"]."%'"; if (!empty($data["by_isbn"])) $condition[] = "$sql_tbl[products].isbn LIKE '%".$data["substring"]."%'"; if (!empty($data["by_subtitle"])) $condition[] = "$sql_tbl[products].subtitle LIKE '%".$data["substring"]."%'"; if (!empty($data["by_series"])) $condition[] = "$sql_tbl[products].series LIKE '%".$data["substring"]."%'"; if (!empty($data["by_publisher"])) $condition[] = "$sql_tbl[products].publisher LIKE '%".$data["substring"]."%'";

and it works great, with 1 exception. Like posted earlier, the author data is stored in lastname, firstname format in the database and unless someone types it that way into the search field then they get 0 results found. I don't want to change the way I store it in the database, but I really need customers to be able to search for author by being able to type robert ludlum instead of being forced to type ludlum, robert. Does anyone have any ideas about how I might do this?
__________________
4.1.9 (Linux) Live Store
www.thecrackedbook.com
Find used books and out of print books.
Reply With Quote
  #76  
Old 09-18-2004, 08:31 AM
 
ifalu ifalu is offline
 

Member
  
Join Date: Oct 2003
Posts: 28
 

Default Version 4.0.4

I was able to implement this mod in version 3.5.0 But now I am confused in what to do for version 4.0.x Can anyone summarize what is needed in order to implement this mod. I don't want to copy paste code from this thread!!

Thanks
Ian
Reply With Quote
  #77  
Old 09-19-2004, 12:26 AM
 
funkydunk funkydunk is offline
 

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

Default

i am amazed (or rather really disappointed) that the xcart team did not build this code into version 4 to get a search that at least works.

the standard xcart search is appalling (it makes the search on this forum look good) and is not something that any of us should be happy to give to a customer or client to use for searching for a product.

RRF - please sort it out
__________________
ex x-cart guru
Reply With Quote
  #78  
Old 09-19-2004, 05:51 AM
 
ifalu ifalu is offline
 

Member
  
Join Date: Oct 2003
Posts: 28
 

Default It is true that the search function could be better but

the solution in this thread works great. Can I do the same mods in 4/0.x?

Thanks

Ian
Gold 4.0.4
Reply With Quote
  #79  
Old 09-19-2004, 05:53 AM
 
BHMedia BHMedia is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 71
 

Default

Does anyone read what other people say in these forums?
*sigh*
Reply With Quote
  #80  
Old 09-19-2004, 06:12 AM
 
ifalu ifalu is offline
 

Member
  
Join Date: Oct 2003
Posts: 28
 

Default Ca you point to a thread?

All I am asking is for someone with more knwoledge than me to summarize, what is exactly needed to do in 4.0.x Or confirm that by copy and pasting these codes I shuldn't have any problems.

Thanks

Ian
Gold 4.0.4
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 05:37 PM.

   

 
X-Cart forums © 2001-2020