Tuesday, July 25, 2017

Magento- Customer attribute values by attribute ID

Magento- Customer attribute values by attribute ID


 <?php
    $valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
    ->setAttributeFilter(161)
    ->load();


    foreach ($valuesCollection as $item) {

    $attr = Mage::getModel('eav/entity_attribute_option')
    ->getCollection()->setStoreFilter()
    ->join('attribute','attribute.attribute_id=main_table.attribute_id', 'attribute_code')
    ->addFieldToFilter('main_table.option_id',array('eq'=>$item->getId()))->getFirstItem();
    $procategorydata= $attr->getData();       
    ?>
    <option value="<?php echo $procategorydata['option_id'] ?>"><?php echo $procategorydata['value'] ?></option>
    <?php
    }
    ?>

No comments :

Post a Comment