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

Search box with dropdown

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-13-2011, 11:55 PM
 
vitalaccessories vitalaccessories is offline
 

Advanced Member
  
Join Date: Jan 2011
Posts: 33
 

Default Search box with dropdown

Hi there,

I am looking to see whether I can put in a dropdown box from the default search box containing pre-selected searches on the homepage? Basically customers can then either enter free text for a search or choose from a specific search which I have chosen via the dropdown...

Any help would be appreciated, thanks.
__________________
X-Cart 4.4.2 Gold
Reply With Quote
  #2  
Old 03-14-2011, 03:07 AM
  vasilis's Avatar 
vasilis vasilis is offline
 

X-Adept
  
Join Date: Feb 2009
Posts: 758
 

Default Re: Search box with dropdown

The template file responsible for the search box is customer/search.tpl template file:

Code:
<div class="search"> <div class="valign-middle"> <form method="post" action="search.php" name="productsearchform"> <input type="hidden" name="simple_search" value="Y" /> <input type="hidden" name="mode" value="search" /> <input type="hidden" name="posted_data[by_title]" value="Y" /> <input type="hidden" name="posted_data[by_descr]" value="Y" /> <input type="hidden" name="posted_data[by_sku]" value="Y" /> <input type="hidden" name="posted_data[search_in_subcategories]" value="Y" /> <input type="hidden" name="posted_data[including]" value="all" /> {strip} <input type="text" name="posted_data[substring]" class="text{if not $search_prefilled.substring} default-value{/if}" value="{$search_prefilled.substring|default:$lng.lbl_search|escape}" /> {include file="customer/buttons/button.tpl" type="input" style="image"} <a href="search.php" class="search">{$lng.lbl_advanced_search}</a> {/strip} </form> </div> </div>

In red color is the code for the display of the input text control. I guess you could replace the text type input with a select input (or add beside it so you could have both a text input and a drop-down input), something like:

Code:
<select name="posted_data[substring]" class="text{if not $search_prefilled.substring} default-value{/if}" value="{$search_prefilled.substring|default:$lng.lbl_search|escape}" /> <option>option 1</option> <option>option 2</option> <option>option 3</option> .................................. .................................. </select>

I hope, it works out for you...
Reply With Quote
  #3  
Old 03-14-2011, 11:51 AM
 
vitalaccessories vitalaccessories is offline
 

Advanced Member
  
Join Date: Jan 2011
Posts: 33
 

Default Re: Search box with dropdown

Hi,

Thanks a lot for the reply. That looks like just the ticket. I will be implementing this soon.

Regards.
__________________
X-Cart 4.4.2 Gold
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 11:54 PM.

   

 
X-Cart forums © 2001-2020