jruzafa
3/5/2015 - 12:45 PM

Friendly array attributes product #magento #attributes #source

Friendly array attributes product #magento #attributes #source

<?php

 public function toOptionArray()
    {
        $attr           = array();
        $productAttrs   = Mage::getResourceModel('catalog/product_attribute_collection');
        foreach ($productAttrs as $_productAttr) {

            $_code          = $_productAttr->getAttributeCode();
            $attr[$_code]   = ($_productAttr->getFrontendLabel() != null) ? $_productAttr->getFrontendLabel().' ('.$_code.')' : $_code;
            /** $productAttr Mage_Catalog_Model_Resource_Eav_Attribute */
        }

        return $attr;
    }