Usually you have after a certain time of developing some test orders that you want go get rid of.
this is a small script to delete them
// if you run this code in a shell, see comment below, you have to set this flag
Mage::register('isSecureArea', true);
// select all orders
$orders = Mage::getModel('sales/order')->getCollection();
// select defined orders listed in $orderIds
$orders = Mage::getModel('sales/order')->getCollection()
->addFieldToFilter('entity_id', (array) $orderIds);
foreach ($orders as $order) {
$order->delete();
}
you can run code snippet like above with a php shell as provided in
Magento PHP Developer's Guide (p.58)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlYrZxUHicj26pHOAPoIorG3JqEqQG-ScsIQanXNiUzeY_CPK0FeVnCPzVJatqmMZToKF0eUWaRbWjE8hK5mpY2oEeDL-irCAm8u6WCsCEdwCWClge9Mm0G1CjwLYJcgun8NkRhWiTJdsS/s1600/magento_php_developers_guide.jpeg)
No comments:
Post a Comment