Skip to content

Instantly share code, notes, and snippets.

@dinhkhanh
Last active January 17, 2017 11:32
Show Gist options
  • Save dinhkhanh/51921ae1643da2103d90 to your computer and use it in GitHub Desktop.
Save dinhkhanh/51921ae1643da2103d90 to your computer and use it in GitHub Desktop.
Magento restore canceled orders
<?php
require_once 'app/Mage.php';
Mage::app();
$order = Mage::getModel('sales/order')->load(258); // order_id (not increament id)
$order->setState(Mage_Sales_Model_Order::STATE_NEW);
$order->setStatus(Mage_Sales_Model_Order::STATE_NEW);
$order->save();
foreach ($order->getAllItems() as $item) {
$item->setQtyCanceled(0);
$item->save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment