Is it possible to set the native Magento search to only search products which are connected to a category?
-
Does the table join helps? Or you are looking for non coding solution?– AmastyJul 30, 2014 at 21:53
2 Answers
Not out of the box. But you can set the product visibility in the admin to Catalog or Not Visible for the products you dont want to see in the search and will obtain the same result you are seeking without code.
-
Unfortunately this wont achieve the same results as I do want products to show in the search and in the catalogue. However I want products in the search to only be products which are connected to a category– Goose84Jul 29, 2014 at 16:09
-
You cannot have them show up in the search and not, computers are binary, set them to catalog visibility as suggested and that is the correct way. Unless there is something you are not explaining.– user2935Jul 29, 2014 at 18:05
You can inner join table catalog_category_product to the search result collection I think. Its structure as below:
+-------------+------------+----------+
| category_id | product_id | position |
+-------------+------------+----------+
| 3 | 5 | 1 |
| 4 | 6 | 1 |
| 3 | 7 | 1 |
+-------------+------------+----------+
Possible place is app\code\core\Mage\CatalogSearch\Model\Layer.php
, method getProuctCollection();
-
-
Rewrite the block, get the collection select object, join the table. Not sure i understand the question.– AmastyJul 31, 2014 at 20:32