Created
February 26, 2019 14:34
-
-
Save vishy93/c7ab53eb09895908bd8dde128e3aac9d to your computer and use it in GitHub Desktop.
Change state of an order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//get the remote host IP | |
$szRemoteIP = $_SERVER['REMOTE_ADDR']; | |
//this is the array holding the allowed IP's list; | |
$arrAllowedIPs = array("xxxxx","xxxxxx"); | |
if (!in_array($szRemoteIP, $arrAllowedIPs)) | |
{ | |
//if IP's is not in the list, deny access | |
echo "You don't have the permissions to access this area from $szRemoteIP"; | |
exit(0); | |
} | |
$mageFilename = '../app/Mage.php'; | |
require_once $mageFilename; | |
Mage::setIsDeveloperMode(true); | |
ini_set('display_errors', 1); | |
umask(0); | |
Mage::app('admin'); | |
Mage::register('isSecureArea', 1); | |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
set_time_limit(0); | |
ini_set('memory_limit','1024M'); | |
/* | |
const STATE_NEW = 'new'; | |
const STATE_PENDING_PAYMENT = 'pending_payment'; | |
const STATE_PROCESSING = 'processing'; | |
const STATE_COMPLETE = 'complete'; | |
const STATE_CLOSED = 'closed'; | |
const STATE_CANCELED = 'canceled'; | |
const STATE_HOLDED = 'holded'; | |
const STATE_PAYMENT_REVIEW = 'payment_review'; | |
*/ | |
$orderId = 'order num here'; | |
$order = Mage::getModel('sales/order')->loadByIncrementID($orderId); | |
$order->setState(Mage_Sales_Model_Order::STATE_NEW, true); | |
$order->save(); | |
foreach ($order->getAllItems() as $item) { | |
$item->setQtyCanceled(0); | |
$item->save(); | |
} | |
echo $orderId."<br />Status Updated"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment