deal with 'non-admin area' warn

We usually use the follow code to delete product in Magento

$product = Mage::getSingleton('catalog/product')->load($productId);
$product->delete();

 Of course, you are given a warn from magento. To solve this problem, you should add the follow code before and after delete

  Mage::register('isSecureArea', true);

  Mage::unregister('isSecureArea', true);

作者:冯亮
         
能力有限,水平一般。如有错误,欢迎指正
原文地址:https://www.cnblogs.com/fengliang/p/3661086.html