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


PHP CSaleOrder::GetById方法代码示例

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


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

示例1: OnSalePayOrder

 public static function OnSalePayOrder($id, $paid)
 {
     if (Loader::includeModule('conversion') && ($row = \CSaleOrder::GetById($id))) {
         if ($paid == 'Y') {
             $context = DayContext::getEntityItemInstance('sale_order', $id);
             $context->addCurrencyCounter('sale_payment_sum_add', $row['PRICE'], $row['CURRENCY']);
             if (defined('ADMIN_SECTION') && ADMIN_SECTION === true) {
                 $context->addCounter('sale_payment_add_day', 1);
             } else {
                 $context->addDayCounter('sale_payment_add_day', 1);
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:handlers.php

示例2: send

 public static function send($eventId, $arParams)
 {
     $result = false;
     if (!isset($arParams["ORDER"]) && isset($arParams["ORDER_ID"])) {
         $arParams["ORDER"] = CSaleOrder::GetById($arParams["ORDER_ID"]);
     }
     if (in_array($eventId, self::$arEvents) && isset($arParams["ORDER"]) && CModule::IncludeModule("pull")) {
         $arUsers = self::getSubscribers($eventId, $arParams);
         if (!empty($arUsers)) {
             $text = self::makeMessage($eventId, $arParams);
             $title = self::makeTitle($eventId, $arParams);
             $arMessages = array();
             foreach ($arUsers as $userId) {
                 if (!self::checkRights($userId, $eventId, array("ORDER_ID" => $arParams["ORDER"]["ID"]))) {
                     continue;
                 }
                 $arMessages[] = array("USER_ID" => $userId, "TITLE" => $title, "APP_ID" => "BitrixAdmin", "MESSAGE" => $text, "PARAMS" => "sl_" . $arParams["ORDER"]["ID"]);
             }
             $pushMe = new CPushManager();
             $result = $pushMe->SendMessage($arMessages);
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:24,代码来源:mobile_order.php

示例3: intarocrm_set_order_type

        $order['externalId'] = $externalId;
    }

    if (isset($order['externalId']) && $order['externalId']) {

        // custom orderType function
        if (function_exists('intarocrm_set_order_type')) {
            $orderType = intarocrm_set_order_type($order);
            if ($orderType) {
                $optionsOrderTypes[$order['orderType']] = $orderType;
            } else {
                $optionsOrderTypes[$order['orderType']] = $defaultOrderType;
            }
        }

        $arFields = CSaleOrder::GetById($order['externalId']);

        // incorrect order
        if ($arFields === false || empty($arFields)) {
            die();
        }

        $LID = $arFields['LID'];
        $userId = $arFields['USER_ID'];

        if(isset($order['customer']['externalId']) && !is_null($order['customer']['externalId'])) {
            $userId = $order['customer']['externalId'];
        }

        $rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
        $arUpdateProps = array();
开发者ID:Ksenobyte,项目名称:bitrix-module,代码行数:31,代码来源:history.php

示例4: execHandlerAction

 public static function execHandlerAction($orderId, $actionId)
 {
     global $DB, $USER;
     $arResult = array();
     $arOrder = CSaleOrder::GetById($orderId);
     $handlerActions = CSaleDeliveryHandler::getActionsList($arOrder["DELIVERY_ID"]);
     if (!array_key_exists($actionId, $handlerActions)) {
         $arResult = array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DHLP_HANDLER_HAS_NO_ACTION"));
     }
     $dt = new \Bitrix\Main\Type\DateTime();
     $depList = \Bitrix\Sale\Internals\OrderDeliveryReqTable::getList(array('filter' => array('=ORDER_ID' => $orderId)));
     $dep = $depList->fetch();
     if ($dep && !is_null($dep["DATE_REQUEST"])) {
         $arResult = array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DHLP_HANDLER_REQUEST_ALREADY_SENT"));
     }
     if (empty($arResult)) {
         $arUserGroups = $USER->GetUserGroupArray();
         $arOrder["ITEMS"] = array();
         $dbItemsList = CSaleBasket::GetList(array("SET_PARENT_ID" => "DESC", "TYPE" => "DESC", "NAME" => "ASC"), array("ORDER_ID" => $orderId));
         while ($arItem = $dbItemsList->GetNext()) {
             $arItem["DIMENSIONS"] = unserialize($arItem["~DIMENSIONS"]);
             unset($arItem["~DIMENSIONS"]);
             $arOrder["ITEMS"][] = $arItem;
         }
         $arResult = CSaleDeliveryHandler::executeAction($arOrder["DELIVERY_ID"], $actionId, $arOrder);
         if ($actionId == "REQUEST_SELF" && isset($arResult["TRACKING_NUMBER"])) {
             $bUserCanEditOrder = CSaleOrder::CanUserUpdateOrder($orderId, $arUserGroups);
             if ($bUserCanEditOrder) {
                 if ($dep) {
                     \Bitrix\Sale\Internals\OrderDeliveryReqTable::update($dep["ID"], array("DATE_REQUEST" => $dt));
                 } else {
                     \Bitrix\Sale\Internals\OrderDeliveryReqTable::add(array("ORDER_ID" => $orderId, "DATE_REQUEST" => $dt));
                 }
                 $fields = array();
                 if (isset($arResult["TRACKING_NUMBER"])) {
                     $fields["TRACKING_NUMBER"] = $arResult["TRACKING_NUMBER"];
                 }
                 if (isset($arResult["DELIVERY_DOC_NUM"])) {
                     $fields["DELIVERY_DOC_NUM"] = $arResult["DELIVERY_DOC_NUM"];
                     $fields["DELIVERY_DOC_DATE"] = Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", $arOrder["LID"])));
                 }
                 CSaleOrder::Update($orderId, $fields);
             }
         }
         CSaleOrderChange::AddRecord($orderId, "ORDER_DELIVERY_REQUEST_SENT", $arResult);
     }
     return $arResult;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:48,代码来源:delivery_helper.php

示例5: onSaleCancelOrder

 /**
  * 
  * @param type $ID -- orderId
  * @param type $cancel -- Y / N - cancel order status
  * @param type $reason -- cancel reason
  * @return boolean
  */
 function onSaleCancelOrder($ID, $cancel, $reason)
 {
     if (isset($GLOBALS['INTARO_CRM_FROM_HISTORY']) && $GLOBALS['INTARO_CRM_FROM_HISTORY']) {
         return;
     }
     if (!$ID || !$cancel) {
         return true;
     }
     if (!CModule::IncludeModule('iblock')) {
         //handle err
         ICrmOrderActions::eventLog('ICrmOrderEvent::onSaleCancelOrder', 'iblock', 'module not found');
         return true;
     }
     if (!CModule::IncludeModule("sale")) {
         //handle err
         ICrmOrderActions::eventLog('ICrmOrderEvent::onSaleCancelOrder', 'sale', 'module not found');
         return true;
     }
     if (!CModule::IncludeModule("catalog")) {
         //handle err
         ICrmOrderActions::eventLog('ICrmOrderEvent::onSaleCancelOrder', 'catalog', 'module not found');
         return true;
     }
     $api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0);
     $api_key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_KEY_OPTION, 0);
     //saved cat params
     $optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0));
     // --statuses
     $api = new RetailCrm\RestApi($api_host, $api_key);
     $order = array();
     if ($cancel == 'Y') {
         $order = array('externalId' => (int) $ID, 'status' => $optionsPayStatuses[$cancel . $cancel], 'statusComment' => ICrmOrderActions::toJSON($reason));
     } else {
         if ($cancel == 'N') {
             $arOrder = CSaleOrder::GetById((int) $ID);
             $order = array('externalId' => (int) $ID, 'status' => $optionsPayStatuses[$arOrder['STATUS_ID']], 'managerComment' => $arOrder['COMMENTS']);
         }
     }
     $log = new Logger();
     $log->write($order, 'order');
     try {
         $api->orderEdit($order);
     } catch (\RetailCrm\Exception\CurlException $e) {
         ICrmOrderActions::eventLog('ICrmOrderEvent::onSaleCancelOrder', 'RetailCrm\\RestApi::orderEdit::CurlException', $e->getCode() . ': ' . $e->getMessage());
     }
     return true;
 }
开发者ID:Ksenobyte,项目名称:bitrix-module,代码行数:54,代码来源:ICrmOrderEvent.php

示例6: onSalePayOrder

 public static function onSalePayOrder($id, $paid)
 {
     if (Loader::includeModule('conversion') && ($row = \CSaleOrder::GetById($id))) {
         $context = DayContext::getEntityItemInstance('sale_order', $id);
         if ($paid == 'Y') {
             if (defined('ADMIN_SECTION') && ADMIN_SECTION === true) {
                 $context->addCounter('sale_payment_add_day', 1);
             } else {
                 $context->addDayCounter('sale_payment_add_day', 1);
             }
             $context->addCounter('sale_payment_add', 1);
             $context->addCurrencyCounter('sale_payment_sum_add', $row['PRICE'], $row['CURRENCY']);
         }
         /*
         elseif ($paid == 'N')
         {
         	if (defined('ADMIN_SECTION') && ADMIN_SECTION === true)
         	{
         		// TODO what if payment added by user and removed by admin -- conversion is going down!!!
         		$context->addCounter    ('sale_payment_rem_day', 1);
         	}
         	else
         	{
         		$context->addDayCounter ('sale_payment_rem_day', 1);
         	}
         
         	$context->addCounter        ('sale_payment_rem'    , 1);
         	$context->addCurrencyCounter('sale_payment_sum_rem', $row['PRICE'], $row['CURRENCY']);
         }
         */
     }
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:32,代码来源:conversionhandlers.php

示例7: OnOrderNewSendEmailHandler

    function OnOrderNewSendEmailHandler($orderID, &$eventName, &$arFields)
    {
        // Поменять вид списка товаров
        if (!CModule::IncludeModule('sale') || !CModule::IncludeModule('catalog')) return;
        //global $pre_defined_variables, $DB;

        $arOrder = CSaleOrder::GetById($orderID);

        $dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC"), array("ORDER_ID" => $orderID), false, false, array("ID", "NAME", "QUANTITY", "PRICE", "CURRENCY", "DETAIL_PAGE_URL"));
        $strOrderList = "";
        $strOrderList .= '<table width="100%">';
        $strOrderList .= '<thead><tr>';
        foreach(array("Название","Количество","Цена","Сумма") as $th) $strOrderList .= '<th>'.$th.'</th>';
        $strOrderList .= '</tr></thead>';

        $strOrderList .= '<tbody>';

        $price_total = 0;
        $arBasketItems = array();
        while ($arBasketItem = $dbBasketItems->Fetch())
        {
            $dbProp = CSaleBasket::GetPropsList(Array("SORT" => "ASC", "NAME" => "ASC"), Array("BASKET_ID" => $arBasketItem["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
            while($arProp = $dbProp -> GetNext())
                $arBasketItem["PROPS"][] = $arProp;
            $arBasketItems[] = $arBasketItem;

            $strOrderList .= '<tr>';
            $strOrderList .= '<td>';
            $strOrderList .= '<a href="http://www.zakrepi.ru'.$arBasketItem["DETAIL_PAGE_URL"].'" target="_blank">'.$arBasketItem["NAME"].'</a>';
            // Из свойств товара заказа показать лишь стандартные и название филиала
            foreach($arBasketItem['PROPS'] as &$arProp)
            {
                $strOrderList .= '<div style="font-size:80%">'.$arProp['NAME'].': '.$arProp['VALUE'].'</div>';
            }
            $strOrderList .= '</td>';
            $strOrderList .= '<td style="text-align: center;">'.$arBasketItem["QUANTITY"].'&nbsp;шт.</td>';
            $strOrderList .= '<td style="text-align: center;">'.SaleFormatCurrency($arBasketItem["PRICE"], $arBasketItem["CURRENCY"]).'</td>';
            $strOrderList .= '<td style="text-align: center;">'.SaleFormatCurrency($arBasketItem["PRICE"] * $arBasketItem["QUANTITY"], $arBasketItem["CURRENCY"]).'</td>';
            $strOrderList .= '</tr>';
            $price_total += $arBasketItem["PRICE"] * $arBasketItem["QUANTITY"];
            $price_currency = $arBasketItem["CURRENCY"];
        }
        $price_total_formatted = $price_currency? SaleFormatCurrency($price_total, $price_currency): '0';
        $strOrderList .= '<tr><td colspan="3" style="text-align:right;">Общая стоимость:&nbsp;</td><td style="text-align: center;">'.$price_total_formatted.'</td></tr>';


        //Получаем стоимость доставки цену и общую сумму вместе с ценой доставки

        // Указываем способ доставки
        // $arOrder['PRICE'] - Общая стоимость
        $arFields['DELIVERY'] = '';
        if (strlen($arOrder['DELIVERY_ID']))
        {

            if (is_string($arOrder['DELIVERY_ID']))
            {

                $sid = explode(":", $arOrder['DELIVERY_ID']);
                $dbDeliv = CSaleDeliveryHandler::GetBySID($sid[0]);
                $arDeliv = $dbDeliv->GetNext();
                $arFields['DELIVERY'] = '<p><b>Способ доставки:</b> '.$arDeliv['NAME'].'</p>';
                $price_total += $arOrder['PRICE_DELIVERY'];

                $strOrderList .= '<tr><td colspan="3" style="text-align:right;">Стоимость доставки:&nbsp;</td><td style="text-align: center;">'.SaleFormatCurrency($arOrder['PRICE_DELIVERY'], $price_currency).'</td></tr>';

                $strOrderList .= '<tr><td colspan="3" style="text-align:right;">Итого:&nbsp;</td><td style="text-align: center;">'.SaleFormatCurrency($price_total, $price_currency).'</td></tr>';

                $arFields['ALL_PRICE'] = '<p><b>Итого: </b>'.SaleFormatCurrency($price_total, $price_currency).'</p>';
            }
            else{
                $arDelivery = CSaleDelivery::GetById($arOrder['DELIVERY_ID']);
                if ($arDelivery)
                {
                    $value = $arDelivery['NAME'];
                    $value_name = $arDelivery['NAME'];
                    $value_price = '';
                    if ($arDelivery['PRICE']<=0)
                    {
                        $value .= ', Бесплатно';
                        $value_price = 'Бесплатно';
                    }
                    else
                    {
                        $value .= ', '.SaleFormatCurrency($arDelivery['PRICE'], $arDelivery['CURRENCY']);

                        $value_price = SaleFormatCurrency($arDelivery['PRICE'], $arDelivery['CURRENCY']);

                        $strOrderList .= '<tr><td colspan="3" style="text-align:right;">Стоимость доставки:&nbsp;</td><td style="text-align: center;">'.$value_price.'</td></tr>';
                    }
                    $arFields['DELIVERY'] = '<p><b>Способ доставки:</b> '.$value_name.'</p>';
                    $price_total += $arDelivery['PRICE'];

                    $strOrderList .= '<tr><td colspan="3" style="text-align:right;">Итого:&nbsp;</td><td style="text-align: center;">'.SaleFormatCurrency($price_total, $price_currency).'</td></tr>';

                    $arFields['ALL_PRICE'] = '<p><b>Итого: </b>'.SaleFormatCurrency($price_total, $price_currency).'</p>';
                }
            }
        }


//.........这里部分代码省略.........
开发者ID:CheBurashka334,项目名称:zakrepi,代码行数:101,代码来源:function_bitrix.php

示例8: orderHistory


//.........这里部分代码省略.........
                     } catch (\RetailCrm\Exception\CurlException $e) {
                         self::eventLog('ICrmOrderActions::orderHistory', 'RetailCrm\\RestApi::customerFixExternalIds::CurlException', $e->getCode() . ': ' . $e->getMessage());
                         continue;
                     }
                 }
                 $order['customer']['externalId'] = $registeredUserID;
             }
             // new order
             $newOrderFields = array('LID' => CSite::GetDefSite(), 'PERSON_TYPE_ID' => isset($optionsOrderTypes[$order['orderType']]) ? $optionsOrderTypes[$order['orderType']] : $defaultOrderType, 'PAYED' => 'N', 'CANCELED' => 'N', 'STATUS_ID' => 'N', 'PRICE' => 0, 'CURRENCY' => CCurrency::GetBaseCurrency(), 'USER_ID' => $order['customer']['externalId'], 'PAY_SYSTEM_ID' => 0, 'PRICE_DELIVERY' => 0, 'DELIVERY_ID' => 0, 'DISCOUNT_VALUE' => 0, 'USER_DESCRIPTION' => '');
             if (count($optionsSitesList) > 1 && ($lid = array_search($order['site'], $optionsSitesList))) {
                 $newOrderFields['LID'] = $lid;
             }
             $externalId = CSaleOrder::Add($newOrderFields);
             if (!isset($order['externalId'])) {
                 try {
                     $api->orderFixExternalIds(array(array('id' => $order['id'], 'externalId' => $externalId)));
                 } catch (\RetailCrm\Exception\CurlException $e) {
                     self::eventLog('ICrmOrderActions::orderHistory', 'RetailCrm\\RestApi::orderFixExternalIds::CurlException', $e->getCode() . ': ' . $e->getMessage());
                     continue;
                 }
             }
             $order['externalId'] = $externalId;
         }
         if (isset($order['externalId']) && $order['externalId']) {
             // custom orderType function
             if (function_exists('intarocrm_set_order_type')) {
                 $orderType = intarocrm_set_order_type($order);
                 if ($orderType) {
                     $optionsOrderTypes[$order['orderType']] = $orderType;
                 } else {
                     $optionsOrderTypes[$order['orderType']] = $defaultOrderType;
                 }
             }
             $arFields = CSaleOrder::GetById($order['externalId']);
             // incorrect order
             if ($arFields === false || empty($arFields)) {
                 continue;
             }
             $LID = $arFields['LID'];
             $userId = $arFields['USER_ID'];
             if (isset($order['customer']['externalId']) && !is_null($order['customer']['externalId'])) {
                 $userId = $order['customer']['externalId'];
             }
             $rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
             $arUpdateProps = array();
             while ($ar = $rsOrderProps->Fetch()) {
                 $prop = CSaleOrderProps::GetByID($ar['ORDER_PROPS_ID']);
                 $arUpdateProps[$ar['CODE']] = array('ID' => $ar['ID'], 'TYPE' => $prop['TYPE'], 'VALUE' => $ar['VALUE']);
             }
             $order['fio'] = trim(implode(' ', array(isset($order['lastName']) ? $order['lastName'] : '', isset($order['firstName']) ? $order['firstName'] : '', isset($order['patronymic']) ? $order['patronymic'] : '')));
             if (isset($order['delivery']['address']['city'])) {
                 $order['location'] = $order['delivery']['address']['city'];
             }
             if (isset($order['orderType']) && isset($optionsOrderTypes[$order['orderType']])) {
                 if (isset($optionsOrderProps[$arFields['PERSON_TYPE_ID']])) {
                     foreach ($optionsOrderProps[$arFields['PERSON_TYPE_ID']] as $code => $value) {
                         if (in_array($code, array_keys($order)) === false && isset($optionsOrderProps[$optionsOrderTypes[$order['orderType']]][$code])) {
                             $order[$code] = $arUpdateProps[$optionsOrderProps[$arFields['PERSON_TYPE_ID']][$code]]['VALUE'];
                         }
                     }
                 }
                 //update ordertype
                 CSaleOrder::Update($order['externalId'], array('PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']]));
                 $arProp = CSaleOrderProps::GetList(array(), array('PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']]));
                 $typeParam = array();
                 while ($ar = $arProp->Fetch()) {
开发者ID:Ksenobyte,项目名称:bitrix-module,代码行数:67,代码来源:ICrmOrderActions.php


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