删除已取消的magento订单cron
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了删除已取消的magento订单cron相关的知识,希望对你有一定的参考价值。
Say you don’t want to reset ALL your orders, maybe you want to PRUNE a production database. if that’s the case, this php file (added to a crontab, or ran from your magento root directory) will DELETE all cancelled orders (5000 limit per instance). This is helpful for production instances, to keep your magento running smoothly if you run alot of test transactions.
<?php require_once('app/Mage.php'); Mage::app('admin'); Mage::register('isSecureArea',true); $collection = Mage::getResourceModel('sales/order_collection') ->addAttributeToSelect('*') ->setPageSize(5000) ->addFieldToFilter('status', 'canceled')->load(); foreach ($collection as $col) { try { $col->delete(); } catch (Exception $e) { throw $e; } }
以上是关于删除已取消的magento订单cron的主要内容,如果未能解决你的问题,请参考以下文章