本文整理汇总了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;
}
示例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));
//.........这里部分代码省略.........
示例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) {
//.........这里部分代码省略.........
示例4: process
/**
* @param OrderBase $order
* @return bool
*/
public static function process(OrderBase $order)
{
\CSaleDelivery::DoProcessOrder($order);
return true;
}