If attribute ID = 161, below is the simple code to get option ids and values for the attribute ID.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | $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(); echo 'Option ID: ' ; echo $procategorydata [ 'option_id' ]; echo 'Value:' ; echo $procategorydata [ 'value' ]; echo '======' ; } |
No comments:
Post a Comment