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


PHP CSaleDelivery::DoProcessOrder方法代码示例

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


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

示例1: DoCalculateOrder

 static function DoCalculateOrder($siteId, $userId, $arShoppingCart, $personTypeId, $arOrderPropsValues, $deliveryId, $paySystemId, $arOptions, &$arErrors, &$arWarnings)
 {
     $siteId = trim($siteId);
     if (empty($siteId)) {
         $arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_CALC_PARAM_ERROR'));
         return null;
     }
     $userId = intval($userId);
     if (!is_array($arShoppingCart) || count($arShoppingCart) <= 0) {
         $arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_SHOPPING_CART_EMPTY'));
         return null;
     }
     $arOrder = array("ORDER_PRICE" => 0, "ORDER_WEIGHT" => 0, "CURRENCY" => CSaleLang::GetLangCurrency($siteId), "WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, $siteId)), "WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, $siteId)), "BASKET_ITEMS" => $arShoppingCart, "SITE_ID" => $siteId, "LID" => $siteId, "USER_ID" => $userId, "USE_VAT" => false, "VAT_RATE" => 0, "VAT_SUM" => 0, "DELIVERY_ID" => false);
     foreach ($arShoppingCart as $arShoppingCartItem) {
         if (array_key_exists('CUSTOM_PRICE', $arShoppingCartItem) && 'Y' == $arShoppingCartItem['CUSTOM_PRICE']) {
             $arShoppingCartItem['DISCOUNT_PRICE'] = $arShoppingCartItem['DEFAULT_PRICE'] - $arShoppingCartItem['PRICE'];
             if (0 > $arShoppingCartItem['DISCOUNT_PRICE']) {
                 $arShoppingCartItem['DISCOUNT_PRICE'] = 0;
             }
             $arShoppingCartItem['DISCOUNT_PRICE_PERCENT'] = $arShoppingCartItem['DISCOUNT_PRICE'] * 100 / $arShoppingCartItem['DEFAULT_PRICE'];
             if ($arShoppingCartItem["VAT_RATE"] > 0) {
                 $arShoppingCartItem["VAT_VALUE"] = $arShoppingCartItem["PRICE"] / ($arShoppingCartItem["VAT_RATE"] + 1) * $arShoppingCartItem["VAT_RATE"];
             }
         }
         $arOrder["ORDER_PRICE"] += $arShoppingCartItem["PRICE"] * $arShoppingCartItem["QUANTITY"];
         $arOrder["ORDER_WEIGHT"] += $arShoppingCartItem["WEIGHT"] * $arShoppingCartItem["QUANTITY"];
         if ($arShoppingCartItem["VAT_RATE"] > 0) {
             $arOrder["USE_VAT"] = true;
             if ($arShoppingCartItem["VAT_RATE"] > $arOrder["VAT_RATE"]) {
                 $arOrder["VAT_RATE"] = $arShoppingCartItem["VAT_RATE"];
             }
             $arOrder["VAT_SUM"] += $arShoppingCartItem["VAT_VALUE"] * $arShoppingCartItem["QUANTITY"];
         }
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderShoppingCart", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     CSalePersonType::DoProcessOrder($arOrder, $personTypeId, $arErrors);
     if (count($arErrors) > 0) {
         return null;
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderPersonType", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     CSaleOrderProps::DoProcessOrder($arOrder, $arOrderPropsValues, $arErrors, $arWarnings);
     if (count($arErrors) > 0) {
         return null;
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderProps", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     CSaleDelivery::DoProcessOrder($arOrder, $deliveryId, $arErrors);
     if (count($arErrors) > 0) {
         return null;
     }
     $arOrder["PRICE_DELIVERY"] = $arOrder["DELIVERY_PRICE"];
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderDelivery", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     CSalePaySystem::DoProcessOrder($arOrder, $paySystemId, $arErrors);
     if (count($arErrors) > 0) {
         return null;
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderPaySystem", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     if (!array_key_exists('CART_FIX', $arOptions) || 'Y' != $arOptions['CART_FIX']) {
         CSaleDiscount::DoProcessOrder($arOrder, $arOptions, $arErrors);
         if (count($arErrors) > 0) {
             return null;
         }
         foreach (GetModuleEvents("sale", "OnSaleCalculateOrderDiscount", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array(&$arOrder));
         }
     }
     CSaleTax::DoProcessOrderBasket($arOrder, $arOptions, $arErrors);
     if (count($arErrors) > 0) {
         return null;
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderShoppingCartTax", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     CSaleTax::DoProcessOrderDelivery($arOrder, $arOptions, $arErrors);
     if (count($arErrors) > 0) {
         return null;
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderDeliveryTax", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     $arOrder["PRICE"] = $arOrder["ORDER_PRICE"] + $arOrder["DELIVERY_PRICE"] + $arOrder["TAX_PRICE"] - $arOrder["DISCOUNT_PRICE"];
     $arOrder["TAX_VALUE"] = $arOrder["USE_VAT"] ? $arOrder["VAT_SUM"] : $arOrder["TAX_PRICE"];
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrder", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     return $arOrder;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:96,代码来源:order.php

示例2: DoCalculateOrder

	/**
	 * @param $siteId
	 * @param $userId
	 * @param $arShoppingCart
	 * @param $personTypeId
	 * @param $arOrderPropsValues
	 * @param $deliveryId
	 * @param $paySystemId
	 * @param $arOptions
	 * @param $arErrors
	 * @param $arWarnings
	 * @return array|null
	 */
	static function DoCalculateOrder($siteId, $userId, $arShoppingCart, $personTypeId, $arOrderPropsValues,
		$deliveryId, $paySystemId, $arOptions, &$arErrors, &$arWarnings)
	{
		if(!is_array($arOptions))
		{
			$arOptions = array();
		}

		$siteId = trim($siteId);
		if (empty($siteId))
		{
			$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_CALC_PARAM_ERROR'));
			return null;
		}

		$userId = intval($userId);

		if (!is_array($arShoppingCart) || (count($arShoppingCart) <= 0))
		{
			$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_SHOPPING_CART_EMPTY'));
			return null;
		}

		// calculate weight for set parent
		$arParentWeight = array();
		foreach ($arShoppingCart as $arItem)
		{
			if (CSaleBasketHelper::isSetItem($arItem))
				$arParentWeight[$arItem["SET_PARENT_ID"]]["WEIGHT"] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
		}

		foreach ($arShoppingCart as &$arItem)
		{
			if (CSaleBasketHelper::isSetParent($arItem) && isset($arParentWeight[$arItem["SET_PARENT_ID"]]))
				$arItem["WEIGHT"] = $arParentWeight[$arItem["SET_PARENT_ID"]]["WEIGHT"];
		}
		unset($arItem);

		$currency = isset($arOptions['CURRENCY']) && is_string($arOptions['CURRENCY']) ? $arOptions['CURRENCY'] : '';
		if($currency === '')
		{
			$currency = CSaleLang::GetLangCurrency($siteId);
		}

		$arOrder = array(
			"ORDER_PRICE" => 0,
			"ORDER_WEIGHT" => 0,
			"CURRENCY" => $currency,
			"WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, $siteId)),
			"WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, $siteId)),
			"BASKET_ITEMS" => $arShoppingCart,
			"SITE_ID" => $siteId,
			"LID" => $siteId,
			"USER_ID" => $userId,
			"USE_VAT" => false,
			"VAT_RATE" => 0,
			"VAT_SUM" => 0,
			"DELIVERY_ID" => false,
		);

		$arOrderPrices = CSaleOrder::CalculateOrderPrices($arShoppingCart);

		if (sizeof($arOrderPrices)>0 && isset($arOrderPrices['BASKET_ITEMS']))
			$arShoppingCart = $arOrderPrices['BASKET_ITEMS'];

		$arOrder['ORDER_PRICE'] = $arOrderPrices['ORDER_PRICE'];
		$arOrder['ORDER_WEIGHT'] = $arOrderPrices['ORDER_WEIGHT'];
		$arOrder['VAT_RATE'] = $arOrderPrices['VAT_RATE'];
		$arOrder['VAT_SUM'] = $arOrderPrices['VAT_SUM'];
		$arOrder["USE_VAT"] = ($arOrderPrices['USE_VAT'] == "Y"?true:false);

		foreach(GetModuleEvents("sale", "OnSaleCalculateOrderShoppingCart", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$arOrder));

		CSalePersonType::DoProcessOrder($arOrder, $personTypeId, $arErrors);
		if (count($arErrors) > 0)
			return null;

		foreach(GetModuleEvents("sale", "OnSaleCalculateOrderPersonType", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$arOrder));

		CSaleOrderProps::DoProcessOrder($arOrder, $arOrderPropsValues, $arErrors, $arWarnings, $paySystemId, $deliveryId);
		if (count($arErrors) > 0)
			return null;

		foreach(GetModuleEvents("sale", "OnSaleCalculateOrderProps", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$arOrder));
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:order.php

示例3: DoCalculateOrder

 /**
  * @param $siteId
  * @param $userId
  * @param $arShoppingCart
  * @param $personTypeId
  * @param $arOrderPropsValues
  * @param $deliveryId
  * @param $paySystemId
  * @param $arOptions
  * @param $arErrors
  * @param $arWarnings
  * @return array|null
  */
 static function DoCalculateOrder($siteId, $userId, $arShoppingCart, $personTypeId, $arOrderPropsValues, $deliveryId, $paySystemId, $arOptions, &$arErrors, &$arWarnings)
 {
     if (!is_array($arOptions)) {
         $arOptions = array();
     }
     $siteId = trim($siteId);
     if (empty($siteId)) {
         $arErrors[] = array("CODE" => "PARAM", "TEXT" => Loc::getMessage('SKGO_CALC_PARAM_ERROR'));
         return null;
     }
     $userId = intval($userId);
     if (!is_array($arShoppingCart) || count($arShoppingCart) <= 0) {
         $arErrors[] = array("CODE" => "PARAM", "TEXT" => Loc::getMessage('SKGO_SHOPPING_CART_EMPTY'));
         return null;
     }
     $arOrder = static::makeOrderArray($siteId, $userId, $arShoppingCart, $arOptions);
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderShoppingCart", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     CSalePersonType::DoProcessOrder($arOrder, $personTypeId, $arErrors);
     if (count($arErrors) > 0) {
         return null;
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderPersonType", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     CSaleOrderProps::DoProcessOrder($arOrder, $arOrderPropsValues, $arErrors, $arWarnings, $paySystemId, $deliveryId, $arOptions);
     if (count($arErrors) > 0) {
         return null;
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderProps", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     CSaleDelivery::DoProcessOrder($arOrder, $deliveryId, $arErrors);
     if (count($arErrors) > 0) {
         return null;
     }
     $arOrder["PRICE_DELIVERY"] = $arOrder["DELIVERY_PRICE"];
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderDelivery", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     CSalePaySystem::DoProcessOrder($arOrder, $paySystemId, $arErrors);
     if (count($arErrors) > 0) {
         return null;
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderPaySystem", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arOrder));
     }
     if (!array_key_exists('CART_FIX', $arOptions) || 'Y' != $arOptions['CART_FIX']) {
         CSaleDiscount::DoProcessOrder($arOrder, $arOptions, $arErrors);
         if (count($arErrors) > 0) {
             return null;
         }
         foreach (GetModuleEvents("sale", "OnSaleCalculateOrderDiscount", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array(&$arOrder));
         }
         if (isset($arOrder['ORDER_PRICE'])) {
             $roundOrderFields = static::getRoundFields();
             foreach ($arOrder as $fieldName => $fieldValue) {
                 if (in_array($fieldName, $roundOrderFields)) {
                     $arOrder[$fieldName] = PriceMaths::roundPrecision($arOrder[$fieldName]);
                 }
             }
         }
         if (!empty($arOrder['BASKET_ITEMS']) && is_array($arOrder['BASKET_ITEMS'])) {
             $arOrder['ORDER_PRICE'] = 0;
             $roundBasketFields = CSaleBasket::getRoundFields();
             foreach ($arOrder['BASKET_ITEMS'] as &$basketItem) {
                 foreach ($basketItem as $fieldName => $fieldValue) {
                     if (in_array($fieldName, $roundBasketFields)) {
                         if (isset($basketItem[$fieldName])) {
                             $basketItem[$fieldName] = PriceMaths::roundPrecision($basketItem[$fieldName]);
                         }
                     }
                 }
                 if (CSaleBasketHelper::isSetItem($basketItem)) {
                     continue;
                 }
                 $arOrder['ORDER_PRICE'] += CSaleBasketHelper::getFinalPrice($basketItem);
             }
         }
     }
     CSaleTax::DoProcessOrderBasket($arOrder, $arOptions, $arErrors);
     if (count($arErrors) > 0) {
         return null;
     }
     foreach (GetModuleEvents("sale", "OnSaleCalculateOrderShoppingCartTax", true) as $arEvent) {
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:order.php

示例4: process

 /**
  * @param OrderBase $order
  * @return bool
  */
 public static function process(OrderBase $order)
 {
     \CSaleDelivery::DoProcessOrder($order);
     return true;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:9,代码来源:deliveryservice.php


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