Below is the example code.
this may be any attribute code
1 | $arg_attribute = "manufacturer" ; |
Object of attribute model
1 | $attribute_model = Mage::getModel( 'eav/entity_attribute' ); |
Object of attribute options model
1 2 3 4 | $attribute_options_model = Mage::getModel( 'eav/entity_attribute_source_table' ) ; $attribute_code = $attribute_model ->getIdByCode( 'catalog_product' , $arg_attribute ); $attribute = $attribute_model ->load( $attribute_code ); $attribute_table = $attribute_options_model ->setAttribute( $attribute ); |
Getting all options
1 | $options = $attribute_options_model ->getAllOptions(false); |
Printing all options of particular attribute
1 | print_r( $options ); |
Below is comple code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | //this may be any attribute code $arg_attribute = "manufacturer" ; //Object of attribute model $attribute_model = Mage::getModel( 'eav/entity_attribute' ); //Object of attribute options model $attribute_options_model = Mage::getModel( 'eav/entity_attribute_source_table' ) ; $attribute_code = $attribute_model ->getIdByCode( 'catalog_product' , $arg_attribute ); $attribute = $attribute_model ->load( $attribute_code ); $attribute_table = $attribute_options_model ->setAttribute( $attribute ); //Getting all options $options = $attribute_options_model ->getAllOptions(false); //Printing all options of particular attribute print_r( $options ); |
No comments:
Post a Comment