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
  #21  
Old 11-05-2003, 11:49 AM
 
Tuner Tuner is offline
 

eXpert
  
Join Date: Jan 2003
Location: Scottsdale Arizona
Posts: 245
 

Default

OK Im running 3.3.2 with an extended search paramaters so I can search by Brand SKU Desc.

It has been a pain in the head modifying this so that I can search in other paramaters. www.landspeedracing.com/customer/search.php

If anyone needs the basic version of this Mod to work on 3.3.X I beleive I have the proper code. I would paste it hear but one of my main problems getting this code to work in the first place because copying the code from the forumn to a file without getting parse errors that made zero sense was impossible.
I basicly had to go in and replace every return and space(used for formating.
Once this is done and a couple minor changes for compatibility, I only found one error in the actual code so let me point this out. It does not noticeably affect the operation(so I can see why no one has noticed it) but is a typo none the less.

Original CODEwith error)
Code:
б═ б═$smarty->assign("navigation_script","search.php?substring=".urlencode($substring)."&in_category=$in_category".$price_substring);

New corrected CODE:
Code:
б═ б═$smarty->assign("navigation_script","search.php?substring=".urlencode($substring)."&in_category=".$in_category.$price_substring);

The $in_category was enclosed in quotes and I beleive it is not suppose to be as it was not in my original search.php So I moved the quotes and added a period.

Also Boomers addition is a must if you are going to do what I did and add a Brand dropdown list to search via brand.(very handy)

MY MAIN QUESTION IS: How can I have all my search results Ordered By ProductCode.
I thought replacing:
Code:
Group By $sql_tbl[products].productid
With
Code:
Group By $sql_tbl[products].productcode

Would accomplish this but I am wrong as changing this has no affect on the product arrangment in Products.tpl

Any suggestions for doing this. I am so just hacing this code and do not 100% understand every aspect of it. more like 70%

Scott
P.S. Thankyou so much REALLY it is sad that this is not standard one of my pet peaves of x-cart is its incomplete features sure has lots of features just few are complete or done in the standard popular way.(sure it will change)
__________________
\"Then again it could all be horse crap\"
by some old Guy.
4.013
Reply With Quote
  #22  
Old 11-05-2003, 05:09 PM
 
bluecat bluecat is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 674
 

Default

Quote:
Originally Posted by nfc5382
this works in 3.4.2 (based off from funkydunk's fix above)...

adds support for searching fulldescription, desc, productid, product

here it is: (look near the "LOOK HERE"s)


Code:
<? /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2003 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2003 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: search.php,v 1.44.2.1 2003/06/02 11:57:44 svowl Exp $ # require "../smarty.php"; require "../config.php"; @include "./https.php"; require "./auth.php"; require "../include/categories.php"; $tmp=strstr($QUERY_STRING, "$XCART_SESSION_NAME="); if (!empty($tmp)) $QUERY_STRING=ereg_replace("$XCART_SESSION_NAME=([0-9a-zA-Z]*)", "", $QUERY_STRING); if(!empty($QUERY_STRING)) { # # Permorfm SQL search query # // LOOK HERE // new bit to split search string into separate words $con = ""; $substr = ""; $and="AND"; if(!empty($substring)){ $ss = split(" ",$substring); foreach($ss as $s) // nfc - we add support for other fields to search $con[] = "(".$sql_tbl[products].".product like '%".$s."%'"." OR ". $sql_tbl[products].".descr like '%".$s."%'"." OR ". $sql_tbl[products].".fulldescr like '%".$s."%'"." OR ". $sql_tbl[products].".productid like '%".$s."%'".")"; //$substr .= "&substring=".urlencode($substring); } if(empty($and))$and = "OR"; $substring_query = (!empty($con)) ? " AND (".join(" ".$and." ",$con).") " :" 1 "; // end of new bit $price_condition = $price_search_1?" AND $sql_tbl[pricing].price>='$price_search_1'":""; $price_condition .= $price_search_2?" AND $sql_tbl[pricing].price<='$price_search_2'":""; $price_substring = $price_search_1?"&price_search_1=".urlencode($price_search_1):""; $price_substring .= $price_search_2?"&price_search_2=".urlencode($price_search_2):""; if ($price_condition) $sort_by_price = "price"; if ($in_category) { $search_category = addslashes(array_pop(func_query_first("select category from $sql_tbl[categories] where categoryid='$in_category'"))); $search_categories = func_query("select categoryid from $sql_tbl[categories] where $sql_tbl[categories].category like '$search_category%'"); if(is_array($search_categories)) { $category_condition=" in ( "; foreach($search_categories as $k=>$v) $category_condition .= "'$v[categoryid]', "; $category_condition = ereg_replace(", $", ")", $category_condition); $category_condition=" ($sql_tbl[products].categoryid $category_condition or $sql_tbl[products].categoryid1 $category_condition or $sql_tbl[products].categoryid2 $category_condition or $sql_tbl[products].categoryid3 $category_condition) "; } } else $category_condition = "1"; $membership_condition = " AND ($sql_tbl[categories].membership='". $user_account['membership']."' OR $sql_tbl[categories].membership='') "; if ($store_language != $config["default_customer_language"] && $substring) { // LOOK HERE // nfc - always using default language so this case will never happen } else { // LOOK HERE // nfc - removed $substring_query =..... $search_query_count = "select count(*) from $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[categories] where $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[pricing].quantity=1 and $sql_tbl[products].categoryid=$sql_tbl[categories].categoryid $membership_condition and ($sql_tbl[pricing].membership='". $user_account['membership']."' or $sql_tbl[pricing].membership='') AND $category_condition and $sql_tbl[products].forsale='Y' and $sql_tbl[categories].avail='Y' $price_condition $substring_query group by $sql_tbl[products].productid"; } $search_query = "$category_condition and $sql_tbl[categories].avail='Y' and $sql_tbl[products].forsale='Y' $price_condition $substring_query "; $total_products_in_search = count(func_query($search_query_count)); # # Navigation code # $objects_per_page = $config["Appearance"]["products_per_page"]; $total_nav_pages = ceil($total_products_in_search/$objects_per_page)+1; require "../include/navigation.php"; $smarty->assign("products",func_search_products($search_query, $user_account['membership'],$first_page,$total_products_in_search, 0, $sort_by_price)); $smarty->assign("navigation_script","search.php?substring=".urlencode($substring)."&in_category=$in_category".$price_substring); $HTTP_GET_VARS["substring"] = stripslashes($HTTP_GET_VARS["substring"]); $smarty->assign("main","search"); } else { $smarty->assign("main","advanced_search"); } $smarty->display("customer/home.tpl"); ?>

thanks funkydunk!!![/b]

Well this code works for me in 3.4.8 just so everyone knows. I can get search results now from multiple words.
Reply With Quote
  #23  
Old 11-08-2003, 10:26 AM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default

This mod worked for me too in the newest version. Is it possible to make it search the "extra fields" too?
__________________
~ Andrea Beight
Reply With Quote
  #24  
Old 11-11-2003, 01:05 PM
 
Chris B Chris B is offline
 

eXpert
  
Join Date: Oct 2002
Posts: 226
 

Default search product_options table

I have the customized search function working on Version a 3.4.8 install.

Is there a method to search the product_options table?

I would like to search for products with certain size availability.

Since the product_options table doesn't have a "membership" field, the search code will not allow that table to be used.


Thanks for any help.
Chris
Reply With Quote
  #25  
Old 11-11-2003, 02:58 PM
 
funkydunk funkydunk is offline
 

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

Default

Quote:
Originally Posted by Gibberish
I tried the code and I get this error:

Warning: Division by zero in /usr/www/htdocs/saddlemen/test_site/xcart_test/customer/search.php on line 76

Code for 3.3 or even 3.2 version is as follows:

Code:
<? /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2003 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2003 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: search.php,v 1.44.2.1 2003/06/02 11:57:44 svowl Exp $ # require "../smarty.php"; require "../config.php"; @include "./https.php"; require "./auth.php"; require "../include/categories.php"; $tmp=strstr($QUERY_STRING, "$XCART_SESSION_NAME="); if (!empty($tmp)) $QUERY_STRING=ereg_replace("$XCART_SESSION_NAME=([0-9a-zA-Z]*)", "", $QUERY_STRING); if(!empty($QUERY_STRING)) { # # Permorfm SQL search query # // LOOK HERE // new bit to split search string into separate words $con = ""; $substr = ""; $and="AND"; // boomer's bit if(!$substring) { $substring=" "; } // end of boomer's bit if(!empty($substring)){ $ss = split(" ",$substring); foreach($ss as $s) // nfc - we add support for other fields to search $con[] = "(".$sql_tbl[products].".product like '%".$s."%'"." OR ". $sql_tbl[products].".descr like '%".$s."%'"." OR ". $sql_tbl[products].".fulldescr like '%".$s."%'"." OR ". $sql_tbl[products].".productid like '%".$s."%'".")"; //$substr .= "&substring=".urlencode($substring); } if(empty($and))$and = "OR"; $substring_query = (!empty($con)) ? " AND (".join(" ".$and." ",$con).") " :" 1 "; // end of new bit $price_condition = $price_search_1?" AND $sql_tbl[pricing].price>='$price_search_1'":""; $price_condition .= $price_search_2?" AND $sql_tbl[pricing].price<='$price_search_2'":""; $price_substring = $price_search_1?"&price_search_1=".urlencode($price_search_1):""; $price_substring .= $price_search_2?"&price_search_2=".urlencode($price_search_2):""; if ($price_condition) $sort_by_price = "price"; if ($in_category) { $search_category = addslashes(array_pop(func_query_first("select category from $sql_tbl[categories] where categoryid='$in_category'"))); $search_categories = func_query("select categoryid from $sql_tbl[categories] where $sql_tbl[categories].category like '$search_category%'"); if(is_array($search_categories)) { $category_condition=" in ( "; foreach($search_categories as $k=>$v) $category_condition .= "'$v[categoryid]', "; $category_condition = ereg_replace(", $", ")", $category_condition); $category_condition=" ($sql_tbl[products].categoryid $category_condition or $sql_tbl[products].categoryid1 $category_condition or $sql_tbl[products].categoryid2 $category_condition or $sql_tbl[products].categoryid3 $category_condition) "; } } else $category_condition = "1"; $membership_condition = " AND ($sql_tbl[categories].membership='". $user_account['membership']."' OR $sql_tbl[categories].membership='') "; if ($store_language != $config["default_customer_language"] && $substring) { // LOOK HERE // nfc - always using default language so this case will never happen } else { // LOOK HERE // nfc - removed $substring_query =..... $search_query_count = "select count(*) from $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[categories] where $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[pricing].quantity=1 and $sql_tbl[products].categoryid=$sql_tbl[categories].categoryid $membership_condition and ($sql_tbl[pricing].membership='". $user_account['membership']."' or $sql_tbl[pricing].membership='') AND $category_condition and $sql_tbl[products].forsale='Y' and $sql_tbl[categories].avail='Y' $price_condition $substring_query group by $sql_tbl[products].productid"; } $search_query = "$category_condition and $sql_tbl[categories].avail='Y' and $sql_tbl[products].forsale='Y' $price_condition $substring_query "; $total_products_in_search = count(func_query($search_query_count)); # # Navigation code # $objects_per_page = $config["Appearance"]["products_per_page"]; $total_nav_pages = ceil($total_products_in_search/$objects_per_page)+1; require "../include/navigation.php"; $smarty->assign("products",func_search_products($search_query, $user_account['membership'],$first_page,$total_products_in_search, 0, $sort_by_price)); $smarty->assign("navigation_script","search.php?substring=".urlencode($substring)."&in_category=$in_category".$price_substring); $HTTP_GET_VARS["substring"] = stripslashes($HTTP_GET_VARS["substring"]); $smarty->assign("main","search"); } else { $smarty->assign("main","advanced_search"); } $smarty->display("customer/home.tpl"); ?>

Hope it helps someone.
__________________
ex x-cart guru
Reply With Quote
  #26  
Old 11-20-2003, 03:44 PM
 
Tuner Tuner is offline
 

eXpert
  
Join Date: Jan 2003
Location: Scottsdale Arizona
Posts: 245
 

Default

OK so this code is modified to do the following
1. function in 3.3.2
2. Substring search searches the following paramaters using funky's code
Param00
Product
Description
Detailed Desription
(ProductCode or sku#)
3.SKU# search searches ProductCode Only and searches it using Funky's code
4. Same as #3 only with the folowing paramater param00
5. Same as #3 only with the folowing paramater Product
6. Same as #3 only with the folowing paramater fulldescr
7. Added ability to search by brand using drop down list(see .tpl code)


You may see this at www.landspeedracing.com/customer/search.php
If anyone want me to mod this for 3.3.x for their uses I would be willing to help if it is not to much work.
Scott

Code:
<? require "../smarty.php"; require "../config.php"; @include "./https.php"; require "./auth.php"; require "../include/categories.php"; $tmp=strstr($QUERY_STRING, "XCARTSESSID="); if (!empty($tmp)) $QUERY_STRING=""; if(!empty($QUERY_STRING)) { # # Permorfm SQL search query # // LOOK HERE // new bit to split search string into separate words #Substring Search $con = ""; $and="AND"; #if($substring and $search_det_description){$substring .= " $search_det_description";}else if(!$substring and $search_det_description){$substring = $search_det_description ;}else if($substring and !$search_det_description){$search_det_description = NULL;} else {$substring = NULL;$search_det_description = NULL;} if(!empty($substring)){ $ss = split(" ",$substring); foreach($ss as $s) // nfc - we add support for other fields to search $con[] = "(".$sql_tbl[products].".product like '%".$s."%'"." OR ". $sql_tbl[products].".fulldescr like '%".$s."%'"." OR ". $sql_tbl[products].".descr like '%".$s."%'"." OR ". $sql_tbl[products].".param00 like '%".$s."%'"." OR ". $sql_tbl[products].".productcode like '%".$s."%'".")"; } if(empty($and))$and = "OR"; $substring_query = (!empty($con)) ? " AND (".join(" ".$and." ",$con).") " :""; #Title Search $cont = ""; $andt = "AND"; if(!empty($search_product)){ $sst = split(" ",$search_product); foreach($sst as $st) $cont[] = "(".$sql_tbl[products].".product like '%".$st."%'".")"; } if(empty($andt))$andt = "OR"; $product_query = (!empty($cont)) ? " AND (".join(" ".$andt." ",$cont).") " :""; #Descriptions Search $cond = ""; $andd = "AND"; if(!empty($search_det_description)){ $ssd = split(" ",$search_det_description); foreach($ssd as $sd) $cond[] = "(".$sql_tbl[products].".fulldescr like '%".$sd."%'"." OR ". $sql_tbl[products].".fulldescr like '%".$sd."%'".")"; } if(empty($andd))$andd = "OR"; $descr_query = (!empty($cond)) ? " AND (".join(" ".$andd." ",$cond).") " :""; #Applications Search Param00 $conp = ""; $andp = "AND"; if(!empty($search_param00)){ $ssp = split(" ",$search_param00); foreach($ssp as $sp) $conp[] = "(".$sql_tbl[products].".param00 like '%".$sp."%'".")"; } if(empty($andp))$andp = "OR"; $param00_query = (!empty($conp)) ? " AND (".join(" ".$andp." ",$conp).") " :""; // end of new bit $price_condition = $price_search_1?" AND $sql_tbl[pricing].price>='$price_search_1'":""; $price_condition .= $price_search_2?" AND $sql_tbl[pricing].price<='$price_search_2'":""; $price_substring = $price_search_1?"&price_search_1=".urlencode($price_search_1):""; $price_substring .= $price_search_2?"&price_search_2=".urlencode($price_search_2):""; $brand_condition = ($search_brand==""?"":" and ($sql_tbl[products].brand regexp '$search_brand') "); $sku_condition = ($search_sku != '' ? " and $sql_tbl[products].productcode regexp '$search_sku' ": ""); if ($price_condition) $sort_by_price = "price"; if ($in_category) { $search_category = addslashes(array_pop(func_query_first("select category from $sql_tbl[categories] where categoryid='$in_category'"))); $search_categories = func_query("select categoryid from $sql_tbl[categories] where $sql_tbl[categories].category like '$search_category%'"); if(is_array($search_categories)) { $category_condition=" in ( "; foreach($search_categories as $k=>$v) $category_condition .= "'$v[categoryid]', "; $category_condition = ereg_replace(", $", ")", $category_condition); $category_condition=" ($sql_tbl[products].categoryid $category_condition or $sql_tbl[products].categoryid1 $category_condition or $sql_tbl[products].categoryid2 $category_condition or $sql_tbl[products].categoryid3 $category_condition) "; } } else $category_condition = "1"; $membership_condition = " AND ($sql_tbl[categories].membership='". $user_account['membership']."' OR $sql_tbl[categories].membership='') "; if ($store_language != $config["default_customer_language"] && $substring) { // LOOK HERE // nfc - always using default language so this case will never happen } else { $search_query_count = "select count(*) from $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[categories] where $sql_tbl[pricing].productid=$sql_tbl[products].productid AND $sql_tbl[pricing].quantity=1 AND $sql_tbl[products].categoryid=$sql_tbl[categories].categoryid $membership_condition AND ($sql_tbl[pricing].membership='". $user_account['membership']."' or $sql_tbl[pricing].membership='') AND $category_condition AND $sql_tbl[products].forsale='Y' AND $sql_tbl[categories].avail='Y' $brand_condition $sku_condition $price_condition $param00_query $descr_query $product_query $substring_query Group By $sql_tbl[products].productcode"; } $search_query = "$category_condition and $sql_tbl[categories].avail='Y' and $sql_tbl[products].forsale='Y' $brand_condition $sku_condition $price_condition $param00_query $descr_query $product_query $substring_query "; $total_products_in_search = count(func_query($search_query_count)); # # Navigation code # $objects_per_page = $config["General"]["products_per_page"]; $total_nav_pages = ceil($total_products_in_search/$objects_per_page)+1; require "../include/navigation.php"; $smarty->assign("products",func_search_products($search_query, $user_account['membership'],$first_page,$total_products_in_search, 0, $sort_by_price)); $smarty->assign("navigation_script","search.php?substring=".urlencode($substring)."&search_brand=".$search_brand."&search_sku=".$search_sku."&search_param00=".urlencode($search_param00)."&search_product=".urlencode($search_product)."&search_det_description=".urlencode($search_det_description)."&in_category=".$in_category.$price_substring); $HTTP_GET_VARS["substring"] = stripslashes($HTTP_GET_VARS["substring"]); $smarty->assign("main","search"); } else { $brands = func_query("select brand from $sql_tbl[products] where brand <> '' GROUP BY brand"); $smarty->assign("brands", $brands); $smarty->assign("main","advanced_search"); } $smarty->display("customer/home.tpl"); ?>

advanced_search.tpl
Code:
{* $Id: advanced_search.tpl,v 1.3 2002/10/08 12:01:17 alfiya Exp $ *} {include file="location.tpl" last_location="Advanced search"} {capture name=adv_search} <table border=0> <form action="search.php" name="productsearchbyprice_form"> <tr> <td>Product Title:</td> <td> <input type="text" name="search_product" size="30" value="{$smarty.get.search_product}"> </td> </tr> <tr> <td>SKU#:</td> <td> <input type="text" name="search_sku" size="30" value="{$smarty.get.search_sku}"> </td> </tr> <tr> <td nowrap>Product Description:</td> <td> <input type="text" name="search_det_description" size="30" value="{$smarty.get.search_det_description}"> </td> </tr> <tr> <td>Brand:</td> <td> <select name=search_brand> <option value="">None</option> {section name=i loop=$brands} <option value='{$brands[i].0}'>{$brands[i].0}</option> {/section} </select> </td> </tr> <tr><td>Price Range({$config.General.currency_symbol}):</td> <td><input type="text" name="price_search_1" size="6" value="{$smarty.get.price_search_1|escape}"> - <input type="text" name="price_search_2" size="6" value="{$smarty.get.price_search_2|escape}"></td></tr> <tr><td>Category:</td> <td> <select name="in_category"> <option value="">All</option> {section name=cat_num loop=$categories} <option value="{ $categories[cat_num].categoryid}" {if $smarty.get.in_category eq $categories[cat_num].categoryid or $cat eq $categories[cat_num].categoryid}selected{/if}>{$categories[cat_num].category|escape}</option> {/section} </select> </td> </tr> <tr> <td nowrap>Vehicle Application: &nbsp &nbsp</td> <td> <input type="text" name="search_param00" size="30" value="{$smarty.get.search_param00}"> Example:(Honda Civic Si B16) &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspDon't Include Year!</td> </tr> <tr><td></td></tr> <tr><th>{include file="buttons/search.tpl"}</th></tr> </form> </table> {/capture} {include file="dialog.tpl" title="Advanced search" content=$smarty.capture.adv_search extra="width=100%"}

The only bug I have found is when one searches using the general seach on the main page It takes them to the advanced search and does not display any result however once this happens if you submit the seach again from the same spot all goes well I think I know what the problem is just have not had time to fix it.
Scott
__________________
\"Then again it could all be horse crap\"
by some old Guy.
4.013
Reply With Quote
  #27  
Old 12-07-2003, 03:55 PM
 
jordan0 jordan0 is offline
 

Advanced Member
  
Join Date: Oct 2003
Location: San Francisco, CA
Posts: 77
 

Default Search works great!...can we do more?

I have installed this search mod successfully in 3.4.8 and its great! thanks you guys and great work!

There is one thing, though, that i would like it to do:

when a user seaches for "super car kit" , the search does not return any results even though i have a product called "car kit" . Is there any way to make it work this way?

thanks
Jordan
Reply With Quote
  #28  
Old 12-07-2003, 05:20 PM
 
jordan0 jordan0 is offline
 

Advanced Member
  
Join Date: Oct 2003
Location: San Francisco, CA
Posts: 77
 

Default One more quesiton...

In addition to my above question, I've got one more:

How can I make this search code search by one (or more than one at once) of the extra fields i defined for product options?
I read somewhere that these extra fields are called param00, etc... so I am assuming that the search code posted previously (the one from LandSpeedRacing.com) is suited for this. What I need to know is where do i find out what these extra fields are called within X-Cart (param00, param01 etc...?) and how do i implement a search by them?



Also, is it possible to make a search that uses multiple "extra field" parameters? for example:
My store sells beads. We carry thousands of different sizes, colors, materials, etc. I want customers to be able to form a search query by choosing a color, size and material from 3 pull-down menus which will use information entered into extra fields in product options.

Thanks
Sorry if some of these questions are obvious, I am new to X-Cart

- jordan
Reply With Quote
  #29  
Old 12-07-2003, 09:35 PM
 
Tuner Tuner is offline
 

eXpert
  
Join Date: Jan 2003
Location: Scottsdale Arizona
Posts: 245
 

Default

Umm well use my code. Well actualy adapt my code to the original as mine is modified to use the extra paramaters but is also made to be compatible with 3.3.x
(I think its realy only the sessionID part that is different)

Also as fare as your first question??? The code is suppose to work they way you wanted it to. Super car Kit should find Super Car and Kit and any combination.

I dont know why this does not work for you? Maybe Im mistaken!
Scott
__________________
\"Then again it could all be horse crap\"
by some old Guy.
4.013
Reply With Quote
  #30  
Old 12-11-2003, 02:41 PM
 
jordan0 jordan0 is offline
 

Advanced Member
  
Join Date: Oct 2003
Location: San Francisco, CA
Posts: 77
 

Default Division by zero, line 149

Thanks Tuner!

I have installed the code above, keeping the session ID parts from the previously posted 3.4.8 search script. The search works somewhat (it will return results, but "super car kit" still does not find "car kit") and I get a warning:
Warning: Division by zero in /home/jordan0/www/kitkraft/customer/search.php on line 149
I've looked at line 149 and I don't even know where to start with this one
What can I do?
- Jordan

** Added Dec.11 **
Tuner Б─⌠ I have tested out the search function on LandSpeedRacing.com and found that it returns results the same way. I searched for "Super Block Saver" and got no results, but found your block saver items by searching for just "Block Saver"
I think it would make the search function much more effective if it worked in this way. Customers searching for an item of a certain brand may find that another one suits their needs better.
**

** Added Dec.11 **
After more thought on the subject, I've decided its best to leave the search function the way it is. I will include a note on the "no results found" page suggesting that users remove words from their query.
**
__________________
Jordan Sitkin
http://www.kitkraft.biz
X-Cart 4.0.18 [unix]
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 01:33 PM.

   

 
X-Cart forums © 2001-2020