Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Exclude category from search?
Author « Topic »  

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 10/09/2018 :  04:04:18  
Hi,

Please could you advise if it is possible to exclude a particular category from the search (done via search.php)? I have a category which is used for other items which are not really products, and it would be great if these didn't come up in the product search. Any ideas please?

Thank you
Ellen

Andy
ECT Moderator

95440 Posts

Posted - 10/09/2018 :  04:30:07  
Hi Ellen

I'm afraid I can't see a way to remove a particular category from the main search.php - maybe someone can come along with a workaround but I just can't see one.

Andy

Please feel free to review / rate our software

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 10/09/2018 :  05:45:39  
OK thanks Andy - I thought I'd seen an 'official' way to do this but I guess not then! Maybe someone will come up with a suggestion.
Ellen

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 12/19/2018 :  07:49:46  
Hi Andy,

This is proving to be a bit of a sticking point so I'm having to revisit it. If it is any help, all the products I want to exclude from the search have a price of zero. I tried to use sminprice as mentioned here https://www.ecommercetemplates.com/help/searching.asp#search4 on my search.php page, like this

<?php $sminprice=1;
include "vsadmin/inc/incsearch.php" ?>

But this did not have the effect I wanted. Is there another way I can achieve this? On the link above it shows adding a hidden field like
<input type="hidden" name="sminprice" value="1"/>
but I was not sure where to put this.

I also tried linking to the search page like this search.php?sminprice=1 but once I put in other parameters (like max price) on the page, it did not work and the zero priced items are still returned.

Any suggestions please?
Thank you

Ellen

dbdave
ECT Moderator

USA
10468 Posts

Posted - 12/19/2018 :  08:03:21  
Hi, try it in your search form html code and then disable (hide with css) the search entry on the search.php page
Of course this assumes you are using a search form on all of your pages

<form method="post" action="search.php">
<input type="hidden" name="posted" value="1"/>
<input type="text" name="stext" size="16" class="tpsearch" />
<input type="hidden" name="sminprice" value="1"/>
<input name="Submit" type="submit" value="Search" class="sub" />
</form>

dbdave
ECT Moderator

USA
10468 Posts

Posted - 12/19/2018 :  08:12:25  
I tested that here and it does work.

http://www.floridasurpluswarehouse.com/dev/index.php

In the search at the top of the page, search for - PC
I have mine set to 10 instead of 1 so next to confirm it's working, search PC on the form in the search page here - http://www.floridasurpluswarehouse.com/dev/search.php
and you will see this product comes up http://www.floridasurpluswarehouse.com/dev/proddetail.php?prod=mouse001 - It didn't the first time because I set that to 10 and the mouse is $7.00

The next step would be to hide (css) the search input on the search.php page and force users to use the search input in the headers only.
I suppose it's also possible to recreate the search input on that page with the same code used in the header too

David

EllenD
Advanced Member

United Kingdom
434 Posts

Posted - 12/20/2018 :  02:08:41  
Thank you Dbdave for the suggestion! I am not using a search form on each page, I just link to search.php from the menu. However I think perhaps your last point nails it - I need to create my own search page with the form code on.

I see there is also the option to hide the search box with "nobox=true" so I'll try that too (details for that here https://www.ecommercetemplates.com/help/searching.asp#search4

Thanks
Ellen
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.02 seconds. Snitz Forums 2000