<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     default_iphone
 * @copyright   Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/**
 * Grouped product data template
 *
 * @see Mage_Catalog_Block_Product_View_Media
 * @see Mage_Catalog_Block_Product_View_Type_Grouped
 */
?>
<?php $_product = $this->getProduct() ?>
<?php $_associatedProducts = $this->getAssociatedProducts() ?>
<?php if($_product->isSaleable() && count($_associatedProducts)): ?>
    <p><?php echo $this->__('Availability: In stock.') ?></p>
<?php else: ?>
    <p><?php echo $this->__('Availability: Out of stock.') ?></p>
<?php endif; ?>
<table cellspacing="0" class="shopping-cart product-data">
    <col />
    <col />
    <col width="1" />
    <thead>
        <tr>
            <th><?php echo $this->__('Product Name') ?></th>
            <th class="a-right"><?php echo $this->__('Price') ?></th>
            <?php if ($_product->isSaleable()): ?>
            <th class="a-center"><?php echo $this->__('Qty') ?></th>
            <?php endif; ?>
        </tr>
    </thead>
    <tbody>
    <?php if (count($_associatedProducts)): ?>
    <?php foreach ($_associatedProducts as $_item): ?>
        <tr>
            <td><?php echo $this->htmlEscape($_item->getName()) ?></td>
            <td class="a-right">
                <?php echo $this->getPriceHtml($_item, true) ?>
            </td>
            <?php if ($_product->isSaleable()): ?>
            <td class="a-center">
            <?php if ($_item->isSaleable()) : ?>
                <input name="super_group[<?php echo $_item->getId() ?>]" value="<?php echo $_item->getQty()*1 ?>" type="text" class="input-text qty" />
            <?php else: ?>
                <?php echo $this->__('Out of stock.') ?>
            <?php endif; ?>
            </td>
            <?php endif; ?>
        </tr>
    <?php endforeach; ?>
    <?php else: ?>
       <tr>
           <td colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>"><?php echo $this->__('No options of this product are available.') ?></td>
       </tr>
    <?php endif; ?>
    </tbody>
</table>
