当前位置: 首页>>代码示例>>PHP>>正文


PHP OrderHistory::getLastOrderState方法代码示例

本文整理汇总了PHP中OrderHistory::getLastOrderState方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderHistory::getLastOrderState方法的具体用法?PHP OrderHistory::getLastOrderState怎么用?PHP OrderHistory::getLastOrderState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OrderHistory的用法示例。


在下文中一共展示了OrderHistory::getLastOrderState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processPayment

 public function processPayment($result, $orderId)
 {
     $gopay = new Gopay();
     $gpErrors = "";
     $history = new OrderHistory();
     $history->id_order = $orderId;
     if ($result["code"] == GopayHelper::WAITING) {
         $gpErrors = $result["description"];
     } else {
         if ($result["code"] == GopayHelper::PAYMENT_DONE) {
             if ($history->getLastOrderState($orderId)->id == intval(_PS_OS_GOPAY_)) {
                 $history->changeIdOrderState(intval(_PS_OS_PAYMENT_), intval($orderId));
                 $history->addWithemail();
             }
         } else {
             if ($result["code"] == GopayHelper::CANCELED || $result["code"] == GopayHelper::TIMEOUTED) {
                 if ($history->getLastOrderState($orderId)->id == intval(_PS_OS_GOPAY_)) {
                     $history->changeIdOrderState(intval(_PS_OS_CANCELED_), $orderId);
                     $history->addWithemail();
                 }
                 $gpErrors = $result["description"];
             }
         }
     }
     return $gpErrors;
 }
开发者ID:greench,项目名称:prestashop,代码行数:26,代码来源:gopay_tools.php

示例2: changeIdOrderState

 public function changeIdOrderState($new_order_state = NULL, $id_order)
 {
     if ($new_order_state != NULL) {
         Hook::updateOrderStatus(intval($new_order_state), intval($id_order));
         /* Best sellers */
         $newOS = new OrderState(intval($new_order_state));
         $oldOrderStatus = OrderHistory::getLastOrderState(intval($id_order));
         $cart = Cart::getCartByOrderId($id_order);
         $isValidated = $this->isValidated();
         if (Validate::isLoadedObject($cart)) {
             foreach ($cart->getProducts() as $product) {
                 /* If becoming logable => adding sale */
                 if ($newOS->logable and (!$oldOrderStatus or !$oldOrderStatus->logable)) {
                     ProductSale::addProductSale($product['id_product'], $product['cart_quantity']);
                 } elseif (!$newOS->logable and ($oldOrderStatus and $oldOrderStatus->logable)) {
                     ProductSale::removeProductSale($product['id_product'], $product['cart_quantity']);
                 }
                 if (!$isValidated and $newOS->logable and isset($oldOrderStatus) and $oldOrderStatus and $oldOrderStatus->id == _PS_OS_ERROR_) {
                     Product::updateQuantity($product);
                     Hook::updateQuantity($product, $order);
                 }
             }
         }
         $this->id_order_state = intval($new_order_state);
         /* Change invoice number of order ? */
         $newOS = new OrderState(intval($new_order_state));
         $order = new Order(intval($id_order));
         if (!Validate::isLoadedObject($newOS) or !Validate::isLoadedObject($order)) {
             die(Tools::displayError('Invalid new order state'));
         }
         /* The order is valid only if the invoice is available and the order is not cancelled */
         $order->valid = $newOS->logable;
         $order->update();
         if ($newOS->invoice and !$order->invoice_number) {
             $order->setInvoice();
         }
         if ($newOS->delivery and !$order->delivery_number) {
             $order->setDelivery();
         }
         Hook::postUpdateOrderStatus(intval($new_order_state), intval($id_order));
     }
 }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:42,代码来源:OrderHistory.php

示例3: changeOrderStatusSub

 public function changeOrderStatusSub($id_order)
 {
     Log::DEBUG("change:1." . $id_order);
     if ($id_order) {
         Log::DEBUG("change:2." . $id_order);
         $lastHistory = OrderHistory::getLastOrderState($id_order);
         if ($lastHistory->id == Configuration::get('PS_OS_PAYMENT')) {
             Log::DEBUG("change:2.1." . $id_order);
             return true;
         }
         $history = new OrderHistory();
         $history->id_order = (int) $id_order;
         $history->changeIdOrderState(Configuration::get('PS_OS_PAYMENT'), (int) $id_order);
         Log::DEBUG("change:3." . $id_order);
         if ($history->addWithemail()) {
             Log::DEBUG("change:4." . $id_order);
             return true;
         }
     }
     return false;
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:21,代码来源:notify.php

示例4: initContent

 /**
  * Checks a payment status of order in shop
  */
 public function initContent()
 {
     $cookie = new Cookie('lastOrder');
     if ($cookie->orderId != null) {
         $lastOrderState = OrderHistory::getLastOrderState($cookie->orderId);
         switch ($lastOrderState->id) {
             case $this->config->getDotpayNewStatusId():
                 if (Tools::getValue('lastRequest') === true) {
                     $cookie->logout();
                 }
                 die('0');
             case _PS_OS_PAYMENT_:
                 $cookie->logout();
                 die('1');
             default:
                 die('-1');
         }
     } else {
         die('NO');
     }
 }
开发者ID:dotpay,项目名称:dotpay,代码行数:24,代码来源:status.php

示例5: cron

 public function cron($jobname, $params, &$message, &$errorcount)
 {
     switch ($jobname) {
         case 'set_shipping_completed':
             $this->setOrderShippingCompleted($message, $errorcount);
             break;
         case 'cancel_orders':
             $this->log("cron executed job '" . $jobname . "'", ShopgateLogger::LOGTYPE_DEBUG);
             $cancellationStatus = ConfigurationCore::get('SG_CANCELLATION_STATUS');
             $select = sprintf('SELECT ' . (version_compare(_PS_VERSION_, '1.5.0', '>=') ? ' o.current_state,  ' : ' o.id_order, ') . ' so.id_shopgate_order from %sshopgate_order as so
                     JOIN %sorders as o on so.id_order=o.id_order 
                     WHERE so.is_cancellation_sent_to_shopgate = 0', _DB_PREFIX_, _DB_PREFIX_);
             $result = Db::getInstance()->ExecuteS($select);
             if (empty($result)) {
                 $this->log('no orders to cancel found for shop:' . $this->config->getShopNumber(), ShopgateLogger::LOGTYPE_DEBUG);
                 return;
             }
             foreach ($result as $order) {
                 $sgOrder = new ShopgateOrderPrestashop($order['id_shopgate_order']);
                 if (is_string($sgOrder->order_number)) {
                     $sgOrder->order_number = (int) $sgOrder->order_number;
                 }
                 if (version_compare(_PS_VERSION_, '1.5.0', '>=')) {
                     $state = $order['current_state'];
                 } else {
                     $stateObject = OrderHistory::getLastOrderState($order['id_order']);
                     $state = $stateObject->id;
                 }
                 if ($state == $cancellationStatus) {
                     $sgOrder->cancelOrder($message);
                 } else {
                     $sgOrder->cancelOrder($message, true);
                 }
             }
             break;
         default:
             $this->log("job '" . $jobname . "' not found", ShopgateLogger::LOGTYPE_ERROR);
             throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_CRON_UNSUPPORTED_JOB, 'Job name: "' . $jobname . '"', true);
     }
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:40,代码来源:Plugin.php

示例6: isAbandonedOrder

 private function isAbandonedOrder($reference)
 {
     if (strpos($reference, Configuration::get('PAGSEGURO_ID')) !== false) {
         $initiated = Util::getPagSeguroStatusName(0);
         $decReference = (int) EncryptionIdPagSeguro::decrypt($reference);
         $orderState = OrderHistory::getLastOrderState($decReference);
         if (strcmp($orderState->name, $initiated) != 0) {
             return false;
         }
     } else {
         return false;
     }
     return true;
 }
开发者ID:franklindias,项目名称:prestashop,代码行数:14,代码来源:PagSeguroAbandonedOrder.php

示例7: hookAdminOrder

 public function hookAdminOrder($params)
 {
     if (Tools::isSubmit('submitPayPalCapture')) {
         $this->_doCapture($params['id_order']);
     } elseif (Tools::isSubmit('submitPayPalRefund')) {
         $this->_doTotalRefund($params['id_order']);
     }
     $adminTemplates = array();
     if ($this->isPayPalAPIAvailable()) {
         if ($this->_needValidation((int) $params['id_order'])) {
             $adminTemplates[] = 'validation';
         }
         if ($this->_needCapture((int) $params['id_order'])) {
             $adminTemplates[] = 'capture';
         }
         if ($this->_canRefund((int) $params['id_order'])) {
             $adminTemplates[] = 'refund';
         }
     }
     if (count($adminTemplates) > 0) {
         $order = new Order((int) $params['id_order']);
         if (version_compare(_PS_VERSION_, '1.5', '>=')) {
             $order_state = $order->current_state;
         } else {
             $order_state = OrderHistory::getLastOrderState($order->id);
         }
         $this->context->smarty->assign(array('authorization' => (int) Configuration::get('PAYPAL_OS_AUTHORIZATION'), 'base_url' => _PS_BASE_URL_ . __PS_BASE_URI__, 'module_name' => $this->name, 'order_state' => $order_state, 'params' => $params, 'ps_version' => _PS_VERSION_));
         foreach ($adminTemplates as $adminTemplate) {
             $this->_html .= $this->fetchTemplate('/views/templates/admin/admin_order/' . $adminTemplate . '.tpl');
             $this->_postProcess();
             $this->_html .= '</fieldset>';
         }
     }
     return $this->_html;
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:35,代码来源:paypal.php

示例8: hookAdminOrder

    public function hookAdminOrder($params)
    {
        if (Tools::isSubmit('paypal')) {
            switch (Tools::getValue('paypal')) {
                case 'captureOk':
                    $message = $this->l('Funds have been recovered.');
                    break;
                case 'captureError':
                    $message = $this->l('Recovery of funds request unsuccessful. Please see log message!');
                    break;
                case 'validationOk':
                    $message = $this->l('Validation successful. Please see log message!');
                    break;
                case 'refundOk':
                    $message = $this->l('Refund has been made.');
                    break;
                case 'refundError':
                    $message = $this->l('Refund request unsuccessful. Please see log message!');
                    break;
            }
            if (isset($message) && $message) {
                $this->_html .= '
				<br />
				<div class="module_confirmation conf confirm" style="width: 400px;">
					<img src="' . _PS_IMG_ . 'admin/ok.gif" alt="" title="" /> ' . Tools::safeOutput($message) . '
				</div>';
            }
        }
        $adminTemplates = array();
        if ($this->isPayPalAPIAvailable()) {
            if ($this->_needValidation((int) $params['id_order'])) {
                $adminTemplates[] = 'validation';
            }
            if ($this->_needCapture((int) $params['id_order'])) {
                $adminTemplates[] = 'capture';
            }
            if ($this->_canRefund((int) $params['id_order'])) {
                $adminTemplates[] = 'refund';
            }
        }
        if (count($adminTemplates) > 0) {
            if (_PS_VERSION_ >= '1.5') {
                $order_state = OrderHistory::getLastOrderState((int) $params['id_order'])->id;
            } else {
                $order = new Order((int) $params['id_order']);
                $order_state = $order->current_state->id;
            }
            $this->context->smarty->assign(array('authorization' => (int) Configuration::get('PAYPAL_OS_AUTHORIZATION'), 'base_url' => _PS_BASE_URL_ . __PS_BASE_URI__, 'module_name' => $this->name, 'order_state' => $order_state, 'params' => $params));
            foreach ($adminTemplates as $adminTemplate) {
                $this->_html .= $this->fetchTemplate('/views/templates/back/admin_order/', $adminTemplate);
                $this->_postProcess();
                $this->_html .= '</fieldset>';
            }
        }
        return $this->_html;
    }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:56,代码来源:paypal_abstract.php

示例9: basename

    Result is "uploads/filename.extension" */
 $target_path = $target_path . basename($_FILES['orders']['name']);
 if (move_uploaded_file($_FILES['orders']['tmp_name'], $target_path)) {
     $f = fopen($target_path, 'r');
     if ($f) {
         $count = 0;
         while ($line = fgetcsv($f)) {
             if (!is_numeric($line[0])) {
                 continue;
             }
             $id_order = (int) $line[0];
             $order = new Order($id_order);
             $history = new OrderHistory();
             $history->id_order = $id_order;
             $history->id_employee = (int) $cookie->id_employee;
             if ($history->getLastOrderState($id_order) == _PS_OS_DELIVERED_) {
                 continue;
             }
             $history->changeIdOrderState(_PS_OS_DELIVERED_, $id_order);
             $history->addWithemail(true, false);
             $count++;
             echo $history->id_order;
             echo '<br>';
         }
         fclose($f);
         echo 'Total ' . $count . ' orders marked delivered successfully. Thanks for your attention.';
     } else {
         // error
     }
 } else {
     echo "There was an error uploading the file, please try again!";
开发者ID:priyankajsr19,项目名称:shalu,代码行数:31,代码来源:OMS_bkp_new.php

示例10: hookAdminOrder

    public function hookAdminOrder($params)
    {
        if (Tools::isSubmit('paypal')) {
            switch (Tools::getValue('paypal')) {
                case 'captureOk':
                    $message = $this->l('Funds have been recovered.');
                    break;
                case 'captureError':
                    $message = $this->l('Recovery of funds request unsuccessful. Please see log message!');
                    break;
                case 'validationOk':
                    $message = $this->l('Validation successful. Please see log message!');
                    break;
                case 'refundOk':
                    $message = $this->l('Refund has been made.');
                    break;
                case 'refundError':
                    $message = $this->l('Refund request unsuccessful. Please see log message!');
                    break;
            }
            if (isset($message) and $message) {
                $this->_html .= '
				<br />
				<div class="module_confirmation conf confirm" style="width: 400px;">
					<img src="' . _PS_IMG_ . 'admin/ok.gif" alt="" title="" /> ' . $message . '
				</div>';
            }
        }
        if ($this->_needValidation((int) $params['id_order']) and $this->_isPayPalAPIAvailable()) {
            $this->_html .= '<br />
			<fieldset style="width:400px;">
				<legend><img src="' . _MODULE_DIR_ . $this->name . '/logo.gif" alt="" /> ' . $this->l('PayPal Validation') . '</legend>
				<p><b>' . $this->l('Information:') . '</b> ' . (OrderHistory::getLastOrderState((int) $params['id_order'])->id == (int) Configuration::get('PAYPAL_OS_AUTHORIZATION') ? $this->l('Pending Capture - No shipping') : $this->l('Pending Payment - No shipping')) . '</p>
				<form method="post" action="' . htmlentities($_SERVER['REQUEST_URI']) . '">
					<input type="hidden" name="id_order" value="' . (int) $params['id_order'] . '" />
					<p class="center"><input type="submit" class="button" name="submitPayPalValidation" value="' . $this->l('Get payment status') . '" /></p>
				</form>';
            $this->_postProcess();
            $this->_html .= '</fieldset>';
        }
        if ($this->_needCapture((int) $params['id_order']) and $this->_isPayPalAPIAvailable()) {
            $this->_html .= '<br />
			<fieldset style="width:400px;">
				<legend><img src="' . _MODULE_DIR_ . $this->name . '/logo.gif" alt="" /> ' . $this->l('PayPal Capture') . '</legend>
				<p><b>' . $this->l('Information:') . '</b> ' . $this->l('Funds ready to be captured before shipping.') . '</p>
				<form method="post" action="' . htmlentities($_SERVER['REQUEST_URI']) . '">
					<input type="hidden" name="id_order" value="' . (int) $params['id_order'] . '" />
					<p class="center"><input type="submit" class="button" name="submitPayPalCapture" value="' . $this->l('Get the money.') . '" /></p>
				</form>';
            $this->_postProcess();
            $this->_html .= '</fieldset>';
        }
        if ($this->_canRefund((int) $params['id_order']) and $this->_isPayPalAPIAvailable()) {
            $this->_html .= '<br />
			<fieldset style="width:400px;">
				<legend><img src="' . _MODULE_DIR_ . $this->name . '/logo.gif" alt="" /> ' . $this->l('PayPal Refund') . '</legend>
				<p><b>' . $this->l('Information:') . '</b> ' . $this->l('Payment accepted') . '</p>
				<p><b>' . $this->l('Information:') . '</b> ' . $this->l('When you refund a product, a partial refund is made unless you select "Generate a voucher".') . '</p>
				<form method="post" action="' . htmlentities($_SERVER['REQUEST_URI']) . '">
					<input type="hidden" name="id_order" value="' . (int) $params['id_order'] . '" />
					<p class="center"><input type="submit" class="button" name="submitPayPalRefund" value="' . $this->l('Refund total transaction') . '" onclick="if (!confirm(\'' . $this->l('Are you sure?') . '\'))return false;" /></p>
				</form>';
            $this->_postProcess();
            $this->_html .= '</fieldset>';
        }
        return $this->_html;
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:67,代码来源:paypal.php

示例11: printPDFIcons

 public static function printPDFIcons($id_order, $tr)
 {
     $order = new Order($id_order);
     $orderState = OrderHistory::getLastOrderState($id_order);
     if (!Validate::isLoadedObject($orderState) or !Validate::isLoadedObject($order)) {
         die(Tools::displayError('Invalid objects!'));
     }
     echo '<span style="width:20px; margin-right:5px;">';
     if (($orderState->invoice or $order->invoice_number) and intval($tr['product_number'])) {
         echo '<a href="pdf.php?id_order=' . intval($order->id) . '&pdf"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>';
     } else {
         echo '&nbsp;';
     }
     echo '</span>';
     echo '<span style="width:20px;">';
     if ($orderState->delivery or $order->delivery_number) {
         echo '<a href="pdf.php?id_delivery=' . intval($order->delivery_number) . '"><img src="../img/admin/delivery.gif" alt="delivery" /></a>';
     } else {
         echo '&nbsp;';
     }
     echo '</span>';
 }
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:22,代码来源:Order.php

示例12: ON

FROM `' . _DB_PREFIX_ . 'mr_selected` ms
LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.`id_cart` = ms.`id_cart`) 
WHERE `exp_number` != 0');
if (empty($expeditions)) {
    exit;
}
$params = array('Enseigne' => Configuration::get('MR_ENSEIGNE_WEBSERVICE'), 'Langue' => 'FR');
require_once 'kit_mondialrelay/tools/nusoap/lib/nusoap.php';
$client_mr = new nusoap_client("http://www.mondialrelay.fr/webservice/Web_Services.asmx?WSDL", true);
$client_mr->soap_defencoding = 'UTF-8';
$client_mr->decode_utf8 = false;
foreach ($expeditions as $expedition) {
    if ($expedition['id_order'] == NULL) {
        continue;
    }
    if (OrderHistory::getLastOrderState((int) $expedition['id_order'])->id == _PS_OS_DELIVERED_) {
        continue;
    }
    $params['Expedition'] = $expedition['exp_number'];
    $params['Security'] = strtoupper(md5($params['Enseigne'] . $params['Expedition'] . 'FR' . Configuration::get('MR_KEY_WEBSERVICE')));
    $is_delivered = 0;
    $result_mr = $client_mr->call('WSI2_TracingColisDetaille', $params, 'http://www.mondialrelay.fr/webservice/', 'http://www.mondialrelay.fr/webservice/WSI2_TracingColisDetaille');
    if (isset($result_mr['WSI2_TracingColisDetailleResult']['Tracing']['ret_WSI2_sub_TracingColisDetaille'])) {
        foreach ($result_mr['WSI2_TracingColisDetailleResult']['Tracing']['ret_WSI2_sub_TracingColisDetaille'] as $result) {
            if (isset($result['Libelle']) and $result['Libelle'] == 'COLIS LIVRÉ') {
                $is_delivered = 1;
            }
        }
    }
    if ($is_delivered == 1) {
        $history = new OrderHistory();
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:31,代码来源:cron.php

示例13: getCurrentPrestaOrderState

 /**
  * @return mixed
  */
 private function getCurrentPrestaOrderState()
 {
     if (version_compare(_PS_VERSION_, '1.5', 'lt')) {
         $order_state = OrderHistory::getLastOrderState($this->order->id);
         $order_state_id = $order_state->id;
         return $order_state_id;
     } else {
         $order_state_id = $this->order->current_state;
     }
     return $order_state_id;
 }
开发者ID:bonekost,项目名称:plugin_prestashop,代码行数:14,代码来源:payu.php

示例14: ajaxCall

 public function ajaxCall()
 {
     if (Tools::getIsset('rangargs')) {
         $reference = Tools::getValue('rangargs');
         $orders = Order::getByReference($reference);
         if ($orders) {
             $isOK = true;
             foreach ($orders as $obj) {
                 $status = OrderHistory::getLastOrderState($obj->id);
                 if ($status->id != Configuration::get('PS_OS_PAYMENT')) {
                     $isOK &= false;
                     break;
                 }
             }
             if ($isOK) {
                 die(Tools::jsonEncode(array('status' => 1)));
             }
         }
     }
     sleep(1);
     die(Tools::jsonEncode(array('status' => 0, 'id_order' => $reference, 'id' => $status->id)));
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:22,代码来源:weixinpay.php

示例15: dirname

<?php

include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
require_once dirname(__FILE__) . '/paymentwall.php';
$orderStatus = OrderHistory::getLastOrderState($_GET['orderId']);
if ($orderStatus) {
    echo $orderStatus->id;
} else {
    echo 0;
}
开发者ID:paymentwall,项目名称:module-prestashop,代码行数:11,代码来源:ajax.php


注:本文中的OrderHistory::getLastOrderState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。