1and1 Help Centre Categories

print article

How can I search an item from a certain category?

You can restrict the search to certain product category and its subcategories.

First enter the following code in the product_overview.shopscript file, just after
<% INIT_STRUCTURE %> (eShops -> Shop design)


&amp;lt;form action="product_search.shopscript" method="get"&amp;gt;
$font Search in
&amp;lt;b&amp;gt; &amp;lt;% GetCategoryAttribute("name") %&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;
&amp;lt;input name="query" type="text" size="15" maxlength="40" &amp;gt;
&amp;lt;input name="search_limitgroups" type="hidden" value="&amp;lt;% GetCategoryAttribute("keypath") %&amp;gt;"&amp;gt; &amp;lt;br&amp;gt;
&amp;lt;input type="hidden" name="search_logical" value="and"&amp;gt;
&amp;lt;input name="search" type="submit" value="Search"&amp;gt;$_font
&amp;lt;/form&amp;gt;
Now insert the following code highlighted in red in product_search.shopscript file.
(eShops -> Shop design)

[....]
&amp;lt;br&amp;gt;
$text_search_or &amp;lt;input type="radio" name="search_logical" value="or" &amp;lt;% IF ($search_logical!="and") %&amp;gt;checked&amp;lt;% END_IF %&amp;gt;&amp;gt;
$text_search_and &amp;lt;input type="radio" name="search_logical" value="and" &amp;lt;% IF ($search_logical=="and") %&amp;gt;checked&amp;lt;% END_IF %&amp;gt;&amp;gt;
&amp;lt;/font&amp;gt;
$_font
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
&amp;lt;td colspan=3 align=right valign=middle bgcolor="$global_color2_bright"&amp;gt;
$font
&amp;lt;font color="$global_fontcolor_dark"&amp;gt;
&amp;lt;nobr&amp;gt;Search In
&amp;lt;select name="search_limitgroups"&amp;gt;
&amp;lt;option value=""&amp;gt;All Categories&amp;lt;/option&amp;gt;
&amp;lt;% INIT_STRUCTURE %&amp;gt;
&amp;lt;% GetAllGroups("", "", 2) %&amp;gt;
&amp;lt;% ITEMLOOP %&amp;gt;
&amp;lt;option value="$item_keypath" &amp;lt;% EchoSelected($search_limitgroups, $item_keypath) %&amp;gt;&amp;gt;
&amp;lt;?php echo str_repeat("&amp;amp;nbsp;&amp;amp;nbsp;", $level-1); php?&amp;gt;$item_name
&amp;lt;/option&amp;gt;
&amp;lt;% END_ITEMLOOP %&amp;gt;
&amp;lt;/select&amp;gt;&amp;lt;/nobr&amp;gt;
&amp;lt;/font&amp;gt;
$_font
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
&amp;lt;td colspan=3 align=right valign=middle bgcolor="$global_color2_bright"&amp;gt;&amp;lt;BR&amp;gt;
&amp;lt;input type=image src="./img/$button_search" border="0"&amp;gt;
[....]
After publishing, you will see the drop down menu under Product Search, where you
can choose a category to search in.