Wednesday, January 13, 2016

Delete Product Attribute Programatically

<?phpdefine('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
Mage::app();

echo "Begining...."."\n";
try{
$model = new Mage_Eav_Model_Entity_Setup('core_setup');
// your attribute code here
$attribute_id = 'salelabel'
// Remove Product Attribute
$model->removeAttribute('catalog_product', $attribute_id);
echo "Done"."\n";
}catch(Exception $e)
{
  echo "An exception occured.".$e->getMessage();      
}
echo "Ending...."."\n";

No comments:

Post a Comment