Created
December 14, 2012 17:45
-
-
Save tegansnyder/4287245 to your computer and use it in GitHub Desktop.
Magento load an order by IncrementId and clear and discounts that applied on the order.
This file contains 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 | |
error_reporting(E_ALL | E_STRICT); | |
require_once 'app/Mage.php'; | |
Varien_Profiler::enable(); | |
Mage::setIsDeveloperMode(true); | |
ini_set('display_errors', 1); | |
umask(0); | |
Mage::app('default'); | |
$order = Mage::getModel('sales/order')->loadByIncrementId('100126630'); | |
$original_price = 0; | |
foreach ($order->getAllItems() as $itemId => $item) { | |
$item->setDiscountAmount(0); | |
$item->setOriginalPrice($item->getOriginalPrice()); | |
$item->save(); | |
$original_price += $item->getOriginalPrice(); | |
} | |
$order->setGrandTotal($original_price); | |
$order->setBaseGrandTotal($original_price); | |
$order->setTotalPaid(0); | |
$order->setShippingAmount(0); | |
$order->setBaseShippingAmount(0); | |
$order->save(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment