View Single Post
  #117  
Old 04-11-2005, 10:10 AM
  Alltribes's Avatar 
Alltribes Alltribes is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 192
 

Default

I think I have it. This includes the search by sku mod. This is for 4.0.12, but should work with later versions. I am still testing it, but the categories show up and the wierd stretching bug I had is gone

Code:
$ss = split(" ",$data["substring"]); $ss_condition = ""; foreach($ss as $s) { # Search for substring in some fields... $condition = array(); if (!empty($data["by_title"])) { if($current_area == 'C' || $current_area == 'P') { $condition[] = "IF($sql_tbl[products_lng].product IS NOT NULL AND $sql_tbl[products_lng].product != '', $sql_tbl[products_lng].product, $sql_tbl[products].product) LIKE '%".$s."%'"; } else { $condition[] = "$sql_tbl[products].product LIKE '%".$s."%'"; } } if (!empty($data["by_shortdescr"])) { if($current_area == 'C' || $current_area == 'P') { $condition[] = "IF($sql_tbl[products_lng].descr IS NOT NULL AND $sql_tbl[products_lng].descr != '', $sql_tbl[products_lng].descr, $sql_tbl[products].descr) LIKE '%".$s."%'"; } else { $condition[] = "$sql_tbl[products].descr LIKE '%".$s."%'"; } } if (!empty($data["by_fulldescr"])) { if($current_area == 'C' || $current_area == 'P') { $condition[] = "IF($sql_tbl[products_lng].full_descr IS NOT NULL AND $sql_tbl[products_lng].full_descr != '', $sql_tbl[products_lng].full_descr, $sql_tbl[products].fulldescr) LIKE '%".$s."%'"; } else { $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$s."%'"; } } if (!empty($data["by_productcode"])) { if($current_area == 'C' || $current_area == 'P') { $condition[] = "IF($sql_tbl[products].productcode IS NOT NULL AND $sql_tbl[products].productcode != '', $sql_tbl[products].productcode, $sql_tbl[products].productcode) LIKE '%".$s."%'"; } else { $condition[] = "$sql_tbl[products].productcode 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; # Search statistics

Mind you this is a mkod to the 4.0.12 code, not the code posted previously.
__________________
Alltribes.com
Native American Jewelry
Pottery, Baskets, Kachinas & More

X-cart Gold Version 4.0.17 Live
PHP 5.2.6
MySQL 4.1.25
(mt)
Reply With Quote