photo credit: marfis75 via photopin cc

Get bundled products containing a specific product in Magento

In addition to my previous post, sometimes you also have clients who want to show product bundles on the product detail page that contain the product in question. Once again, Magento doesn’t provide this functionality out-of-the-box, and the only way to do it without direct SQL queries is by loading all bundled products and iterating over them. In this scenario, a custom SQL query is totally justified. The query to fetch all bundled products ID containing a specific child product is as follows:

When put in a function you could get something like this:

Happy satisfying your client!

Visitors give this article an average rating of 3.0 out of 5.

How would you rate this article?

Leave a Reply