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


PHP Sale\Order类代码示例

本文整理汇总了PHP中Bitrix\Sale\Order的典型用法代码示例。如果您正苦于以下问题:PHP Order类的具体用法?PHP Order怎么用?PHP Order使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: resetEvents

 /**
  * @param Order $order
  */
 public static function resetEvents(Order $order = null)
 {
     if ($order !== null) {
         unset(static::$events[$order->getInternalId()]);
     } else {
         static::$events = array();
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:eventspool.php

示例2: deleteProducts

 /**
  * @param \Bitrix\Sale\Order $order
  */
 protected function deleteProducts($order)
 {
     $basket = $order->getBasket();
     $shopInfoblockId = \TAO::getInfoblock('shop')->id();
     /** @var \Bitrix\Sale\BasketItem $item */
     foreach ($basket->getBasketItems() as $item) {
         $productId = $item->getProductId();
         $data = \CIBlockElement::GetByID($productId)->Fetch();
         if ($data && ($data['IBLOCK_ID'] = $shopInfoblockId)) {
             \CIBlockElement::Delete($productId);
         }
     }
 }
开发者ID:techart,项目名称:bitrix.tao,代码行数:16,代码来源:Bundle.php

示例3: prepareData

 public static function prepareData(Order $order)
 {
     $currencyBudget = 0;
     if ($order->getUserId() > 0) {
         $res = \CSaleUserAccount::getList(array(), array('USER_ID' => $order->getUserId(), 'CURRENCY' => $order->getCurrency(), 'LOCKED' => 'N'), false, false, array('CURRENT_BUDGET'));
         $userAccount = $res->Fetch();
         $currencyBudget = $userAccount['CURRENT_BUDGET'];
     }
     $payable = $order->getPrice() - $order->getSumPaid();
     $price = $order->getPrice();
     $sumPaid = $order->getSumPaid();
     $data = array('PRICE' => $price ? $price : 0, 'SUM_PAID' => $sumPaid ? $sumPaid : 0, 'PAYABLE' => $payable >= 0 ? $payable : 0, 'CURRENCY' => $order->getCurrency(), 'BUYER_BUDGET' => $currencyBudget, 'STATUS_ID' => $order->getField('STATUS_ID'));
     return $data;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:14,代码来源:orderfinanceinfo.php

示例4: getView

    public static function getView(Order $order, OrderBasket $orderBasket, $selectPayment = null, $selectId = null)
    {
        // prepare data
        $orderId = $order->getId();
        $data = $orderBasket->prepareData();
        $items = $data['ITEMS'];
        $documents = array();
        $itemNo = 0;
        /** @var \Bitrix\Sale\Payment $payment */
        foreach ($order->getPaymentCollection() as $payment) {
            $documents[] = $payment;
        }
        /** @var \Bitrix\Sale\Shipment $shipment */
        foreach ($order->getShipmentCollection() as $shipment) {
            if (!$shipment->isSystem()) {
                if (!$shipment->isCanceled() && $shipment->isShipped()) {
                    /** @var \Bitrix\Sale\ShipmentItem $shipmentItem */
                    foreach ($shipment->getShipmentItemCollection() as $shipmentItem) {
                        $basketItem = $shipmentItem->getBasketItem();
                        if (isset($items[$basketItem->getBasketCode()])) {
                            $item =& $items[$basketItem->getBasketCode()];
                            if ($shippedQuantity =& $item['SHIPPED_QUANTITY']) {
                                $shippedQuantity += (double) $shipmentItem->getField('QUANTITY');
                            } else {
                                $shippedQuantity = (double) $shipmentItem->getField('QUANTITY');
                            }
                        }
                    }
                }
                $documents[] = $shipment;
            }
        }
        unset($item, $shippedQuantity);
        usort($documents, array(__CLASS__, 'sortDocumentsByDate'));
        // render view
        ob_start();
        ?>
		<div class="adm-s-order-table-ddi">
			<table class="adm-s-order-table-ddi-table adm-s-bus-ordertable-option" style="width: 100%;">
				<thead>
				<tr>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_NUMBER');
        ?>
</td>
					<td><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_NAME');
        ?>
</td>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_PROPERTIES');
        ?>
</td>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_PLANNED');
        ?>
</td>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_SHIPPED');
        ?>
</td>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_TO_SHIP');
        ?>
</td>
				</tr>
				</thead>
				<tbody>
					<?php 
        foreach ($items as $item) {
            $properties = '<table style="margin: auto; width: 50%;">';
            if (is_array($item['SKU_PROPS'])) {
                foreach ($item['SKU_PROPS'] as $skuProp) {
                    $properties .= '<tr>';
                    $properties .= '<td style="text-align: left;">' . htmlspecialcharsbx($skuProp['NAME']) . ' : ' . '</td>';
                    if (isset($skuProp['VALUE']['PICT']) && $skuProp['VALUE']['PICT']) {
                        $properties .= '<td><span class="color"><img src="' . $skuProp['VALUE']['PICT'] . '" alt=""></span></td>';
                    } else {
                        $properties .= '<td><span>' . htmlspecialcharsbx($skuProp['VALUE']['NAME']) . '</span></td>';
                    }
                    $properties .= '</tr>';
                }
            }
            $properties .= '</table>';
            if (!($quantity = (double) $item['QUANTITY'])) {
                $quantity = 0;
            }
            if (!($shippedQuantity = $item['SHIPPED_QUANTITY'])) {
                $shippedQuantity = 0;
            }
            ?>
						<tr class="bdb-line">
							<td class="tac"><?php 
            echo ++$itemNo;
            ?>
</td>
							<td style="text-align: left;"><a class="fwb" href="<?php 
            echo $item['EDIT_PAGE_URL'];
            ?>
"><?php 
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:orderanalysis.php

示例5: updateData

 /**
  * @param Order $order
  * @param $payments
  * @param bool $canSetPaid
  * @return Result
  * @throws Main\ArgumentOutOfRangeException
  * @throws Main\ObjectNotFoundException
  * @throws UserMessageException
  */
 public static function updateData(Order &$order, $payments, $canSetPaid = false)
 {
     global $USER;
     $result = new Result();
     $data['PAYMENT'] = array();
     if (!$order) {
         throw new UserMessageException('Order does not exist');
     }
     foreach ($payments as $payment) {
         $paymentId = intval($payment['PAYMENT_ID']);
         $isNew = $paymentId <= 0;
         $paymentCollection = $order->getPaymentCollection();
         /** @var \Bitrix\Sale\Payment $paymentItem */
         if ($isNew) {
             $paymentItem = $paymentCollection->createItem();
         } else {
             $paymentItem = $paymentCollection->getItemById($paymentId);
             if (!$paymentItem) {
                 throw new UserMessageException('Payment does not exist');
             }
         }
         self::$defaultFields = $paymentItem->getFieldValues();
         $isReturn = isset($payment['IS_RETURN']) && $payment['IS_RETURN'] == 'Y';
         /** @var \Bitrix\Sale\PaySystemService $paymentService */
         $paymentService = PaySystemService::load($payment['PAY_SYSTEM_ID']);
         if (!$paymentService) {
             $result->addError(new EntityError(Loc::getMessage('SALE_ORDER_PAYMENT_ERROR_PAYSYSTEM')));
         }
         $paymentFields = array('PAY_SYSTEM_ID' => $payment['PAY_SYSTEM_ID'], 'COMPANY_ID' => isset($payment['COMPANY_ID']) ? $payment['COMPANY_ID'] : 0, 'SUM' => $payment['SUM'], 'PAY_VOUCHER_NUM' => $payment['PAY_VOUCHER_NUM'], 'PAY_RETURN_NUM' => $payment['PAY_RETURN_NUM'], 'PAY_RETURN_COMMENT' => $payment['PAY_RETURN_COMMENT'], 'COMMENTS' => $payment['COMMENTS'], 'PAY_SYSTEM_NAME' => $paymentService ? $paymentService->getName() : '');
         if ($isNew) {
             $paymentFields['DATE_BILL'] = new DateTime();
         }
         if (!empty($payment['PAY_RETURN_DATE'])) {
             try {
                 $paymentFields['PAY_RETURN_DATE'] = new Date($payment['PAY_RETURN_DATE']);
             } catch (Main\ObjectException $exception) {
                 $result->addError(new EntityError(Loc::getMessage('SALE_ORDER_PAYMENT_ERROR_RETURN_DATE_FORMAT')));
             }
         }
         if (!empty($payment['PAY_VOUCHER_DATE'])) {
             try {
                 $paymentFields['PAY_VOUCHER_DATE'] = new Date($payment['PAY_VOUCHER_DATE']);
             } catch (Main\ObjectException $exception) {
                 $result->addError(new EntityError(Loc::getMessage('SALE_ORDER_PAYMENT_ERROR_VOUCHER_DATE_FORMAT')));
             }
         }
         if (isset($payment['RESPONSIBLE_ID'])) {
             $paymentFields['RESPONSIBLE_ID'] = !empty($payment['RESPONSIBLE_ID']) ? $payment['RESPONSIBLE_ID'] : $USER->GetID();
             if ($payment['RESPONSIBLE_ID'] != $paymentItem->getField('RESPONSIBLE_ID')) {
                 $paymentFields['DATE_RESPONSIBLE_ID'] = new DateTime();
                 if (!$isNew) {
                     $paymentFields['EMP_RESPONSIBLE_ID'] = $USER->GetID();
                 }
             }
         }
         if ($result->isSuccess()) {
             if ($paymentItem->getField('PAID') != $payment['PAID'] && $paymentItem->getField('IS_RETURN') == 'Y') {
                 $setResult = $paymentItem->setReturn('N');
                 if (!$setResult->isSuccess()) {
                     $result->addErrors($setResult->getErrors());
                 }
             }
             if ($isReturn && $payment['OPERATION_ID'] == 'RETURN') {
                 $setResult = $paymentItem->setReturn('Y');
                 if (!$setResult->isSuccess()) {
                     $result->addErrors($setResult->getErrors());
                 }
             }
             $setResult = $paymentItem->setFields($paymentFields);
             if (!$setResult->isSuccess()) {
                 $result->addErrors($setResult->getErrors());
             }
             if (!$canSetPaid) {
                 $setResult = $paymentItem->setPaid($payment['PAID']);
                 if (!$setResult->isSuccess()) {
                     $result->addErrors($setResult->getErrors());
                 }
             }
             if ($payment['ORDER_STATUS_ID']) {
                 $order->setField('STATUS_ID', $payment['ORDER_STATUS_ID']);
             }
         }
         $data['PAYMENT'][] = $paymentItem;
     }
     $result->setData($data);
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:96,代码来源:orderpayment.php

示例6: GetMessage

                ?>
');
							</script>
							<?php 
                echo GetMessage("SOA_TEMPL_PAY_LINK", array("#LINK#" => $arParams["PATH_TO_PAYMENT"] . "?ORDER_ID=" . $arResult["ORDER_BASKET"]["ORDER_ID"]));
                ?>
							<?php 
            } else {
                $service = \Bitrix\Sale\PaySystem\Manager::getObjectById($arResult['PAY_SYSTEM_ID']);
                if ($service) {
                    $orderId = $arResult['ORDER_ID'];
                    /** @var \Bitrix\Sale\Order $order */
                    $order = \Bitrix\Sale\Order::load($orderId);
                    if ($order === null) {
                        $data = \Bitrix\Sale\Internals\OrderTable::getRow(array('select' => array('ID'), 'filter' => array('ACCOUNT_NUMBER' => $orderId)));
                        $order = \Bitrix\Sale\Order::load($data['ID']);
                    }
                    /** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
                    $paymentCollection = $order->getPaymentCollection();
                    /** @var \Bitrix\Sale\Payment $payment */
                    foreach ($paymentCollection as $payment) {
                        if (!$payment->isInner()) {
                            $context = \Bitrix\Main\Application::getInstance()->getContext();
                            $service->initiatePay($payment, $context->getRequest());
                            break;
                        }
                    }
                } else {
                    echo '<span style="color:red;">' . GetMessage("SOA_TEMPL_ORDER_PS_ERROR") . '</span>';
                }
            }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:basket_confirm.php

示例7: unlock

 /**
  * Unlock order.
  *
  * @param int $id			Order id.
  * @return Entity\UpdateResult|Result
  * @throws Main\ArgumentNullException
  * @throws \Exception
  */
 public static function unlock($id)
 {
     global $USER;
     $result = new Result();
     $id = (int) $id;
     if ($id <= 0) {
         $result->addError(new ResultError(Loc::getMessage('SALE_ORDER_WRONG_ID'), 'SALE_ORDER_WRONG_ID'));
         return $result;
     }
     if (!($order = Order::load($id))) {
         $result->addError(new ResultError(Loc::getMessage('SALE_ORDER_ENTITY_NOT_FOUND'), 'SALE_ORDER_ENTITY_NOT_FOUND'));
         return $result;
     }
     $userRights = \CMain::getUserRight("sale", $USER->getUserGroupArray(), "Y", "Y");
     if ($userRights >= "W" || $order->getField("LOCKED_BY") == $USER->getID()) {
         return Internals\OrderTable::update($id, array('DATE_LOCK' => null, 'LOCKED_BY' => null));
     }
     return $result;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:27,代码来源:order.php

示例8: processOrder

 public function processOrder($orderEbay)
 {
     Ebay::log(Logger::LOG_LEVEL_DEBUG, "EBAY_DATA_PROCESSOR_ORDER_PROCESSING", $orderEbay["ExtendedOrderID"], print_r($orderEbay, true), $this->siteId);
     /*
      * only in this case order is completely ready for shipping
      */
     if ($orderEbay["OrderStatus"] != "Completed" || !isset($orderEbay["CheckoutStatus"]["eBayPaymentStatus"]) || $orderEbay["CheckoutStatus"]["eBayPaymentStatus"] != "NoPaymentFailure") {
         Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_ORDER_SKIPPED", $orderEbay["ExtendedOrderID"], Loc::getMessage("SALE_TP_EBAY_FDPO_ORDER_SKIPPED", array("#ORDER_ID#" => $orderEbay["ExtendedOrderID"])), $this->siteId);
         return array();
     }
     $ebay = \Bitrix\Sale\TradingPlatform\Ebay\Ebay::getInstance();
     $settings = $ebay->getSettings();
     if (!isset($settings[$this->siteId]["ORDER_PROPS"]) || !is_array($settings[$this->siteId]["ORDER_PROPS"])) {
         throw new SystemException("Can't get order props map");
     }
     $propsMap = $settings[$this->siteId]["ORDER_PROPS"];
     /*
     if(strtolower(SITE_CHARSET) != 'utf-8')
     	$orderEbay = \Bitrix\Main\Text\Encoding::convertEncodingArray($orderEbay, 'UTF-8', SITE_CHARSET);
     */
     $dbRes = OrderTable::getList(array("filter" => array("TRADING_PLATFORM_ID" => $ebay->getId(), "EXTERNAL_ORDER_ID" => $orderEbay["ExtendedOrderID"])));
     if ($orderCorrespondence = $dbRes->fetch()) {
         Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_ORDER_ALREADY_EXIST", $orderEbay["ExtendedOrderID"], Loc::getMessage("SALE_TP_EBAY_FDPO_ORDER_SKIPPED_EXIST", array("#ORDER_ID#" => $orderEbay["ExtendedOrderID"])), $this->siteId);
         return array();
     }
     /** @var \Bitrix\Sale\Order $order */
     $order = \Bitrix\Sale\Order::create($this->siteId);
     $order->setPersonTypeId($settings[$this->siteId]["PERSON_TYPE"]);
     $propsCollection = $order->getPropertyCollection();
     /** @var \Bitrix\Sale\PropertyValueCollection $propCollection */
     if (intval($propsMap["FIO"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["FIO"]);
         $prop->setValue($orderEbay["ShippingAddress"]["Name"]);
     }
     if (intval($propsMap["CITY"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["CITY"]);
         $prop->setValue($orderEbay["ShippingAddress"]["CityName"]);
     }
     if (intval($propsMap["PHONE"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["PHONE"]);
         $prop->setValue($orderEbay["ShippingAddress"]["Phone"]);
     }
     if (intval($propsMap["ZIP"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["ZIP"]);
         $prop->setValue($orderEbay["ShippingAddress"]["PostalCode"]);
     }
     if (intval($propsMap["ADDRESS"]) > 0) {
         $prop = $propsCollection->getItemByOrderPropertyId($propsMap["ADDRESS"]);
         $prop->setValue($orderEbay["ShippingAddress"]["CountryName"] . " " . $orderEbay["ShippingAddress"]["CityName"] . " " . $orderEbay["ShippingAddress"]["Street1"] . " " . (!empty($orderEbay["ShippingAddress"]["Street2"]) ? $orderEbay["ShippingAddress"]["Street2"] . " " : ""));
     }
     $basket = null;
     $bitrixOrderId = 0;
     $userId = 0;
     $orderLineItemsIds = array();
     $transactionsArray = $this->normalizeTransactionsArray($orderEbay["TransactionArray"]);
     foreach ($transactionsArray as $transaction) {
         //if we have more than one transaction let's create user from the first
         if ($userId <= 0) {
             if (intval($propsMap["EMAIL"]) > 0 && !empty($transaction["Buyer"]["Email"])) {
                 $prop = $propsCollection->getItemByOrderPropertyId($propsMap["EMAIL"]);
                 $prop->setValue($transaction["Buyer"]["Email"]);
                 $userId = $this->createUser($transaction["Buyer"]["Email"], array("NAME" => $transaction["Buyer"]["UserFirstName"], "LAST_NAME" => $transaction["Buyer"]["UserLastName"]));
             }
             if ($userId <= 0) {
                 $userId = \CSaleUser::GetAnonymousUserID();
             }
         }
         if (intval($userId > 0)) {
             $order->setFieldNoDemand("USER_ID", $userId);
         }
         $fUserId = null;
         if ($order->getUserId() > 0) {
             $fUserId = Fuser::getIdByUserId($order->getUserId());
         }
         /** @var \Bitrix\Sale\Basket $basket */
         if (!$basket) {
             $basket = \Bitrix\Sale\Basket::create($this->siteId);
             $basket->setFUserId($fUserId);
         }
         $items = array();
         $isVariation = false;
         if (!empty($transaction["Item"])) {
             $items = Xml2Array::normalize($transaction["Item"]);
         } elseif (!empty($transaction["Variation"])) {
             $items = Xml2Array::normalize($transaction["Variation"]);
             $isVariation = true;
         }
         if (empty($items)) {
             Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_ORDER_PROCESSING_TRANSACTION_ITEM_NOT_FOUND", $transaction["OrderLineItemID"], print_r($transaction, true), $this->siteId);
             continue;
         }
         foreach ($items as $transactionItem) {
             $ebaySku = $isVariation ? $this->getSkuVariation($transactionItem["SKU"]) : $this->getSku($transactionItem["SKU"]);
             if (strlen($ebaySku) <= 0) {
                 Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_ORDER_PROCESSING_TRANSACTION_ITEM_SKU_NOT_FOUND", $transaction["OrderLineItemID"], print_r($transaction, true), $this->siteId);
                 continue;
             }
             $item = $basket->createItem('catalog', $ebaySku);
             $item->setField("PRODUCT_PROVIDER_CLASS", "CCatalogProductProvider");
             $itemData = array("CUSTOM_PRICE" => "Y", "PRICE" => floatval($transaction["TransactionPrice"]), "QUANTITY" => floatval($transaction["QuantityPurchased"]), "NAME" => !empty($transactionItem["VariationTitle"]) ? $transactionItem["VariationTitle"] : $transactionItem["Title"], "CURRENCY" => SiteCurrencyTable::getSiteCurrency($this->siteId));
//.........这里部分代码省略.........
开发者ID:webgksupport,项目名称:alpina,代码行数:101,代码来源:order.php

示例9: foreach

<?php

CCurrencyLang::disableUseHideZero();
$orderId = (int) $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"];
if ($orderId) {
    /** @var \Bitrix\Sale\Order $order */
    $order = \Bitrix\Sale\Order::load($orderId);
    if ($order) {
        /** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
        $paymentCollection = $order->getPaymentCollection();
        if ($paymentCollection) {
            /** @var \Bitrix\Sale\Payment $payment */
            foreach ($paymentCollection as $payment) {
                if (!$payment->isInner()) {
                    break;
                }
            }
            if ($payment) {
                $context = \Bitrix\Main\Application::getInstance()->getContext();
                $service = \Bitrix\Sale\PaySystem\Manager::getObjectById($payment->getPaymentSystemId());
                if ($_REQUEST['pdf'] && $_REQUEST['GET_CONTENT'] == 'Y') {
                    $result = $service->initiatePay($payment, $context->getRequest(), \Bitrix\Sale\PaySystem\BaseServiceHandler::STRING);
                    if ($result->isSuccess()) {
                        return $result->getTemplate();
                    }
                }
                $result = $service->initiatePay($payment, $context->getRequest());
            }
            CCurrencyLang::enableUseHideZero();
        }
    }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:payment.php

示例10: array

$allowedStatusesView = array();
$order = Bitrix\Sale\Order::load($_REQUEST["ID"]);
if ($order) {
    $allowedStatusesView = \Bitrix\Sale\OrderStatus::getStatusesUserCanDoOperations($USER->GetID(), array('view'));
}
if (!$order || !in_array($order->getField("STATUS_ID"), $allowedStatusesView)) {
    LocalRedirect("/bitrix/admin/sale_order.php?lang=" . LANGUAGE_ID . GetFilterParams("filter_", false));
}
$allowedStatusesEdit = \Bitrix\Sale\OrderStatus::getStatusesUserCanDoOperations($USER->GetID(), array('edit'));
if (!in_array($order->getField("STATUS_ID"), $allowedStatusesEdit)) {
    LocalRedirect("/bitrix/admin/sale_order_view.php?ID=" . $ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_"));
}
$userId = isset($_POST["USER_ID"]) ? intval($_POST["USER_ID"]) : $order->getUserId();
OrderEdit::initCouponsData($userId, $ID, isset($_POST["OLD_USER_ID"]) ? intval($_POST["USER_ID"]) : $userId);
if (!$boolLocked) {
    \Bitrix\Sale\Order::lock($ID);
}
$isSavingOperation = $_SERVER["REQUEST_METHOD"] == "POST" && (isset($_POST["apply"]) || isset($_POST["save"]));
$isRefreshDataAndSaveOperation = $_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["refresh_data_and_save"]) && $_POST["refresh_data_and_save"] == "Y";
$isNeedFieldsRestore = $_SERVER["REQUEST_METHOD"] == "POST" && !$isSavingOperation && !$isRefreshDataAndSaveOperation;
//save order params
if (($isSavingOperation || $isNeedFieldsRestore || $isRefreshDataAndSaveOperation) && $saleModulePermissions >= "U" && check_bitrix_sessid() && $result->isSuccess()) {
    if ($isSavingOperation || $isRefreshDataAndSaveOperation) {
        $order = OrderEdit::editOrderByFormData($_POST, $order, $USER->GetID(), true, $_FILES, $result);
    }
    if ($isRefreshDataAndSaveOperation) {
        /** @var \Bitrix\Sale\Basket $basket */
        if (!($basket = $order->getBasket())) {
            throw new \Bitrix\Main\ObjectNotFoundException('Entity "Basket" not found');
        }
        $res = $basket->refreshData(array('PRICE', 'QUANTITY', 'COUPONS'));
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:order_edit.php

示例11: prepareData

 /**
  * @param array $discounts
  * @return array|null
  * @throws Main\LoaderException
  */
 public function prepareData(array $inParams = array())
 {
     if ($this->data === null) {
         $result = array("ITEMS" => array(), "WEIGHT" => 0);
         $basket = $this->order->getBasket();
         if (empty($inParams["DISCOUNTS"])) {
             $inParams["DISCOUNTS"] = OrderEdit::getDiscountsApplyResult($this->order, true);
         }
         $basketDiscount = 0;
         $basketPrice = 0;
         $basketPriceBase = 0;
         if (!$basket) {
             $result["WEIGHT_FOR_HUMAN"] = roundEx(floatval(0), SALE_WEIGHT_PRECISION);
             $this->data = $result;
             return $result;
         }
         $result["WEIGHT"] = $basket->getWeight();
         $result["WEIGHT_FOR_HUMAN"] = roundEx(floatval($result["WEIGHT"] / $this->weightKoef), SALE_WEIGHT_PRECISION);
         $items = $basket->getBasketItems();
         /** @var \Bitrix\Sale\BasketItem $item */
         if (self::$catalogIncluded === null) {
             self::$catalogIncluded = Main\Loader::includeModule('catalog');
         }
         foreach ($items as $item) {
             $productId = $item->getProductId();
             $params = array();
             if ($item->getField("MODULE") == "catalog") {
                 $params = static::getProductDetails($productId, $item->getQuantity(), $this->order->getUserId(), $this->order->getSiteId(), $this->visibleColumns);
             } elseif (strval($item->getField("MEASURE_CODE")) != '' && self::$catalogIncluded) {
                 $measures = OrderBasket::getCatalogMeasures();
                 if (isset($measures[$item->getField("MEASURE_CODE")]) && strlen($measures[$item->getField("MEASURE_CODE")]) > 0) {
                     $params["MEASURE_TEXT"] = $measures[$item->getField("MEASURE_CODE")];
                 }
                 if (strval($params["MEASURE_TEXT"]) == '') {
                     $defaultMeasure = static::getDefaultMeasures();
                     $params["MEASURE_TEXT"] = $defaultMeasure["SYMBOL_RUS"] != '' ? $defaultMeasure["SYMBOL_RUS"] : $defaultMeasure["SYMBOL_INTL"];
                 }
             }
             if (!isset($params["OFFER_ID"])) {
                 $params["OFFER_ID"] = $productId;
             }
             $params["BASKET_CODE"] = $basketCode = $item->getBasketCode();
             $params["PRODUCT_PROVIDER_CLASS"] = $item->getProvider();
             $id = $params["PRODUCT_ID"];
             $params = array_merge($params, $item->getFieldValues(), array("PRODUCT_ID" => $id));
             $params["PROPS"] = array();
             /** @var \Bitrix\Sale\BasketPropertyItem $property */
             foreach ($item->getPropertyCollection() as $property) {
                 $params["PROPS"][] = array("VALUE" => $property->getField("VALUE"), "NAME" => $property->getField("NAME"), "CODE" => $property->getField("CODE"), "SORT" => $property->getField("SORT"));
             }
             if (isset($inParams["DISCOUNTS"]["RESULT"]["BASKET"][$basketCode]) && is_array($inParams["DISCOUNTS"]["RESULT"]["BASKET"][$basketCode])) {
                 foreach ($inParams["DISCOUNTS"]["RESULT"]["BASKET"][$basketCode] as $discount) {
                     $params["DISCOUNTS"][$discount["DISCOUNT_ID"]] = $discount;
                 }
             }
             if (isset($inParams["DISCOUNTS"]["PRICES"]["BASKET"][$basketCode])) {
                 $params["PRICE_BASE"] = roundEx($inParams["DISCOUNTS"]["PRICES"]["BASKET"][$basketCode]["BASE_PRICE"], SALE_VALUE_PRECISION);
                 $params["PRICE"] = roundEx($inParams["DISCOUNTS"]["PRICES"]["BASKET"][$basketCode]["PRICE"], SALE_VALUE_PRECISION);
                 $basketPriceBase += $params["PRICE_BASE"] * $params["QUANTITY"];
                 $basketPrice += $params["PRICE"] * $params["QUANTITY"];
                 if (!$item->isCustomPrice()) {
                     $basketDiscount += $inParams["DISCOUNTS"]["PRICES"]["BASKET"][$basketCode]["DISCOUNT"] * $params["QUANTITY"];
                 }
             } else {
                 // TODO: for old orders
             }
             $params["CUSTOM_PRICE"] = $item->isCustomPrice() ? "Y" : "N";
             //Let's cache provider product data into form field
             if (Provider::isExistsTrustData($this->order->getSiteId(), 'sale', $item->getProductId())) {
                 $providerData = Provider::getTrustData($this->order->getSiteId(), 'sale', $item->getProductId());
                 if (is_array($providerData) && !empty($providerData)) {
                     $params["PROVIDER_DATA"] = serialize($providerData);
                 }
             }
             if (is_array($params["SET_ITEMS"]) && !empty($params["SET_ITEMS"])) {
                 $params["SET_ITEMS_DATA"] = serialize($params["SET_ITEMS"]);
             }
             $result["ITEMS"][$basketCode] = $params;
         }
         $result["BASKET_PRICE_BASE"] = roundEx($basketPriceBase, SALE_VALUE_PRECISION);
         $result["BASKET_PRICE"] = roundEx($basketPrice, SALE_VALUE_PRECISION);
         $result["DISCOUNT_VALUE"] = roundEx($basketDiscount, SALE_VALUE_PRECISION);
         $result["ITEMS_ORDER"] = array_keys($result["ITEMS"]);
         if (!isset($inParams["SKIP_SKU_INFO"]) || $inParams["SKIP_SKU_INFO"] != true) {
             $result = static::getOffersSkuParams($result);
         }
         $this->data = $result;
     }
     return $this->data;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:95,代码来源:orderbasket.php

示例12: intval

/**
 * @var CDatabase $DB
 * @var CMain  $APPLICATION
 */
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/prolog.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/general/admin_tool.php";
$moduleId = "sale";
Bitrix\Main\Loader::includeModule('sale');
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
$ID = intval($_GET["ID"]);
/** @var \Bitrix\Sale\Order $saleOrder */
if (!isset($saleOrder) || !$saleOrder instanceof \Bitrix\Sale\Order) {
    $saleOrder = \Bitrix\Sale\Order::load($ID);
}
$shipmentCollection = $saleOrder->getShipmentCollection();
$paymentCollection = $saleOrder->getPaymentCollection();
$sTableHistory = "table_order_history";
$oSortHistory = new CAdminSorting($sTableHistory);
$lAdminHistory = new CAdminList($sTableHistory, $oSortHistory);
//FILTER ORDER CHANGE HISTORY
$arFilterFieldsHistory = array("filter_user", "filter_date_history", "filter_type");
$lAdminHistory->InitFilter($arFilterFieldsHistory);
$by = trim(array_key_exists('by', $_REQUEST) ? $_REQUEST['by'] : '');
if ('' == $by) {
    $by = 'DATE_CREATE';
}
$order = trim(array_key_exists('order', $_REQUEST) ? $_REQUEST['order'] : '');
if ('' == $order) {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:30,代码来源:order_history.php

示例13: getUserBudgetByOrder

 /**
  * @param Sale\Order $order
  * @return int
  */
 public static function getUserBudgetByOrder(Sale\Order $order)
 {
     $budget = static::getUserBudget($order->getUserId(), $order->getCurrency());
     if ($userBudgetPool = static::getUserBudgetPool($order->getUserId())) {
         foreach ($userBudgetPool->get() as $userBudgetDat) {
             $budget += $userBudgetDat['SUM'];
         }
     }
     return $budget;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:userbudgetpool.php

示例14: loadForOrder

 public static function loadForOrder(Order $order)
 {
     $objects = array();
     $propertyValues = array();
     $propertyValuesMap = array();
     $properties = array();
     if ($order->getId() > 0) {
         $result = OrderPropsValueTable::getList(array('select' => array('ID', 'NAME', 'VALUE', 'CODE', 'ORDER_PROPS_ID'), 'filter' => array('ORDER_ID' => $order->getId())));
         while ($row = $result->fetch()) {
             $propertyValues[$row['ID']] = $row;
             $propertyValuesMap[$row['ORDER_PROPS_ID']] = $row['ID'];
         }
     }
     $filter = array();
     if ($order->getPersonTypeId() > 0) {
         $filter[] = array('=PERSON_TYPE_ID' => $order->getPersonTypeId());
     }
     $result = OrderPropsTable::getList(array('select' => array('ID', 'PERSON_TYPE_ID', 'NAME', 'TYPE', 'REQUIRED', 'DEFAULT_VALUE', 'SORT', 'USER_PROPS', 'IS_LOCATION', 'PROPS_GROUP_ID', 'DESCRIPTION', 'IS_EMAIL', 'IS_PROFILE_NAME', 'IS_PAYER', 'IS_LOCATION4TAX', 'IS_FILTERED', 'CODE', 'IS_ZIP', 'IS_PHONE', 'IS_ADDRESS', 'ACTIVE', 'UTIL', 'INPUT_FIELD_LOCATION', 'MULTIPLE', 'SETTINGS'), 'filter' => $filter, 'order' => array('SORT' => 'ASC')));
     while ($row = $result->fetch()) {
         $properties[$row['ID']] = $row;
     }
     $result = OrderPropsRelationTable::getList(array('select' => array('PROPERTY_ID', 'ENTITY_ID', 'ENTITY_TYPE'), 'filter' => array('PROPERTY_ID' => array_keys($properties))));
     $propRelation = array();
     while ($row = $result->fetch()) {
         if (empty($row)) {
             continue;
         }
         if (!isset($propRelation[$row['PROPERTY_ID']])) {
             $propRelation[$row['PROPERTY_ID']] = array();
         }
         $propRelation[$row['PROPERTY_ID']][] = $row;
     }
     foreach ($properties as $property) {
         $id = $property['ID'];
         if (isset($propertyValuesMap[$id])) {
             $fields = $propertyValues[$propertyValuesMap[$id]];
             unset($propertyValues[$propertyValuesMap[$id]]);
             unset($propertyValuesMap[$id]);
         } else {
             if ($property['ACTIVE'] == 'N' || $property['UTIL'] == 'Y') {
                 continue;
             }
             $fields = null;
         }
         if (isset($propRelation[$id])) {
             $objects[] = new static($property, $fields, $propRelation[$id]);
         } else {
             $objects[] = new static($property, $fields);
         }
     }
     foreach ($propertyValues as $propertyValue) {
         $objects[] = new static(null, $propertyValue);
     }
     return $objects;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:55,代码来源:propertyvalue.php

示例15: Withdraw

 /**
  * <p>Метод снимает указанную сумму с внутреннего счета пользователя. Если на внутреннем счете не достаточно средств, то снимается максимально доступная сумма (т.е. все доступные средства). Метод динамичный.</p>
  *
  *
  * @param int $userID  Код пользователя. </h
  *
  * @param double $paySum  Снимаемая сумма.
  *
  * @param string $payCurrency  Валюта снимаемой суммы.
  *
  * @param  $int  Код заказа, если снятие денег относится к заказу.
  *
  * @param orderI $D = 0] 
  *
  * @return double <p>Метод возвращает реально снятую со счета сумму или <i>false</i> в
  * случае ошибки.</p> <p></p><div class="note"> <b>Замечание:</b> деньги снимаются
  * только со счета той же валюты, которая передается параметром в
  * метод. Счета пользователя в другой валюте не затрагиваются.</div> <a
  * name="examples"></a>
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * // Оплатим полностью или хотя бы частично заказ номер 21 со счета пользователя
  * 
  * $arOrder = CSaleOrder::GetByID(21);
  * 
  * $withdrawSum = CSaleUserAccount::Withdraw(
  *         $arOrder["USER_ID"],
  *         $arOrder["PRICE"],
  *         $arOrder["CURRENCY"],
  *         $arOrder["ID"]
  *     );
  * 
  * if ($withdrawSum &gt; 0)
  * {
  *     $arFields = array(
  *             "SUM_PAID" =&gt; $withdrawSum,
  *             "USER_ID" =&gt; $arOrder["USER_ID"]
  *         );
  *     CSaleOrder::Update($arOrder["ID"], $arFields);
  * 
  *     if ($withdrawSum == $arOrder["PRICE"])
  *         CSaleOrder::PayOrder($arOrder["ID"], "Y", False, False);
  * }
  * ?&gt;
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csaleuseraccount/csaleuseraccount.withdraw.php
  * @author Bitrix
  */
 public static function Withdraw($userID, $paySum, $payCurrency, $orderID = 0)
 {
     global $DB;
     $errorCode = "";
     $userID = IntVal($userID);
     if ($userID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_EMPTYID"), "EMPTY_USER_ID");
         return False;
     }
     $paySum = str_replace(",", ".", $paySum);
     $paySum = DoubleVal($paySum);
     if ($paySum <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_EMPTY_SUM"), "EMPTY_SUM");
         return False;
     }
     $payCurrency = Trim($payCurrency);
     if (strlen($payCurrency) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_EMPTY_CUR"), "EMPTY_CURRENCY");
         return False;
     }
     $orderID = IntVal($orderID);
     if (!CSaleUserAccount::Lock($userID, $payCurrency)) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_ACCOUNT_NOT_LOCKED"), "ACCOUNT_NOT_LOCKED");
         return False;
     }
     $currentBudget = 0.0;
     // Check current user account budget
     $dbUserAccount = CSaleUserAccount::GetList(array(), array("USER_ID" => $userID, "CURRENCY" => $payCurrency));
     if ($arUserAccount = $dbUserAccount->Fetch()) {
         $currentBudget = DoubleVal($arUserAccount["CURRENT_BUDGET"]);
         if ($orderID > 0) {
             /** @var \Bitrix\Sale\Order $order */
             if ($order = \Bitrix\Sale\Order::load($orderID)) {
                 /** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
                 if (($paymentCollection = $order->getPaymentCollection()) && $paymentCollection->isExistsInnerPayment()) {
                     /** @var \Bitrix\Sale\Payment $payment */
                     if (($payment = $paymentCollection->getInnerPayment()) && $payment->isPaid()) {
                         return 0;
                     }
                 }
             }
         }
         if ($currentBudget > 0) {
             $withdrawSum = $paySum;
             if ($withdrawSum > $currentBudget) {
                 $withdrawSum = $currentBudget;
             }
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:user.php


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