0

I created an Attribute of type dropdown. I assigned two values of "Yes" & "No". While printing those attributes values, while comparing products i get the values like "133" / "134" . Is it because of systems predefined value or what it is ? How can i get the same value as i assigned for options "Yes" or "No" get printed as attribute value?

Note : I tried attribute type 'yes/no' , this prints '1' and ' ' (this will not be clear to visitors/customers).

The code below prints the numeric value for only dropdown attribute type where as its working nicely for input field attribute type

$valueattr = Mage::getResourceModel('catalog/product')->getAttributeRawValue($_item->getId(), $_attribute->getAttributeCode(), $storeId);
3
  • please write the code you have tried which prints the numeric value..
    – Dexter
    Oct 16, 2014 at 10:34
  • @Dexter , yes i updated with code.
    – Suman K.C
    Oct 16, 2014 at 10:41
  • @Marius has already answered your question.. enjoy !!!
    – Dexter
    Oct 16, 2014 at 10:58

2 Answers 2

3

getAttributeRawValue prints the actual value stored in the db. And yes/no attributes are kept as 0 and 1.
Try using:

$valueLabel = $_item->setStoreId($storeId)->getAttributeText($_attribute->getAttributeCode());
0
1

use getAttributeText('attributecode') method to get the frontend value for any attribute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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