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
  #81  
Old 09-19-2004, 06:21 AM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Quote:
Originally Posted by BHMedia
Does anyone read what other people say in these forums?
*sigh*
All the time. Help youself out by reading the Forum Rules and the sticky threads posted in each forum.

Sometimes questions don't get answered because they are too obvious and haven't been researched. Sometimes it is because members don't have version info in their signatures. And sometimes, people just don't know an answer that they can contribute.
Reply With Quote
  #82  
Old 09-19-2004, 07:33 AM
 
ifalu ifalu is offline
 

Member
  
Join Date: Oct 2003
Posts: 28
 

Default Thanks

I believe for all the people that are not experts as you in this a straight answer would be beneficial. I am aware of the rules but I think that for us non experts a simple answer like:

For 4.0.x

do
1
2
3...

But is OK, if you don't have the time for this

Ian
GOLD 4.0.4
Reply With Quote
  #83  
Old 09-19-2004, 07:36 AM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Sure you want your answer your way, but because this is a user supported forum, sometimes you aren't going to get an answer or the one you want.

I don't use this mod anymore, I can't help you. My advice, is to help yourself.
Reply With Quote
  #84  
Old 11-22-2004, 07:02 AM
 
ProjectShadow ProjectShadow is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 55
 

Default

Hey, anyway to get the sub-cats to show up in the categories drop-down?
__________________
Adam L Golson
X-Cart v3.5.11 [Linux]
Reply With Quote
  #85  
Old 11-23-2004, 12:06 AM
 
ProjectShadow ProjectShadow is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 55
 

Default

TTT
__________________
Adam L Golson
X-Cart v3.5.11 [Linux]
Reply With Quote
  #86  
Old 11-25-2004, 10:49 PM
 
ProjectShadow ProjectShadow is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 55
 

Default

.....???
__________________
Adam L Golson
X-Cart v3.5.11 [Linux]
Reply With Quote
  #87  
Old 12-18-2004, 12:18 PM
 
guphed guphed is offline
 

Newbie
  
Join Date: Jun 2004
Location: Newton-le-Willows, UK
Posts: 4
 

Default

Well I think this thread started out by being a mod for changing the exact phrase search to multiple word search before it deviated somewhat before anybody had posted any code for v4.x so I've had to have a pop myself...

This seems to work for me, although I don't use Extra Fields so I've not tested it with that... I'm on 4.0.7.

Change:

Code:
# 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"]."%'"; if (!empty($data["extra_fields"]) && $active_modules['Extra_Fields']) { foreach($data["extra_fields"] as $k => $v) $condition[] = "($sql_tbl[extra_field_values].value LIKE '%".$data["substring"]."%' AND $sql_tbl[extra_fields].fieldid = '$k')"; $join['extra_field_values'] = "$sql_tbl[products].productid = $sql_tbl[extra_field_values].productid"; $join['extra_fields'] = "$sql_tbl[extra_field_values].fieldid = $sql_tbl[extra_fields].fieldid AND $sql_tbl[extra_fields].active = 'Y'"; } if (!empty($condition)) $search_condition .= " AND (".implode(" OR ", $condition).")";

To:

Code:
$ss = split(" ",$data["substring"]); $ss_condition = ""; foreach($ss as $s) { # Search for substring in some fields... $condition = array(); if (!empty($data["by_title"])) $condition[] = "$sql_tbl[products].product LIKE '%".$s."%'"; if (!empty($data["by_shortdescr"])) $condition[] = "$sql_tbl[products].descr LIKE '%".$s."%'"; if (!empty($data["by_fulldescr"])) $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$s."%'"; if (!empty($data["extra_fields"]) && $active_modules['Extra_Fields']) { foreach($data["extra_fields"] as $k => $v) $condition[] = "($sql_tbl[extra_field_values].value LIKE '%".$s."%' AND $sql_tbl[extra_fields].fieldid = '$k')"; $join['extra_field_values'] = "$sql_tbl[products].productid = $sql_tbl[extra_field_values].productid"; $join['extra_fields'] = "$sql_tbl[extra_field_values].fieldid = $sql_tbl[extra_fields].fieldid AND $sql_tbl[extra_fields].active = 'Y'"; } if (!empty($condition)) $ss_condition .= " AND (".implode(" OR ", $condition).")"; } $search_condition .= $ss_condition;
__________________
Local Test: X-Cart Gold 4.0.7; Windows XP; IIS 5.1; PHP 4.3.7; MySQL 4.0.20a
Remote Test: X-Cart Gold 4.0.7; Linux; Apache 1.3.27; PHP 4.1.2; MySQL 3.23.54
Reply With Quote
  #88  
Old 12-18-2004, 12:21 PM
 
guphed guphed is offline
 

Newbie
  
Join Date: Jun 2004
Location: Newton-le-Willows, UK
Posts: 4
 

Default

Oops, maybe I should say the above file is /include/search.php...
__________________
Local Test: X-Cart Gold 4.0.7; Windows XP; IIS 5.1; PHP 4.3.7; MySQL 4.0.20a
Remote Test: X-Cart Gold 4.0.7; Linux; Apache 1.3.27; PHP 4.1.2; MySQL 3.23.54
Reply With Quote
  #89  
Old 12-18-2004, 01:16 PM
 
chilll33 chilll33 is offline
 

Senior Member
  
Join Date: Oct 2003
Location: Miami, FL
Posts: 100
 

Default

Quote:
Originally Posted by guphed
Well I think this thread started out by being a mod for changing the exact phrase search to multiple word search before it deviated somewhat before anybody had posted any code for v4.x so I've had to have a pop myself...

This seems to work for me, although I don't use Extra Fields so I've not tested it with that... I'm on 4.0.7.

Change:

Code:
# 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"]."%'"; if (!empty($data["extra_fields"]) && $active_modules['Extra_Fields']) { foreach($data["extra_fields"] as $k => $v) $condition[] = "($sql_tbl[extra_field_values].value LIKE '%".$data["substring"]."%' AND $sql_tbl[extra_fields].fieldid = '$k')"; $join['extra_field_values'] = "$sql_tbl[products].productid = $sql_tbl[extra_field_values].productid"; $join['extra_fields'] = "$sql_tbl[extra_field_values].fieldid = $sql_tbl[extra_fields].fieldid AND $sql_tbl[extra_fields].active = 'Y'"; } if (!empty($condition)) $search_condition .= " AND (".implode(" OR ", $condition).")";

To:

Code:
$ss = split(" ",$data["substring"]); $ss_condition = ""; foreach($ss as $s) { # Search for substring in some fields... $condition = array(); if (!empty($data["by_title"])) $condition[] = "$sql_tbl[products].product LIKE '%".$s."%'"; if (!empty($data["by_shortdescr"])) $condition[] = "$sql_tbl[products].descr LIKE '%".$s."%'"; if (!empty($data["by_fulldescr"])) $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$s."%'"; if (!empty($data["extra_fields"]) && $active_modules['Extra_Fields']) { foreach($data["extra_fields"] as $k => $v) $condition[] = "($sql_tbl[extra_field_values].value LIKE '%".$s."%' AND $sql_tbl[extra_fields].fieldid = '$k')"; $join['extra_field_values'] = "$sql_tbl[products].productid = $sql_tbl[extra_field_values].productid"; $join['extra_fields'] = "$sql_tbl[extra_field_values].fieldid = $sql_tbl[extra_fields].fieldid AND $sql_tbl[extra_fields].active = 'Y'"; } if (!empty($condition)) $ss_condition .= " AND (".implode(" OR ", $condition).")"; } $search_condition .= $ss_condition;


Works great with 4.0.8
__________________
Core version:
5.3.2.7

PHP:
5.6.29
MySQL server:
5.5.5-10.0.27-MariaDB-cll-lve  (InnoDB engine support enabled)
Web server:
Apache
Operating system:
Linux
XML parser:
found
GDLib:
found (0)
Translation driver:
Database
Curl version:
7.29.0
Reply With Quote
  #90  
Old 01-04-2005, 04:54 PM
  DogByteMan's Avatar 
DogByteMan DogByteMan is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 833
 

Default

It does work great.

If I had one wish left on the subject, I would wish that it would also search product number like it did in 3.4.x
__________________
Dedicated Server provided by EWD Hosting
X-Cart version 4.1.12
PHP 5.3.2
MySQL server 5.0.87-community
Operation system Linux
Perl 5.008008
dogbytecomputer.com
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:17 AM.

   

 
X-Cart forums © 2001-2020