Last active
August 29, 2015 14:16
-
-
Save dinhkhanh/e8e2deee8a44f597761c to your computer and use it in GitHub Desktop.
Magento: Update attributes source_model
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 | |
require_once "app/Mage.php"; | |
Mage::app(); | |
$installer = new Mage_Eav_Model_Entity_Setup('core_setup'); | |
$entityTypeId = $installer->getEntityTypeId('catalog_product'); | |
// replace <my_attribute_code> with your attribute code | |
$idAttribute = $installer->getAttribute($entityTypeId, '<your_attribute_code_here>', 'attribute_id'); | |
$installer->updateAttribute($entityTypeId, $idAttribute, array( | |
'source_model' => 'yournewmodule/your_new_model' | |
)); | |
// let's see if it worked | |
$attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', '<your_attribute_code_here>'); | |
Zend_Debug::dump($attribute->getData()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment