Last active
October 25, 2016 05:21
-
-
Save webdawe/aa9a5fcb7db7c16c8680d6cc32e38f26 to your computer and use it in GitHub Desktop.
Configuration Settings Source Model for Product Attribute Collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* @category Webdawe | |
* @package Webdawe_General | |
* @author Anil Paul | |
* @copyright Copyright (c) 2016 Anil Paul | |
* @license | |
*/ | |
class Webdawe_General_Model_System_Config_Source_Product_Attribute | |
{ | |
/** | |
* Retireve option Array of Product Attributes | |
* @return array | |
*/ | |
public function toOptionArray() | |
{ | |
$collection = Mage::getResourceModel('eav/entity_attribute_collection') | |
->setEntityTypeFilter(Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId()) | |
//->addFieldToFilter('backend_type', 'int'); // Uncomment if you want to filter with backend type | |
$cols = array(); | |
foreach($collection->getItems() as $col) | |
{ | |
$cols[] = array('value' => $col->getAttributeCode(), 'label' => $col->getFrontendLabel()); | |
} | |
return $cols; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment