skip to Main Content

I have created a new attribute on magento 1.9 and called category_grouped. Now I am trying to get it’s value on catalog page by using getAttributeRawValue but all I am getting is an ID. How could I get the value name rather than the ID? Below is my code. Thanks

<?php $attributeId = Mage::getResourceModel('catalog/product')-
>getAttributeRawValue($_product->getID(), 'category_grouped', $storeId);?>

2

Answers


  1. Chosen as BEST ANSWER

    The getAttributeText gets the value / name of the given attribute while getAttributeText return in this case the ID.

     $attributeValue = Mage::getModel('catalog/product')
        ->load($_product->getID())
        ->getAttributeText('category_grouped');
    

  2. You can set attribute value by using below code

    $product->CategoryGrouped();
    

    Thanks

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search