Search code examples
searchmagentoparent-childconfigurable

How do I modify the Magento Search to check child skus?


Currently, the site search will search all of the skus of the items marked as being visible in search. This is all well and good.

The problem arises when the customer knows a sku of the individual child item. So, let's say a product comes in both a 20 foot and 25 foot variation. We would put those into a configurable product and have a single product page where a customer could then choose which of those two lengths.

What happens is, a customer invariably knows that the sku of the 20 ft variation is RDB-20, while the other is RDB-25. A search for RDB-25 then, comes back with no results since the simple product is not visible in search - it doesn't realize there is a match.

How do I get the search to search an item with visibility "Not Visible Individually", when it's parent is visible in search?

The desired effect is that, if a child SKU is searched for, the parent should show up in the results.


Solution

  • There really is no good way of doing it without extending the default search, but at that point you might as well look for other options.

    Here's a workaround that might be doable depending on how you manage your products and it worked for me until I moved on from the default search.

    Rather than altering the search, try adding an attribute to all products and make it hidden concatenating all the skus into this field. The search should find the text attribute and show the configurable.

    Its a bit of a workaround but works for me.