I want to fetch only some categories products when user search front end. So how catalog search query join with category table related product onyl
This is not really a perfect practice, however, if we are not aware of writing a magento module then this can be a very quick alternative. This step also protects us from our work being over-written when we make a magento upgrade.
Step 1: Create a new folder called “Mage” inside app/code/local
Now we have anew folder app/code/local/Mage
Step 2: If I see the steps given in Magento wiki, we notice that the they are extending the features of the CatalogSearch module that is located in the namespace Mage, So just go to “app/code/core/Mage” and copy the entire folder named “CatalogSearch” into app/code/local/Mage
Now we have the entire “CatalogSearch” module located in app/code/local/Mage/CatalogSearch
Step 3: Now all we need to do is follow the exact steps given in the wiki article, however make sure to edit files located in app/code/local/Mage/CatalogSearch only.
How to add catalog search in Magento product list view or the Search by category feature in Magento product list view.
This simply involves adding a search form in prodcut list view we however need to ensure that the category id is passed to the advanced search form using a hidden input.
Add the following code to
Note: 1.The first if statement makes sure that we will not have two forms in the advanced search result page. You should retain this if statement because when we are in advanced search we will no longer be in the previously selected category!
- You may need to change the path of search image.
3.Also included the autocomplete feature, so be careful if you are changing the name or ID attribute of the form or the input tags.