How to display configurable product options in category list page

The question:

How to check that Displaying configurable product options in category list page?

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

In order just to display all sale able options
in the category go to .../app/design/frontend/[package]/[theme]/template/catalog/product/list.phtml and place within foreach ($_productCollection as $_product) something like this:

<?php if($_product->isConfigurable()): ?>
  //get attributes
  <?php $attributes = $_product->getTypeInstance(true)->getConfigurableAttributes($_product) ?>
  <?php if(count($attributes)): ?>
    <ul>
    <?php foreach($attributes as $att): ?>
      <?php $pAtt=$att->getProductAttribute();
        //get the child products
        $allProducts = $_product->getTypeInstance(true)->getUsedProducts(null, $_product);
        $frontValues =array() ?>
      <li><?php echo $pAtt->getFrontendLabel() ?>
       <ul>
       <?php foreach($allProducts as $p): ?>
         //check stock, status, ...
         //do not show unsaleable options
         <?php if(!$p->isSaleable()) continue; ?>
         <?php $out=$p->getAttributeText($pAtt->getName()); ?>
         <?php $frontValues[$out]=$out; ?>
       <?php endforeach ?>
        <li><?php echo implode('</li><li>', $frontValues) ?></li>
       </ul>
      </li>
    <?php endforeach ?>
    </ul>
  <?php endif ?>
<?php endif ?>

Perhaps you like to add some css classes to the <ul> and <li> tags.

This won’t increase the performance of your shop!

inspired by this Post

http://www.magentocommerce.com/boards/viewthread/73926/#t437146

Method 2

You can use something like if ($_product->getTypeId() == 'configurable') inside of your products loop.

Method 3

try this one.
Display Available Configurable Product Options on Product Listing page in Magento

Method 4

This can take up considerable server resources as there can be many options for each product. Best way is to use ajax to only load ALL the options when asked for. I found this extension that will load colors first, then when you mouse over it will give you all the product options.

http://www.consofas.com/plugins/options-quickview-for-configurable-products-in-magento/

Method 5

Try This once

<?php $ptype = $_product->getTypeId();?>
<?php 
                                                if($ptype=='configurable'): ?>
                                                <!--get attributes-->
                                                <?php 
                                                $attributes = $_product->getTypeInstance(true)->getConfigurableAttributes($_product) ?>
                                                <?php 
                                                if(count($attributes)): ?>
                                                <?php 
                                                    foreach($attributes as $att): ?>
                                                    <?php 
                                                        $pAtt=$att->getProductAttribute();
                                                        //get the child products
                                                        $allProducts = $_product->getTypeInstance(true)->getUsedProducts($_product,null);
                                                        $frontValues =array();
                                                        foreach($allProducts as $p):
                                                            if($p->isSaleable()):
                                                                $attributeExist =$_product->getResource()->getAttribute($pAtt->getName());
                                                            ?>
                                                                <input type="hidden" name="super_attribute[<?php echo $pAtt->getAttributeId() ?>]" value="<?php  echo $attributeExist->getSource()->getOptionId($p->getAttributeText($pAtt->getName()));?>">
                                                            <?php
                                                                break;
                                                            endif;
                                                        endforeach;
                                                    endforeach;
                                                endif;
                                                    ?>
                                                <?php
                                                endif;
                                                ?>

Method 6

Following link might help you.

http://hkpatel201.blogspot.in/2012/09/get-product-custom-option-in-list-page.html

Go through the code

Thanks


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment