In Magento , There is option to create new attribute in admin side and show value in the frontend .Here we going to see how to fetch the data from the dropdown attribute , Below is the code for shows the fitering the layout as per the attribut value in product list page:
<?php $_productCollection=$this->getLoadedProductCollection(); $_helper = $this->helper('catalog/output'); $_product = $this->getProduct(); ?> <div class="SkinType"> <h2>Search by Skin Type:</h2> <?php $collection = Mage::getResourceModel('catalog/product_attribute_collection') ->addFieldToFilter('attribute_code', array('eq'=>'skintype')) ->addStoreLabel(Mage::app()->getStore()->getId()) ->load(); foreach($collection as $a){ $manufArray = $a->getSource()->getAllOptions(false); //foreach($a->getSource()->getAllOptions(false) as $option) //$manufArray[$option['value']] = $option['label'] . "<br />"; } ?> <?php //IF YOU NEED TO DEBUG YOUR VALUES $cnt=count($manufArray); ?> <ul> <?php for($i=0;$i<$cnt;$i++) {?> <li><a href="?skintype=<?php echo $manufArray[$i][value] ?>"><?php echo $manufArray[$i][label]; ?></a></li> <?php }?> </ul> </div>