Searching facility in Magento admin is quite a useful feature in itself. Although Magento provides searching for products or customers or anything else in the admin side, it could still be made better to fit the requirements of specific customizations.
One such occasion occurred with us a while ago. One of our clients using an ERP module to manage his stores wanted to implement customized custom search on his store. Having provided them the ERP module also we created a Magento Custom search module that integrated search within store products, customers, and sales related information as well as the ERP module. The task which seemed quite daunting at first turned out to be a great learning experience for our junior Magento developers who worked with our more experienced developers as well as yet another mile stone for us in using Magento in creative ways to provide solutions to our clients.
The need for Magento Custom Search module
As stated in the beginning Magento also provides searching through the store then why use this module? The main reason for development of this extension was not just to provide searching that will list out everything but achieve smart search and to the point customized and periodic results.
Basically what our custom search module accomplishes is it integrates with an existing ERP module which stores all the details of the customer, orders and product catalog of the store and searches for specific details on many levels to produce output in Ajax based admin grids that allow dynamic filtering through the result. The result grid is constructed by making dynamic Ajax based calls to the underlying data structure and produces faster and better results because of that.
The Ajax Grid
Search results of the module are shown in an Ajax based admin grid. The resulting rows are already depicting the information according to the search criteria supplied by the admin but the grid itself is also customizable to let the admin sort through the result.
The grid is dynamic and changes in real time without a page reload to match the criteria changed by the admin. Bulk result set will automatically generate pagination through which the admin can navigate to look through multiple pages. For example the admin has searched through all the customers who were registered during the month of November. Now in the result he can add sorting by city so further refine the search to get the customers registered in November and who come from a specific city.
The best thing about the grid is that it is accessible throughout the module whenever a search result is displayed. And admin can search and sort through the already searched data dynamically and faster than any other searching method.
How custom search is possible?
The entire module searches on a lot of criteria specified by the admin revolving mainly around these three domains:
We’ll see each of these domains in a little bit more detail now:
Search through catalog
Anything and everything related to products of the store can be searched using this section of the module. The admin can search basic information like product name, product id, product SKU, availability of the product and can take it further by more custom search through product’s attributes like categories, subcategories, manufacturers, suppliers, warehouses and most importantly price. Products can be searched by exact price as well as price ranges.
Search through customers
A separate tab is dedicated to search through the records of the customers. Starting from basic search on customer names and address the module takes it much further by allowing the admin to search through each and every detail associated with the customer. These additional details like, the website and store in which the customer is registered, the payment preferences and additional addresses are divided into micro search categories:
Search through orders
The last search domain is through orders placed by customers. Admin can search all the orders in terms of their placed date (creation date), status of the order whether pending or completed, and on customer’s name. The resultant grid can be sorted according to fields required.
Combined search through multiple domains
All the three area defined above can be searched as separate entity as well as can be combined to produce a more refined result. For example we can combine the customer and sales search to get the number of customers whose orders are completed. Or we can combine product and sales search to get the suppliers of specific products that placed a particular order. There can be as many combinations as there are separate searching fields in each of the three category and we can get precise information in record time!
The best feature of this module is that not only it searches through Magento in built data but also integrates with the ERP module and searches through the information stored in that module as well. So the administration of the store and its information becomes more structured, centralized and quite easy to manage.