Magento Forum

Backend Catalog Search
 
invaderflid
Member
 
Avatar
Total Posts:  59
Joined:  2008-10-21
Northport Long Island New York
 

Does anyone know where I can find the code for the catalog > manage product search? I want to see how the backend search works and try to mimic it on the front end. The partial matching in the backend works like a charm, but is awful in the front end. If anyone can point me in the right direction or give me some hints on where to look or how to accomplish this, that would be appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
invaderflid
Member
 
Avatar
Total Posts:  59
Joined:  2008-10-21
Northport Long Island New York
 

I found the code for the front end search, however I still haven’t been able to find code for the backend search. Does anyone have any ideas on where to look?

 
Magento Community Magento Community
Magento Community
Magento Community
 
galagagod
Jr. Member
 
Total Posts:  17
Joined:  2010-02-09
 

Any luck finding this?  I\’m going to continue my search but this is EXACTLY what I\’m looking for.

 
Magento Community Magento Community
Magento Community
Magento Community
 
spectrumaudio
Member
 
Total Posts:  39
Joined:  2008-07-22
 

Any luck finding this? It appears the backend search works better than front end.

 
Magento Community Magento Community
Magento Community
Magento Community
 
webkul
Sr. Member
 
Avatar
Total Posts:  159
Joined:  2010-10-27
 

already there is a complete back-end search in the magento admin

 
Magento Community Magento Community
Magento Community
Magento Community
 
broeder2
Jr. Member
 
Total Posts:  3
Joined:  2013-03-11
 

where is the backend code search ?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
aygromania
Jr. Member
 
Avatar
Total Posts:  7
Joined:  2012-08-09
 

The class you should look into is Mage_Adminhtml_Block_Widget_Grid
There you have the method

protected function _prepareCollection()
this takes the product collection and obviously prepares it by setting the sort order, applying filters, etc
Then on line 509 you have
$filter   $this->getParam($this->getVarNameFilter(), null);
This variable contains the column you search into and the search query. It is base64 encoded.
After that, on line 516 the string is decoded into an array:
$data $this->helper('adminhtml')->prepareFilterString($filter);
And finally the filters are added to the collection in _setFilterValues($data) method (line 449) and _addColumnFilterToCollection($column) method (line 463)

But even if you have this information it still won’t help you too much. The search on backend is faster because:
1. The product collection in the backend grid doesn’t include all the attributes.
2. You search into a specific column (not as you do on frontend in all searchable attributes)

Hope this helps.

(for refference, I used magento 1.8 in this example)

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top