Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as PHP by Artem ( 17 years ago )
public function sales_order_save_after($observer)
{
$order = $observer->getEvent()->getOrder();
$storeId = $order->getStoreId();
// default history row values
$data = array(
'ts' => now(),
'action_code' => 'order',
'customer_id' => $order->getCustomerId() ? $order->getCustomerId() : null,
'customer_email' => $order->getCustomerEmail(),
'order_id' => $order->getId(),
'order_increment_id' => $order->getIncrementId(),
'store_id' => $storeId,
);
// I added Start
$this->_setConstract();
$userID=$this->_getUserID();
$sql = "SELECT TransactionID FROM UserTransactions U where userID=$userID and isPaid=0";
$rez1 = mysql_query($sql, $this->dblink);
////////////////////
// process applied gift certificates
foreach ($this->_orderUpdates as $cert) {
// I added Start
$sql2 = "SELECT * FROM GiftCodesUnused where gcNo=$cert";
$rez = mysql_query($sql, $this->dblink);
$results = mysql_fetch_assoc($rez); // Gives an error box
///////////////////
$cert->save();
$data['amount'] = $cert->getAmount();
$data['status'] = $cert->getStatus();
$data['currency_code'] = $cert->getCurrencyCode();
$cert->addHistory($data);
}
$this->_orderUpdates = array();
Revise this Paste
Parent: 9220