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


PHP Hook::postUpdateOrderStatus方法代码示例

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


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

示例1: changeIdOrderState

 public function changeIdOrderState($new_order_state = NULL, $id_order)
 {
     if ($new_order_state != NULL) {
         Hook::updateOrderStatus((int) $new_order_state, (int) $id_order);
         $order = new Order((int) $id_order);
         /* Best sellers */
         $newOS = new OrderState((int) $new_order_state, $order->id_lang);
         $oldOrderStatus = OrderHistory::getLastOrderState((int) $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);
                 }
             }
         }
         $this->id_order_state = (int) $new_order_state;
         /* Change invoice number of 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((int) $new_order_state, (int) $id_order);
     }
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:40,代码来源:OrderHistory.php

示例2: addWithemail

    public function addWithemail($autodate = true, $templateVars = false)
    {
        if (!parent::add($autodate)) {
            return false;
        }
        $lastOrderState = $this->getLastOrderState($this->id_order);
        $result = Db::getInstance()->getRow('
			SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`
			FROM `' . _DB_PREFIX_ . 'order_history` oh
				LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON oh.`id_order` = o.`id_order`
				LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON o.`id_customer` = c.`id_customer`
				LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON oh.`id_order_state` = os.`id_order_state`
				LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`)
			WHERE oh.`id_order_history` = ' . intval($this->id) . '
				AND os.`send_email` = 1');
        if (isset($result['template']) and Validate::isEmail($result['email'])) {
            $topic = $result['osname'];
            $data = array('{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => intval($this->id_order));
            if ($templateVars) {
                $data = array_merge($data, $templateVars);
            }
            $order = new Order(intval($this->id_order));
            $data['{total_paid}'] = Tools::displayPrice(floatval($order->total_paid), new Currency(intval($order->id_currency)), false, false);
            $data['{order_name}'] = sprintf("#%06d", intval($order->id));
            // additionnal links for download virtual product
            if ($virtualProducts = $order->getVirtualProducts() and $this->id_order_state == _PS_OS_PAYMENT_) {
                global $smarty;
                $display = '';
                $assign = array();
                foreach ($virtualProducts as $key => $virtualProduct) {
                    $id_product_download = ProductDownload::getIdFromIdProduct($virtualProduct['product_id']);
                    $product_download = new ProductDownload($id_product_download);
                    $assign[$key]['name'] = $product_download->display_filename;
                    $assign[$key]['link'] = $product_download->getTextLink(false, $virtualProduct['download_hash']);
                    if ($virtualProduct['download_deadline'] != '0000-00-00 00:00:00') {
                        $assign[$key]['deadline'] = Tools::displayDate($virtualProduct['download_deadline'], $order->id_lang);
                    }
                    if ($product_download->nb_downloadable != 0) {
                        $assign[$key]['downloadable'] = $product_download->nb_downloadable;
                    }
                }
                $smarty->assign('virtualProducts', $assign);
                $iso = Language::getIsoById(intval($order->id_lang));
                $links = $smarty->fetch(_PS_MAIL_DIR_ . $iso . '/download-product.tpl');
                $tmpArray = array('{nbProducts}' => count($virtualProducts), '{virtualProducts}' => $links);
                $data = array_merge($data, $tmpArray);
                global $_LANGMAIL;
                $subject = 'Virtual product to download';
                Mail::Send(intval($order->id_lang), 'download_product', (is_array($_LANGMAIL) and key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject, $data, $result['email'], $result['firstname'] . ' ' . $result['lastname']);
            }
            if (Validate::isLoadedObject($order)) {
                Mail::Send(intval($order->id_lang), $result['template'], $topic, $data, $result['email'], $result['firstname'] . ' ' . $result['lastname']);
            }
        }
        if ($lastOrderState->id !== $this->id_order_state) {
            Hook::postUpdateOrderStatus($this->id_order_state, intval($this->id_order));
        }
        return true;
    }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:59,代码来源:OrderHistory.php


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