Magento 1.9 Search – Display Parent Product for Child SKU

catalogsearchmagento-1.9search

I want to have functionality if a user searches for the child SKU, then parent products should appear in the result.

It is happening in my store but for few products not for all.

Example : I have a parent product A and its child are A1 and A2, if I am searching A1 or A2 then A is appearing in the search result.
I have one more parent product B and its child are B1 and B2, now when I am searching for B1 or B2, then B is not appearing in the search result.
Configuration for all the child products is nearly same.
Like all the child products are not visible individually and all parent product's visibility is catalog, search.

My first question is why this is working for only few products and not for all.
Secondly, how can I achieve this for all products.

Any help would be appreciated.

Best Answer

By default, the child product's SKU doesn't work in Catalog Search. You will not get the parent product in search result when you search by child product's SKU.

One simple solution to this can be:

  • Create a new textField attribute named children_sku, for example.
  • Make it searchable, i.e. Use in Quick Search = Yes
  • Assign this newly created attribute to your attribute set.
  • Now, while editing configurable product, add comma separated child products SKU in the children_sku attribute text field.
Related Topic