0

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? – Amasty Jul 30 '14 at 21:53
1

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 – Goose84 Jul 29 '14 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. – user2935 Jul 29 '14 at 18:05
0

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();

  • How would I inner join that table? – Goose84 Jul 31 '14 at 13:14
  • Rewrite the block, get the collection select object, join the table. Not sure i understand the question. – Amasty Jul 31 '14 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.