Not getting value of attribute(Magento)

1k views Asked by At

I have created an attribute named as 'specialtext' for every product.But not getting value of this specialtext field in frontend.Any idea?

3

There are 3 answers

0
user2753425 On

Get attribute value for PLAIN TEXT, TEXTAREA or DATE type attribute:

$attribute_value = $product->getShirtSize(); //for shirt_size attribute

Get value from SELECT, MULTISELECT, DROPDOWN or YES/NO attributes:

$attribute_value = $product->getAttributeText($attribute_code);
0
Mubashir On

In order to show newly created product attribute you need to add it to the "attribute sets". Have you added this attribute to attribute set?

0
liyakat On

text or textarea field

For these attributes use this:

// specify the attribute code
$attributeCode = 'name';

// build and filter the product collection
$products = Mage::getResourceModel('catalog/product_collection')
        ->addAttributeToFilter($attributeCode, array('notnull' => true))
        ->addAttributeToFilter($attributeCode, array('neq' => ''))
        ->addAttributeToSelect($attributeCode);

// get all distinct attribute values
$usedAttributeValues = array_unique($products->getColumnValues($attributeCode));

hope this will sure help you.