Magento – Magento 1.9.1: Bundle Items Doesn’t Show All Products For Selection

backendbundlebundled-product

Update: Digging through app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php and making some progress. Commenting out the filters help…

protected function _prepareCollection()
{   
    $collection = Mage::getModel('catalog/product')->getCollection()
        ->setStore($this->getStore())
        ->addAttributeToSelect('name')
        ->addAttributeToSelect('sku')
        ->addAttributeToSelect('price')
        ->addAttributeToSelect('attribute_set_id')
        ->addAttributeToFilter('type_id', array('in' => $this->getAllowedSelectionTypes()));
        //->addFilterByRequiredOptions();
        //->addStoreFilter();

Single store installation.

When I try to the "Please Select Products to Add" step I cannot see all the products that are available. I've tried searching without any filters, by id or SKU to no avail.

See this example for the results on a backend catalog search with the same filters than in the "Please Select Products to Add":

Filter "rpi" for SKU on the catalog backend:

Filter "rpi" for SKU on the catalog backend

Filter "rpi" for SKY on the "Please Select Products to Add" within "Bundle Items" of a Bundle product:

Filter "rpi" for SKY on the "Please Select Products to Add" within "Bundle Items" of a Bundle product

Does someone have any suggestions why this is the case?

The problem is in the search within the Bundle Items, as the products exist and appear in both the backend and frontend (even categories) without a problem.

Best Answer

So after some experimentation, I tracked the products that were not being shown. It turns out that Magento will not show simple product with required custom options as selectable inside the "Please Select Products to Add" search for bundled products.

The collection inside the file:

app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php

Has the filter:

addFilterByRequiredOptions()

which as you may have guessed, performs this filtering.

Related Topic