Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Multiple search forms

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-29-2004, 03:45 PM
 
longhorn180 longhorn180 is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Richmond, Virginia
Posts: 187
 

Default Multiple search forms

Hopefully someone can help me with this. I'm sure I did this the wrong way, but given my somewhat limited knowledge(zero), I'm not sure how else to do it. I sell books online I am now able to search for books by author, title, isbn or subject with just the 1 search box, but I want 4 seperate search forms or boxes with dedicated fields. I created a template where I copied and pasted the code to create 4 boxes and it works, but there is a caveat. When the results are displayed it also displays whatever you search for in all 4 of the boxes. Ex: if you enter Stephen King into the author box, then when the results are displayed it now says Stephen King in all 4 search boxes. Not a huge problem, but it looks ugly. Any suggestions would be greatly appreciated. I'm using 3.4.14
Reply With Quote
  #2  
Old 05-29-2004, 04:38 PM
  BCSE's Avatar 
BCSE BCSE is offline
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,091
 

Default

Can you post the code? That would really help. I have an idea but would be easy to confirm if I saw the code.

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #3  
Old 05-29-2004, 04:59 PM
 
longhorn180 longhorn180 is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Richmond, Virginia
Posts: 187
 

Default

Here's the code from the template for the search boxes.


Code:
<TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="100%"> {$lng.lbl_books} <tr> <tr> </tr> <td colspan=2></td> </tr> <form method="get" action="../customer/search.php" name=productsearchform> <tr> <td valign="middle" width=250> <input type="text" name="substring" size="16" value="{$smarty.get.substring|escape}"> </td> </tr> <tr> <td>{$lng.lbl_author}</td> </tr> </form> </TABLE> <TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="100%"> <tr> <tr> </tr> <td colspan=2></td> </tr> <form method="get" action="../customer/search.php" name=productsearchform> <tr> <td valign="middle" width=250> <input type="text" name="substring" size="16" value="{$smarty.get.substring|escape}"> </td> </tr> <tr> <td>{$lng.lbl_title}</td> </tr> </form> </TABLE> <TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="100%"> <tr> <tr> </tr> <td colspan=2></td> </tr> <form method="get" action="../customer/search.php" name=productsearchform> <tr> <td valign="middle" width=250> <input type="text" name="substring" size="16" value="{$smarty.get.substring|escape}"> </td> </tr> <tr> <td>{$lng.lbl_isbn}</td> </tr> </form> </TABLE> <TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="100%"> <tr> <tr> </tr> <td colspan=2></td> </tr> <form method="get" action="../customer/search.php" name=productsearchform> <tr> <td valign="middle" width=250> <input type="text" name="substring" size="16" value="{$smarty.get.substring|escape}"> {include file="buttons/search_head.tpl"}</td> </tr> <tr> <td>{$lng.lbl_subject} {$lng.lbl_advanced_search} </td> </tr> </form> </TABLE>


And here's the code from the search.php file (that I got from another thread) for the different search fields:


Code:
// 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].".param08 like '%".$s."%'"." OR ". $sql_tbl[products].".param04 like '%".$s."%'"." OR ". $sql_tbl[products].".product like '%".$s."%'"." OR ". $sql_tbl[products].".param06 like '%".$s."%'"." OR ". $sql_tbl[products].".param00 like '%".$s."%'".")"; //$substr .= "&substring=".urlencode($substring); } if(empty($and))$and = "OR"; $substring_query = (!empty($con)) ? " AND (".join(" ".$and." ",$con).") " :" "; //deleted 1 // end of new bit
Reply With Quote
  #4  
Old 05-29-2004, 05:23 PM
  BCSE's Avatar 
BCSE BCSE is offline
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,091
 

Default

This line in each of the <input> tags is what is making the same text show up in each of the inputs.

Quote:
value="{$smarty.get.substring|escape}"

You can remove this completely from all 4 as it's not necessary, but just a convenience. Or just leave it in 1 of them, although that doesn't really make sense either.

If you had a different "name" for each of the <input> tags, then you could use this feature and just change it to be
Quote:
value="{$smarty.get.name1|escape}"
value="{$smarty.get.name2|escape}"
value="{$smarty.get.name3|escape}"
value="{$smarty.get.name4|escape}"

to have it populate each of the text boxes with the previous values. If you wanted it to do it like this, you'd have to change the php code to reflect these changes.

Hope that wasn't too much information or too confusing. The simplest way to fix it is to remove
Quote:
value="{$smarty.get.substring|escape}"
from each of the 4 input tags.

Hope that helps.

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #5  
Old 05-29-2004, 05:39 PM
 
longhorn180 longhorn180 is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Richmond, Virginia
Posts: 187
 

Default

That worked great! Thank you very, very much - really appreciate the assistance.
Reply With Quote
  #6  
Old 05-29-2004, 05:41 PM
  BCSE's Avatar 
BCSE BCSE is offline
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,091
 

Default

Not a problem!

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 02:17 AM.

   

 
X-Cart forums © 2001-2020