Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Display all Simple Products Associated To Configurable Product

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 544
    Comment on it
    <?php
        $_cat  =   Mage::getModel('catalog/layer')->getCurrentCategory()->getId(); 
        $_productCollection=$this->getLoadedProductCollection();
        $_helper = $this->helper('catalog/output');
    ?>
    
    
    <?php    $cat = Mage::getModel('catalog/category')->load($_cat);
            $_categories = $cat->getChildrenCategories(); ?>
            <?php foreach ($_categories as $_category): ?>
            <?php $subcatid =  $_category->getId() ?>
            <a href="<?php echo $_category->getUrl() ?>" title="<?php echo $_category->getName() ?>"><?php echo $_category->getName() ?></a>
            <?php  //$productCollection = Mage::getResourceModel('catalog/product_collection')
                              //->addCategoryFilter(4);?>
            <?php endforeach; ?> 
    
    
    <?php if(!$_productCollection->count()): ?>
    <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
    <?php else: ?>
    <div class="category-products">
        <?php //echo $this->getToolbarHtml() ?>
        <?php if($this->getMode()=='grid'): ?>
        <?php $_collectionSize = $_productCollection->count() ?>
        <?php $_columnCount = $this->getColumnCount(); ?>
        <ul>
        <?php foreach ($_productCollection as $_product): ?>
            <?php if($_product->isConfigurable()) :?>
                <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
            <li style="float:left;">
    
                <?php /**************** To Display simple products associated to configurable products ********************/?>
    
                <?php $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
                $col = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();?>
                <ul>
                    <?php foreach($col as $simple_product) : ?>
                    <li style="float:left;margin-right:20px; border:1px solid #ddd;">
                        <?php   $product_id = $simple_product->getId();
                        $obj = Mage::getModel('catalog/product');
                        $_products = $obj->load($product_id); // Enter your Product Id in $product_id
                        echo "<strong><a href='".$_products->getProductUrl()."'>".$_products->getName()."</strong></a>";
                        $_products->setData('tier_price',null);
                        $_tierPrices = $this->getTierPrices($_products);?>
                            <ul id="price table">
                                <?php foreach ($_tierPrices as $tier): ?>
                                <li>
                                <?php echo $tier['formated_price'];?>
                                <?php echo $tier['price_qty'];?>
                                </li>
                                <?php endforeach ; ?>
                            </ul>
                            <a href="<?php echo $this->getAddToCartUrl($_product) ?>">Order</a>
                    </li>
                    <?php endforeach; ?>
                </ul>
                <?php /**************** To Display simple products associated to configurable products ********************/?>
    
            </li>
            <?php endif; ?>
            <?php endforeach; ?>
        </ul>
            <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
        <?php endif; ?>
    </div>
    <?php endif; ?>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: