Raghav Singh
Raghav Singh

Reputation: 27

Make some categories un-searchable in Magento search bar

I am working on a Magento theme. I am new to Magento. On my website the search bar is working fine but we have removed some product categories from the website. So I want to make these categories un-searchable. I don't know how to do this? They are are still searchable. I am working with the Magento admin panel. Please help me solve this problem. What steps should I take next?

Some categories give me this error

Fatal error: Call to a member function getId() on a non-object in /home/...../template/catalog/layer/view.phtml on line 122

Upvotes: 1

Views: 190

Answers (2)

DeGi
DeGi

Reputation: 130

If you "removed" categories from admin panel, it should not be searchable, however, if indexes are stale and not reindexed before you search again, it can "be searched". Run a indexer.php to reindex all.

php indexer.php --reindexall

Run this command at /shell directory

Upvotes: 0

baoutch
baoutch

Reputation: 1704

These aren't the categories you're looking for.

Magento searches for products when you use the search bar, categories are only attributes here. It wouldnt be consistent to look for categories : product A is in category C1 and C2. C1 is forbidden in search, what happens then?

Instead of that, you can setup searchability for each product. In product admin page, in General tab, check for Visibility field and select Catalog. Product won't appear on search results (don't forget to reindex after that).

You can also do this for a bunch of products using mass actions on Manage Products page. Select products you want to edit, then on action dropdown (top right) select Update Attributes. On next page you can change visibility for all those products.

Upvotes: 1

Related Questions