3

Been using this snippet to retrieve the attribute values but this only works for input type text or boolean but not for dropdown type of attributes:

$_resource = Mage::getResourceSingleton('catalog/product');
$_resource->getAttributeRawValue($_productId, 'color', Mage::app()->getStore());

For the select dropdown type, it returns bool(false) and I am expecting it would return the dropdown frontend value/label.

How can I get the attribute value of a product without loading the whole product model?

Thank you.

2

Another option for getting dropdown attribute value :

$_product->getAttributeText('contrast_ratio');

getAttributeText method is use for retrieving the SELECT, MULTISELECT, DROPDOWN or YES/NO attributes value.

  • it returns only TEXT means not its Value. Like dropdown option 33,34 etc, but it shows AM,PM(which is text) – Pratik C Joshi Oct 7 '15 at 5:29
0

Below code is help you out :

$_product->getResource()->getAttribute('contrast_ratio')
    ->getFrontend()->getValue($_product);

Note : contrast_ratio is your dropdown attribute code

  • 1
    Well, I don't need to load the whole product model so I don't have access to $_product. – user1240207 Dec 19 '14 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.