View Single Post
  #35  
Old 05-17-2007, 06:42 PM
 
MMANOR MMANOR is offline
 

Member
  
Join Date: Feb 2007
Posts: 28
 

Default Re: Include search by SKU into basic search in v4

Hey All,

I have asked a lot of questions, but never have been able to offer any advice. Well now I have a chance too. For those that have version 4.0.19, I was able to get the solution on how to have the main page search also search by sku. You weren't able to do this before, I through extensive searching I was unable to find the answer in the forums. So I spent 25 points (of the 200 we get) and was able to get the fix. It is:

Quote:
If you want to search by SKU from the main page of the store, you should modify the /customer/search.tpl template file eg. via Admin Zone -> 'Edit templates' section and add this code
---
<input type="hidden" name="posted_data[by_sku]" value="on">
---

just after this line:

---
<input type="hidden" name="posted_data[by_shortdescr]" value="Y" />
---

Also please add this code to the /include/search.php:

--
if (!empty($data["by_sku"])) {
if($current_area == 'C' || $current_area == 'P') {
$condition[] = "$sql_tbl[products].productcode LIKE '%".$data["substring"]."%'";
}
}
--

Eg. just after:

--
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[produ
} else {
$condition[] = "$sql_tbl[products].descr LIKE '%".$data["substring"]."%'";
}
}
--

After this everything should work fine.
__________________
x-cart-4.1.8gold
Reply With Quote