I've added a new attribute group "Floor Inventory" with three attributes whose attribute codes are flr00, flro1 and flr02.

I'm trying to get value of flr00 for product with id 2 in root Magento but it's returning NULL value.

$_product = Mage::getModel('catalog/product')->load(2);
  • Do you have multiple storeviews? If so check values for this fields in all store views, maybe some of them overwrites the default one. Check if attribute is assign to attribute set.
    – Mufaddal
    Commented Jun 27, 2015 at 6:40

1 Answer 1


To get the attribute value, use this

$product = Mage::getModel('catalog/product')->load(2); 
$attribute_value = $product->getResource()->getAttribute('flr00')->getFrontend()->getValue($produc‌​t);
echo $attribute_value;

It seems impossible to get value without loading product model. If you take a look at file app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Abstract.php you'll see the method

public function getValue(Varien_Object $object)
    $value = $object->getData($this->getAttribute()->getAttributeCode());
    if (in_array($this->getConfigField('input'), array('select','boolean'))) {
        $valueOption = $this->getOption($value);
        if (!$valueOption) {
            $opt = new Mage_Eav_Model_Entity_Attribute_Source_Boolean();
            if ($options = $opt->getAllOptions()) {
                foreach ($options as $option) {
                    if ($option['value'] == $value) {
                        $valueOption = $option['label'];
        $value = $valueOption;
    elseif ($this->getConfigField('input')=='multiselect') {
        $value = $this->getOption($value);
        if (is_array($value)) {
            $value = implode(', ', $value);
    return $value;

As you can see this method requires loaded object to get data from it (3rd line).

Hope this helps

  • tried var_dump(Mage::getResourceModel('catalog/product')->getAttributeRawValue(2, 'flr00', 1)); but it returns bool(false) while $_product = Mage::getModel('catalog/product')->load(2); $value = $_product->getData('flr00'); var_dump($value); returns NULL.
    – amitshree
    Commented Jun 27, 2015 at 6:27
  • $product = Mage::getModel('catalog/product')->load(877); $attribute_value = $product->getResource()->getAttribute('gender')->getFrontend()->getValue($product);echo $attribute_value This works for me.! Commented Jun 27, 2015 at 6:39
  • Check my updated ans Commented Jun 27, 2015 at 6:42
  • why you're passing $product again in getValue($product); there?. It doesn't work either. Should var_dump($product) contain flroo attribute?
    – amitshree
    Commented Jun 27, 2015 at 6:46
  • Check my edited answer. This wil answer your curiosity Commented Jun 27, 2015 at 6:53

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.