我正在尝试从目录中删除产品中的。删除Magento中的产品问题
每当我尝试通过使用管理界面(大量或单一动作)删除产品时,它会引发我500内部服务器错误。 每当我尝试使用脚本删除产品(编程)它只是挂在删除方法调用。
没有显示错误输出,即使打开日志记录也不会抛出异常并且日志无声。
下面是示例代码我在我的脚本中使用:
//...
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('sku')
->addStoreFilter($store_id);
$collection->load();
// collection is not empty I checked
foreach ($collection as $product) {
try {
$product->delete(); // this is the line where it hangs
print $product->getSku() . " deleted" . PHP_EOL;
} catch (Exception $e) {
print $e->getMessage();
}
}
有没有人有这样的经验,可能是什么原因?
这是Magento Enterprise 1.11,它与我所知的Magento Community 1.6相对应。
多少产品你有你的网站吗?我在巨大的目录上遇到了很长的加载时间(当你在你的集合上使用foreach()时,你基本上调用$ collection-> load())。什么是你的php.ini文件中的memory_limit? – 1000Nettles
@Yrcrz我检查过那样的东西。如果在删除方法调用后检查注释行,则表示这是挂起的行。 –