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


PHP Rest::updateOrderStatus方法代码示例

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


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

示例1: hookadminOrder

 public function hookadminOrder($params)
 {
     if (!$this->active) {
         return false;
     }
     $order = new Order($params['id_order']);
     if ($order->module != $this->name) {
         return false;
     }
     $cart = new Cart((int) $order->id_cart);
     $interpay_order = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'gointerpay_order_id` WHERE `id_cart` = ' . (int) $order->id_cart);
     include_once _PS_MODULE_DIR_ . 'gointerpay/Rest.php';
     $rest = new Rest(Configuration::get('GOINTERPAY_STORE'), Configuration::get('GOINTERPAY_SECRET'));
     $result = $rest->orderDetail(Tools::safeOutput($interpay_order['orderId']));
     if ($order->getCurrentState() == Configuration::get('PS_OS_CANCELED') && $interpay_order['status'] != 'Cancel') {
         $result = $rest->updateOrderStatus($interpay_order['orderId'], 'VENDOR_CANCELLATION_REQUEST');
         Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'gointerpay_order_id` SET `status` = \'Cancel\' WHERE `id_cart` = ' . (int) $order->id_cart);
         $interpay_order['status'] = 'Cancel';
         $this->context->smarty->assign('interpay_validate', $this->l('Request sent to IGlobal to cancel the order'));
     } else {
         if ($order->getCurrentState() == Configuration::get('PS_OS_PAYMENT') && $interpay_order['status'] != 'Accepted') {
             $result = $rest->updateOrderStatus($interpay_order['orderId'], 'VENDOR_PREPARING_ORDER');
             Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'gointerpay_order_id` SET `status` = \'Accepted\' WHERE `id_cart` = ' . (int) $order->id_cart);
             $interpay_order['status'] = 'Accepted';
             $this->context->smarty->assign('interpay_validate', $this->l('Order accepted in Gointerpay'));
         } else {
             if ($order->getCurrentState() == Configuration::get('PS_OS_SHIPPING') && $interpay_order['status'] != 'Shipped') {
                 $result = $rest->updateOrderStatus($interpay_order['orderId'], '400', true);
                 Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'gointerpay_order_id` SET `status` = \'Shipped\' WHERE `id_cart` = ' . (int) $order->id_cart);
                 $interpay_order['status'] = 'Shipped';
                 $this->context->smarty->assign('interpay_validate', $this->l('Order updated in Gointerpay'));
             }
         }
     }
     $message = array();
     if ($interpay_order['status'] == 'Pending') {
         $message[] = $this->l('You can accept this order by updating the status to "Payment accepted" or cancel it by updating the status to "Canceled".');
         $interpay_status[] = (int) Configuration::get('PS_OS_PAYMENT');
         $interpay_status[] = (int) Configuration::get('PS_OS_CANCELED');
     } elseif ($interpay_order['status'] == 'Accepted') {
         $message[] = $this->l('Once this order has been shipped, please update the order status to "Shipped".');
         $message[] = $this->l('You can also cancel the order by updating the status to "Canceled".');
         $interpay_status[] = (int) Configuration::get('PS_OS_SHIPPING');
         $interpay_status[] = (int) Configuration::get('PS_OS_CANCELED');
     } elseif ($interpay_order['status'] == 'Cancel') {
         $message[] = $this->l('This order has been marked as cancelled.');
     } elseif ($interpay_order['status'] == 'Shipped') {
         $message[] = $this->l('This order has been marked as shipped.');
     }
     $interpay_status[] = Configuration::get('PS_OS_REFUND');
     $this->context->smarty->assign(array('interpay_message' => $message, 'interpay_order' => $interpay_order, 'interpay_link' => $rest->getOrderStatusLink(Tools::safeOutput($interpay_order['orderId'])), 'interpay_status' => Tools::jsonEncode(array('available' => $interpay_status))));
     return $this->display(__FILE__, 'tpl/order.tpl');
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:53,代码来源:gointerpay.php


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