Skip to content

Instantly share code, notes, and snippets.

@cgdangelo
Created July 17, 2012 21:13
Show Gist options
  • Save cgdangelo/3132147 to your computer and use it in GitHub Desktop.
Save cgdangelo/3132147 to your computer and use it in GitHub Desktop.
<?php
require 'app/Mage.php';
umask(0);
Mage::app();
$attribute = Mage::getModel('catalog/entity_attribute')->loadByCode(
Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId(),
'tiger_cost'
);
$attributeSets = Mage::getModel('eav/entity_attribute_set')->getCollection();
foreach ($attributeSets as $set) {
$attributeGroup = Mage::getModel('eav/entity_attribute_group')->getCollection()
->addFieldToFilter('attribute_set_id', array('eq' => $set->getId()))
->addFieldToFilter('attribute_group_name', array('eq' => 'General'))
->getFirstItem();
$attribute->setAttributeSetId($attributeGroup->getAttributeSetId());
$attribute->setAttributeGroupId($attributeGroup->getAttributeGroupId());
$attribute->save();
}
/* PHP Fatal error: Call to undefined method Mage_Eav_Model_Resource_Entity_Attribute::isUsedBySuperProducts() in /var/www/app/code/core/Mage/Catalog/Model/Entity/Attribute.php on line 86 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment