Jump to content

Product Search By Category, Parent Categories Only


Recommended Posts

Hello,

 

I have a Leotheme theme installed on PS 1.6.1.4.

Theres a module which provides a search bar in the header in which customers can search in all categories (via the default search module) and customers can select a category to search in.

 

I really like the option, but we have a lot of subcategories with the same names, so the dropdown with categories to choose from is really confusing for customers.

 

So what I would like is the dropdown to only show the parent categories.

 

This is the code for the module that I think should be changed, but I'm not sure how.

Can anyone help me with this, would be really appreciated.


<!-- Block search module -->

<script type="text/javascript">	
$(document).ready( function(){
	//$(".leo_block_search").each( function(){
		var content = $(".groupe-content");
		$(".groupe-btn").click( function(){
			content.toggleClass("eshow");
		}) ;
	//} );
});
</script>

<div id="leo_search_block_top" class="leo_block_search exclusive">
	{*<div class="groupe-btn dropdown btn-group hidden-md hidden-lg">
		<i class="fa fa-search"></i>
	</div>*}
	<div class="groupe-content">
		<form method="get" action="{$link->getPageLink('productsearch', true)|escape:'html':'UTF-8'}" id="leosearchtopbox">
			<input type="hidden" name="fc" value="module" />
			<input type="hidden" name="module" value="leoproductsearch" />
			<input type="hidden" name="controller" value="productsearch" />
			<input type="hidden" name="orderby" value="position" />
			<input type="hidden" name="orderway" value="desc" />
	    	
			<div class="group-leosearch clearfix">
				<select name="cate" id="cate">
					<option value="">{l s='All Categories' mod='leoproductsearch'}</option>
					{foreach $cates item = cate key= "key"}
				     <option value="{$cate.id_category==|escape:'htmlall':'UTF-8'|stripslashes}" {if isset($selectedCate) && $cate.id_category eq $selectedCate}selected{/if} >{$cate.name}</option>
				     {/foreach}
	            </select>
	            <input class="search_query grey" type="text" id="leo_search_query_top" name="search_query" value="{$search_query|escape:'htmlall':'UTF-8'|stripslashes}" />
				<button type="submit" id="leo_search_top_button" class="btn btn-outline-inverse button button-small"><i class="fa fa-search"></i></button>
			</div>
		</form>
	</div>
</div>
<!-- /Block search module -->

Thanks in advance for any tips!

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...