magento bundle product displaying as out of stock

robgt picture robgt · Dec 16, 2010 · Viewed 9.6k times · Source

I have created a bundle product in Magento 1.4.0.1. All the components of the bundle are in stock but when the bundle is displayed on the front end, it shows as out of stock? How do I get that product to display "in stock"?

In the admin system, there isn't an option to add inventory for the bundle, so I guess the stock level is worked out from the component parts (if at all?) - perhaps using the lowest stock count of a component item as the basis for the stock level of the entire bundle?

I really don't want that to happen (if it is?). I just need the bundle to display as in stock. Can anyone help?

Answer

Jonathan Day picture Jonathan Day · Dec 16, 2010

Yup, the stock level for a bundle is calculated from the selections for each of the options that are required within the bundle items. If you want to change that behaviour, you will need to override the isSalable($product) function within the Mage_Bundle_Model_Product_Type class so that it is return true.

You can do that by creating your own module with a Model that extends Mage_Bundle_Model_Product_Type and in the config.xml you will need:

<global>
    <models>
        <modulename>
            <class>Namespace_Modulename_Model</class>
        </modulename>
        <bundle>
            <rewrite>
                <product_type>Namespace_Modulename_Model_Product_Type</product_type>
            </rewrite>
        </bundle>
    </models>
....
</global>

Obviously, the danger is that you will sell more items than you have stock to supply, so that needs to be a business decision...