View Single Post
  #1  
Old 07-28-2004, 07:26 PM
  finestshops's Avatar 
finestshops finestshops is offline
 

eXpert
  
Join Date: Oct 2002
Location: Toronto, Canada
Posts: 335
 

Default Include search by SKU into basic search in v4

Hi there,

v4 has some nice features and some not-finished business. Why would x-men include search by SKU/product code in advanced search when this is one of the main search fields people are looking for rpoducts in a lot of industries (auto, computers and etc? Here is the simple mod to search by sku from the main search box:

search.php

change:

Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["extra_fields"])) {

to

Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["by_productcode"]) && empty($data["extra_fields"])) {

after

Code:
if (!empty($data["by_fulldescr"])) $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$data["substring"]."%'";

add

Code:
if (!empty($data["by_productcode"])) $condition[] = "$sql_tbl[products].productcode LIKE '%".$data["substring"]."%'";

skin1/customer/search.tpl

after

Code:
<INPUT type="hidden" name="posted_data[by_fulldescr]" value="Y">

add

Code:
<INPUT type="hidden" name="posted_data[by_productcode]" value="Y">

skin1/customer/main/search_result.tpl

after

Code:
<TD width="5"><INPUT type="checkbox" name="posted_data[by_fulldescr]"{if $search_prefilled eq "" or $search_prefilled.by_fulldescr} checked{/if}></TD><TD nowrap>{$lng.lbl_det_description}</TD>

add

Code:
<TD width="5"><INPUT type="checkbox" name="posted_data[by_productcode]"{if $search_prefilled eq "" or $search_prefilled.by_productcode} checked{/if}></TD><TD nowrap>{$lng.lbl_sku}</TD>

Enjoy
__________________
Best regards,

Anton Pachkine
finestshops.com/x-cart
Reply With Quote