1

in code

$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'packsize');
 foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) 
 {
         $myArray[$instance['value']] = $instance['label']; 


 }
 print_r($myArray = $instance['label']);

i want to show a packsize retrive from database.

  • is packsize config attribute? – Amit Bera Feb 23 '16 at 11:29
1

Here it is;

$attribute = Mage::getModel("eav/entity_attribute")->loadByCode("catalog_product", 'packsize');
$options = $attribute->getSource()->getAllOptions();
foreach ($options as $option)
{

    $value = $option['label'];
    echo $value."</br>";
//  $myArray[]=$value; //if you want to save as an array

}
// var_dump($myArray);

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.