I have managed to show the bundle products in stock. but I'm not quite there yet.
I have done the following inside app/design/frontend/base/default/template/bundle/catalog/product/view/type/bundle.phtml
<p class="availability in-stock"><?php echo $this->helper('catalog')->__('Availability:') ?>
<span><?php echo $this->helper('catalog')->__('In stock') ?></span></p>
Change to:
<?php
$selectionCollection = $_product->getTypeInstance()->getSelectionsCollection($_product->getTypeInstance()->getOptionsIds());
$qty = false;
foreach ($selectionCollection as $option) {
$product_id = $option->product_id;
$bundleOption = Mage::getModel('catalog/product')->load($product_id);
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($bundleOption);
if ($qty === false) {
$qty = $stock->getQty();
} else {
$qty = min(array($qty, $stock->getQty()));
}
}
?>
<p class="availability in-stock">
<span class="label"><?php echo $this->helper('catalog')->__('Availability:') ?></span>
<span class="value"><?php echo $qty . ' ' . $this->helper('catalog')->__('In stock') ?></span>
</p>
I now get to see the number of separate products that I have in stock
But i want the following
Example;
I sell roses per unit of 1
And the bundle is a box of 6 roses.
The bundle now shows Availability: 18.0000 In stock. because I have 18 separate roses in stock. And now the hard part how can i display the right quantity. 18 roses is stock has to be 3 bundle products is stock 3 x 6 = 18. So i want to have Availability: 3 In stock without all the zeros.