There's a simple magic method to get the value of the object:
$attribute = Mage::getModel('eav/entity_attribute')->load( $your_attribute_id );
$attribute->getFrontendInput();
The result is a short string, for example "text" or "select". Here's a short list of all types in Magento 1.7 (german translation):
- text: Einzeiliges Textfeld
- textarea: Mehrzeiliger Textbereich
- date: Datum
- boolean: Ja/Nein
- multiselect: Mehrfach Auswahl
- select: selected="selected: Drop-Down
- price: Preis
- media_image: Bild
- weee: Feste Produktsteuer (FPT)
If you need a list of all options from a single attribute, do this:
Mage::getModel( 'eav/config' )->getAttribute( 'catalog_product' , 'code_of_attribute' )
So you've load the attribute object. Other methods for loading an object doesn't work for me (e.g. Mage::getModel('eav/entity_attribute')->load('xy'); ).
Then use the getSource() method and the getAllOptions method to recieve an array with all options:
$your_attribute->getSource()->getAllOptions(true, true)
Result looks like this:
array(4) {
[0]=>
array(2) {
["label"]=>
string(0) ""
["value"]=>
string(0) ""
}
[1]=>
array(2) {
["value"]=>
string(1) "5"
["label"]=>
string(6) "red"
}
[2]=>
array(2) {
["value"]=>
string(1) "4"
["label"]=>
string(6) "blue"
}
[3]=>
array(2) {
["value"]=>
string(1) "3"
["label"]=>
string(6) "green"
}
}