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

Search Modification

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 03-06-2003, 01:55 AM
 
funkydunk funkydunk is offline
 

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

Default Search Modification

Just a simple work around for when a customer searches for say laptops and you have loads of product defined as laptop computer. In this instance nothing would show in the results.

This strips the s of the end for the search:

Add into customer/search.php below the:

#
# Perform SQL search query
#

if(!$substring) { $substring = $substring_sku; }

bit.

Code:
// code to strip last s from search string $substring = trim($substring); $start = (strlen($substring)-1); if ((substr($substring,$start,1)=="s")||(substr($substring,$start,1)=="S")){ $substring = substr($substring,0,$start); }

the searches for laptops will show up anything that is a laptop

Obviously it doesn't only work for laptops
__________________
ex x-cart guru
Reply With Quote
  #2  
Old 03-07-2003, 04:30 AM
 
Raju Naik Raju Naik is offline
 

Newbie
  
Join Date: Feb 2003
Location: London UK
Posts: 5
 

Default I'm seeing squares in .php files



I tried your suggested idea of getting rid of 's' at end of search words,
but when I tried to edit the /customer/search.php file, I found strange
rectangle symbols all over the place. It just looks a mess.

Do you need a special editor?

Regards

Raj
Reply With Quote
  #3  
Old 03-07-2003, 04:32 AM
 
funkydunk funkydunk is offline
 

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

Default

what were you editting it in?
__________________
ex x-cart guru
Reply With Quote
  #4  
Old 03-07-2003, 07:17 AM
 
Raju Naik Raju Naik is offline
 

Newbie
  
Join Date: Feb 2003
Location: London UK
Posts: 5
 

Default Seeing squares

I'm using the standard editor that comes with WS_FTP.

It seems to run notepad.exe.

Is there a better editor available?
Reply With Quote
  #5  
Old 03-07-2003, 07:19 AM
 
funkydunk funkydunk is offline
 

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

Default

Try opening it up in Notepad or Dreamweaver or ultraedit and it should be fine.
__________________
ex x-cart guru
Reply With Quote
  #6  
Old 03-07-2003, 08:02 AM
 
Raju Naik Raju Naik is offline
 

Newbie
  
Join Date: Feb 2003
Location: London UK
Posts: 5
 

Default Normality Resumed



I was doing a binary transfer of the PHP files and hence the squares & strange symbols.

Thanks for your help.
Reply With Quote
  #7  
Old 03-07-2003, 08:09 AM
 
funkydunk funkydunk is offline
 

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

Default

ahhh.. I should have spotted that aswell
__________________
ex x-cart guru
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 08:07 PM.

   

 
X-Cart forums © 2001-2020