0

By default Magento indicates a bundled product out of stock if none of the associated products are in stock. Is there a way to change that behaviour?

I'm not using any isSaleable() conditionals, so that can't be the cause.

I'm getting the bundle products via product_collection model like this:

$products = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->addStoreFilter()
->addIdFilter($child_prods[0], false);
#->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);

$products->load();

where $child_prods[0] is a list of product IDs of bundle products.

I tried changing the isSalable() method in /app/code/core/Mage/Bundle/Model/Product/Type.php to return always true, but the change didn't take effect. Any ideas?

  • On a related note: Changing the isSalable() method to return true as mentioned above does indeed change the bool to true for all bundle products, but still, the bundle product with all associated products not in stock doesn't pick up in the product collection. Any idea? – oschloebe Aug 23 '13 at 11:38
  • I gather you have set the admin configuration (under catalog->inventory) setting 'Display Out of Stock Products' to yes, and re-indexed? Also have you ouputted your collection select using $products->getSelect() to see what your actual SQL is? – ProxiBlue Aug 23 '13 at 12:11
  • Well, 'Display Out of Stock Products' is set to No as I need to only show Bundle Products whose associated products are out of stock. Simple products (and all other product types) that are out of stock should NOT be displayed. I did consult the $products->getSelect(): pastebin.com/BM6RUDk0 – oschloebe Aug 23 '13 at 12:31
  • I have not tested this, but looking at your paste bin sql you are linking with the index table: 'INNER JOIN catalog_category_product_index AS cat_index ON cat_index.product_id=e.entity_id' Out of Stock products would not be indexed, due to the before mentioned setting being set to no. – ProxiBlue Aug 23 '13 at 22:31
4

Changing core methods might not be the best way to go about. I would suggest accepting backorders on the simple products making up the bundled product or turning off stock all together. Both settings can be found under System > Configuration > Catalog > Stock > Settings product stock

This way your bundled product will always be 'in stock' without having to change the core.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.