本文整理汇总了PHP中OrderHistory::save方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderHistory::save方法的具体用法?PHP OrderHistory::save怎么用?PHP OrderHistory::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderHistory
的用法示例。
在下文中一共展示了OrderHistory::save方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canceledOrderForError
private function canceledOrderForError()
{
$history = new OrderHistory();
$history->id_order = (int) $this->pagSeguro->currentOrder;
$history->changeIdOrderState(6, (int) $this->pagSeguro->currentOrder);
$history->save();
}
示例2: canceledOrderForErro
function canceledOrderForErro($pag_seguro)
{
$currentOrder = (int) $pag_seguro->currentOrder;
$history = new OrderHistory();
$history->id_order = $currentOrder;
$history->changeIdOrderState(6, $currentOrder);
$history->save();
}
示例3: actionCreate
/**
* Creates a new OrderHistory model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new OrderHistory();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->record_id]);
} else {
return $this->render('create', ['model' => $model]);
}
}
示例4: _acceptPayment
private function _acceptPayment($order, $disposition, $currency_sign, $amount = NULL)
{
$isCorrect = true;
if (!$disposition) {
die(Tools::displayError());
}
if (!isset($amount) || $amount === '') {
$amount = $disposition['amount'];
}
$amount = number_format($amount, 2, '.', '');
$close_flag = (int) ($amount == $disposition['amount']);
list($resultcode, $errorcode, $errormessage) = $this->executeDebit($disposition['id_cart'], $amount, $close_flag);
$param = '';
if ($resultcode != 0) {
$message = $this->getL('payment_error') . ' ' . $errormessage;
$isCorrect = false;
} else {
$message = $this->getL('payment_accepted') . '(' . $amount . ' ' . $currency_sign . ') ' . ($close_flag ? $this->getL('disposition_consumed') : '');
}
$msg = new Message();
$msg->message = $message;
$msg->id_order = (int) $order->id;
$msg->private = 1;
$msg->add();
if ($isCorrect) {
if ($order->total_paid == $order->total_paid_real) {
$order->total_paid_real = $amount;
} else {
$order->total_paid_real += $amount;
}
$os = Configuration::get('PS_OS_PAYMENT');
if ($order->total_paid != $order->total_paid_real) {
$os = Configuration::get($this->prefix . 'ORDER_STATE_PART_ID');
}
$history = new OrderHistory();
$history->id_order = (int) $order->id;
$history->changeIdOrderState($os, (int) $order->id);
$history->save();
$order->save();
}
return $isCorrect;
}
示例5: refund
/**
* Initiates refund
*/
private function refund($id_order)
{
include_once _PS_MODULE_DIR_ . '/bluepay/bluepay_orders.php';
$bluepay_order = BluePayOrder::getOrderById((int) $id_order);
if (!$bluepay_order) {
return false;
}
$order = new Order((int) $id_order);
if (!Validate::isLoadedObject($order)) {
return false;
}
$products = $order->getProducts();
$currency = new Currency((int) $order->id_currency);
if (!Validate::isLoadedObject($currency)) {
$this->_errors[] = $this->l('Not a valid currency');
}
if (count($this->_errors)) {
return false;
}
$decimals = (is_array($currency) ? (int) $currency['decimals'] : (int) $currency->decimals) * _PS_PRICE_DISPLAY_PRECISION_;
// Amount for refund
$amount = 0.0;
foreach ($products as $product) {
$amount += (double) $product['product_price_wt'] * ($product['product_quantity'] - $product['product_quantity_refunded']);
}
$amount += (double) $order->total_shipping + (double) $order->total_wrapping - (double) $order->total_discounts;
// check if total or partial
if (Tools::ps_round($order->total_paid_real, $decimals) == Tools::ps_round($amount, $decimals)) {
$response = $this->processRefund($bluepay_order['transaction_id']);
} else {
$response = $this->processRefund($bluepay_order['transaction_id'], (double) $amt);
}
parse_str($response, $post_response);
$message = $post_response['MESSAGE'];
$status = $post_response['STATUS'];
if ($status == 1 && $message != 'DUPLICATE') {
if (!Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'bluepay_order` SET `payment_status` = \'' . pSQL($message) . '\'
WHERE `order_id` = ' . (int) $id_order)) {
die(Tools::displayError('Error when updating BluePay database'));
}
$history = new OrderHistory();
$history->id_order = (int) $id_order;
$history->changeIdOrderState((int) Configuration::get('PS_OS_REFUND'), $history->id_order);
$history->addWithemail();
$history->save();
}
$this->addNewPrivateMessage((int) $id_order, $message);
Tools::redirect($_SERVER['HTTP_REFERER'] . '&result=' . $status . '&message=' . $message);
return $response;
}
示例6: reEvaluateOrder
public static function reEvaluateOrder()
{
$sender = new fianet_sender();
if (Configuration::get('SAC_PRODUCTION')) {
$sender->mode = 'production';
}
$result = $sender->get_reevaluated_order();
foreach ($result as $row) {
if ($row['eval'] > 0) {
if (OrderHistory::getLastOrderState($row['refid']) == Configuration::get('SAC_ID_WAITING')) {
$orderHistory = new OrderHistory();
$orderHistory->id_order = (int) $row['refid'];
$orderHistory->id_order_state = _PS_OS_PAYMENT_;
$orderHistory->save();
}
}
}
return true;
}
示例7: _doTotalRefund
private function _doTotalRefund($id_order)
{
$paypal_order = PayPalOrder::getOrderById((int) $id_order);
if (!$this->isPayPalAPIAvailable() || !$paypal_order) {
return false;
}
$order = new Order((int) $id_order);
if (!Validate::isLoadedObject($order)) {
return false;
}
$products = $order->getProducts();
$currency = new Currency((int) $order->id_currency);
if (!Validate::isLoadedObject($currency)) {
$this->_errors[] = $this->l('Not a valid currency');
}
if (count($this->_errors)) {
return false;
}
$decimals = (is_array($currency) ? (int) $currency['decimals'] : (int) $currency->decimals) * _PS_PRICE_DISPLAY_PRECISION_;
// Amount for refund
$amt = 0.0;
foreach ($products as $product) {
$amt += (double) $product['product_price_wt'] * ($product['product_quantity'] - $product['product_quantity_refunded']);
}
$amt += (double) $order->total_shipping + (double) $order->total_wrapping - (double) $order->total_discounts;
// check if total or partial
if (Tools::ps_round($order->total_paid_real, $decimals) == Tools::ps_round($amt, $decimals)) {
$response = $this->_makeRefund($paypal_order['id_transaction'], $id_order);
} else {
$response = $this->_makeRefund($paypal_order['id_transaction'], $id_order, (double) $amt);
}
$message = $this->l('Refund operation result:') . '<br>';
foreach ($response as $key => $value) {
$message .= $key . ': ' . $value . '<br>';
}
if (array_key_exists('ACK', $response) && $response['ACK'] == 'Success' && $response['REFUNDTRANSACTIONID'] != '') {
$message .= $this->l('PayPal refund successful!');
if (!Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'paypal_order` SET `payment_status` = \'Refunded\' WHERE `id_order` = ' . (int) $id_order)) {
die(Tools::displayError('Error when updating PayPal database'));
}
$history = new OrderHistory();
$history->id_order = (int) $id_order;
$history->changeIdOrderState((int) Configuration::get('PS_OS_REFUND'), $history->id_order);
$history->addWithemail();
$history->save();
} else {
$message .= $this->l('Transaction error!');
}
$this->_addNewPrivateMessage((int) $id_order, $message);
Tools::redirect($_SERVER['HTTP_REFERER']);
}
示例8: updateOrderHistory
/**
* Update order history status with kwixo status given
*
* @param int $id_order
* @param int $psosstatus
*/
public function updateOrderHistory($id_order, $psosstatus)
{
$order = new Order((int) $id_order);
$orderHistory = new OrderHistory();
$orderHistory->id_order = $id_order;
$orderHistory->id_order_state = $psosstatus;
$orderHistory->save();
$orderHistory->changeIdOrderState($psosstatus, $id_order);
$orderHistory->save();
$order->current_state = $psosstatus;
$order->update();
}
示例9: OrderHistory
if (version_compare(_PS_VERSION_, '1.5', '>') && version_compare(_PS_VERSION_, '1.5.2', '<')) {
$order->current_state = $order_history->id_order_state;
$order->update();
}
}
} else {
if ($status == Payplug::PAYMENT_STATUS_REFUND) {
$order_history = new OrderHistory();
/**
* Change order state to refund by payplug
*/
$order_history->id_order = $order_id;
/** Get the right order status following module configuration (Sandbox or not) */
$new_order_state = Payplug::getOsConfiguration('refund');
$order_history->changeIdOrderState((int) $new_order_state, $order_id);
$order_history->save();
if (version_compare(_PS_VERSION_, '1.5', '>') && version_compare(_PS_VERSION_, '1.5.2', '<')) {
$order->current_state = $order_history->id_order_state;
$order->update();
}
}
}
} else {
PayplugLock::addLock($cart->id);
if ($status == Payplug::PAYMENT_STATUS_PAID) {
$extra_vars = array();
/** Data is an object */
$extra_vars['transaction_id'] = $data->id_transaction;
$currency = (int) $cart->id_currency;
$customer = new Customer((int) $cart->id_customer);
/** Get the right order status following module configuration (Sandbox or not) */
示例10: getIPNTransactionDetails
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include_once dirname(__FILE__) . '/../../config/config.inc.php';
include_once dirname(__FILE__) . '/../../init.php';
include_once dirname(__FILE__) . '/paypal_orders.php';
function getIPNTransactionDetails()
{
$transaction_id = pSQL(Tools::getValue('txn_id'));
return array('id_invoice' => null, 'id_transaction' => $transaction_id, 'transaction_id' => $transaction_id, 'currency' => pSQL(Tools::getValue('mc_currency')), 'total_paid' => (double) Tools::getValue('mc_gross'), 'shipping' => (double) Tools::getValue('mc_shipping'), 'payment_date' => pSQL(Tools::getValue('payment_date')), 'payment_status' => pSQL(Tools::getValue('payment_status')));
}
if (Tools::getValue('payment_status') !== false) {
$details = getIPNTransactionDetails();
$id_order = PayPalOrder::getIdOrderByTransactionId($details['id_transaction']);
PayPalOrder::updateOrder($id_order, $details);
$history = new OrderHistory();
$history->id_order = (int) $id_order;
$history->changeIdOrderState((int) Configuration::get('PS_OS_PAYMENT'), $history->id_order);
$history->addWithemail();
$history->save();
}
示例11: confirmOrder
public function confirmOrder($custom)
{
$result = $this->getResult();
$payment_status = Tools::getValue('payment_status');
$mc_gross = Tools::getValue('mc_gross');
$txn_id = Tools::getValue('txn_id');
$id_order = (int) PayPalOrder::getIdOrderByTransactionId($txn_id);
if ($id_order != 0) {
Context::getContext()->cart = new Cart((int) $id_order);
} elseif (isset($custom['id_cart'])) {
Context::getContext()->cart = new Cart((int) $custom['id_cart']);
}
$address = new Address((int) Context::getContext()->cart->id_address_invoice);
Context::getContext()->country = new Country((int) $address->id_country);
Context::getContext()->customer = new Customer((int) Context::getContext()->cart->id_customer);
Context::getContext()->language = new Language((int) Context::getContext()->cart->id_lang);
Context::getContext()->currency = new Currency((int) Context::getContext()->cart->id_currency);
if (isset(Context::getContext()->cart->id_shop)) {
Context::getContext()->shop = new Shop(Context::getContext()->cart->id_shop);
}
if (strcmp(trim($result), "VERIFIED") === false) {
$details = $this->getIPNTransactionDetails($result);
if ($id_order != 0) {
$history = new OrderHistory();
$history->id_order = (int) $id_order;
PayPalOrder::updateOrder($id_order, $details);
$history->changeIdOrderState((int) Configuration::get('PS_OS_ERROR'), $history->id_order);
$history->addWithemail();
$history->save();
}
} elseif (strcmp(trim($result), "VERIFIED") === 0) {
$details = $this->getIPNTransactionDetails($result);
if (version_compare(_PS_VERSION_, '1.5', '<')) {
$shop = null;
} else {
$shop_id = Context::getContext()->shop->id;
$shop = new Shop($shop_id);
}
if ($id_order != 0) {
$order = new Order((int) $id_order);
$values = $this->checkPayment($payment_status, $mc_gross, false);
if ((int) $order->current_state == (int) $values['payment_type']) {
return;
}
$history = new OrderHistory();
$history->id_order = (int) $id_order;
PayPalOrder::updateOrder($id_order, $details);
$history->changeIdOrderState($values['payment_type'], $history->id_order);
$history->addWithemail();
$history->save();
} else {
$values = $this->checkPayment($payment_status, $mc_gross, true);
$customer = new Customer((int) Context::getContext()->cart->id_customer);
$this->validateOrder(Context::getContext()->cart->id, $values['payment_type'], $values['total_price'], $this->displayName, $values['message'], $details, Context::getContext()->cart->id_currency, false, $customer->secure_key, $shop);
}
}
}
示例12: log
/**
* @param array $data
*/
public function log(array $data)
{
$record = new OrderHistory();
$record->handler = $data['handler'];
$record->data_before = $data['data_before'];
$record->data_after = $data['data_after'];
$record->order_id = $this->owner->id;
$record->created = date('Y-m-d H:i:s');
if (!Yii::app()->user->isGuest) {
$record->user_id = Yii::app()->user->id;
$record->username = Yii::app()->user->username;
}
$record->save();
}
示例13: OrderHistory
break;
case 2:
if ($order->getCurrentState() == intval(Configuration::get('RNP_ID_ORDERSTATE'))) {
$orderHistory = new OrderHistory();
$orderHistory->id_order = intval($id_order);
$orderHistory->id_order_state = _PS_OS_CANCELED_;
$orderHistory->save();
//$orderHistory->changeIdOrderState(intval($orderHistory->id), intval($order->id));
}
break;
case 3:
$payment->validateOrder($id_cart, intval(Configuration::get('RNP_ID_ORDERSTATE')), $amount, $payment->displayName, $errors);
break;
case 11:
$orderState = _PS_OS_ERROR_;
break;
case 101:
$orderHistory = new OrderHistory();
$orderHistory->id_order = intval($id_order);
$orderHistory->id_order_state = _PS_OS_CANCELED_;
$orderHistory->save();
//$orderHistory->changeIdOrderState(intval($orderHistory->id), intval($order->id));
break;
case 100:
$orderHistory = new OrderHistory();
$orderHistory->id_order = intval($id_order);
$orderHistory->id_order_state = _PS_OS_DELIVERED_;
$orderHistory->save();
//$orderHistory->changeIdOrderState(intval($orderHistory->id), intval($order->id));
break;
}
示例14: trackingStatus
public static function trackingStatus($id_order, $shipping_number)
{
// MAIL::SEND is bugged in 1.5 !
// http://forge.prestashop.com/browse/PNM-754 (Unresolved as of 2013-04-15)
// Context fix (it's that easy)
Context::getContext()->link = new Link();
// Fix context by adding employee
$cookie = new Cookie('psAdmin');
Context::getContext()->employee = new Employee($cookie->id_employee);
$o = new Order($id_order);
$o->shipping_number = $shipping_number;
$o->save();
// New in 1.5
$id_order_carrier = Db::getInstance()->getValue('
SELECT `id_order_carrier`
FROM `' . _DB_PREFIX_ . 'order_carrier`
WHERE `id_order` = ' . (int) $id_order);
$order_carrier = new OrderCarrier($id_order_carrier);
$order_carrier->tracking_number = $shipping_number;
$order_carrier->id_order = $id_order;
$order_carrier->id_carrier = $o->id_carrier;
$order_carrier->update();
// No, there is no method in Order to retrieve the orderCarrier object(s)
$history = new OrderHistory();
$history->id_order = (int) $o->id;
$history->id_order_state = _PS_OS_SHIPPING_;
$history->changeIdOrderState(_PS_OS_SHIPPING_);
$history->save();
$customer = new Customer($o->id_customer);
$carrier = new Carrier($o->id_carrier);
$tracking_url = str_replace('@', $o->shipping_number, $carrier->url);
$templateVars = array('{tracking_link}' => '<a href = "' . $tracking_url . '">' . $o->shipping_number . '</a>', '{tracking_code}' => $o->shipping_number, '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => (int) $o->id);
Mail::Send($o->id_lang, 'tracking', 'Tracking number for your order', $templateVars, $customer->email, $customer->firstname . ' ' . $customer->lastname, null, null, null, null, _MYDIR_ . '/mails/', true);
}