本文整理匯總了PHP中CSaleDeliveryHandler::__executeCalculateEvents方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSaleDeliveryHandler::__executeCalculateEvents方法的具體用法?PHP CSaleDeliveryHandler::__executeCalculateEvents怎麽用?PHP CSaleDeliveryHandler::__executeCalculateEvents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CSaleDeliveryHandler
的用法示例。
在下文中一共展示了CSaleDeliveryHandler::__executeCalculateEvents方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Calculate
function Calculate($STEP, $SID, $profile, $arOrder, $currency, $TMP = false, $SITE_ID = false)
{
global $APPLICATION;
if (!defined('SALE_DH_INITIALIZED')) {
CSaleDeliveryHandler::Initialize();
}
if (!$SITE_ID) {
$SITE_ID = SITE_ID;
}
$rsDeliveryHandler = CSaleDeliveryHandler::GetBySID($SID, $SITE_ID);
if (!($arHandler = $rsDeliveryHandler->Fetch())) {
return array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DH_ERROR_HANDLER_NOT_INSTALLED"));
}
if (is_callable($arHandler["CALCULATOR"])) {
$arConfig = $arHandler["CONFIG"]["CONFIG"];
$arOrder["PRICE"] = CCurrencyRates::ConvertCurrency($arOrder["PRICE"], $currency, $arHandler["BASE_CURRENCY"]);
if ($res = call_user_func($arHandler["CALCULATOR"], $profile, $arConfig, $arOrder, $STEP, $TMP)) {
if (is_array($res)) {
$arReturn = $res;
} elseif (is_numeric($res)) {
$arReturn = array("RESULT" => "OK", "VALUE" => doubleval($res));
}
} else {
if ($ex = $APPLICATION->GetException()) {
return array("RESULT" => "ERROR", "TEXT" => $ex->GetString());
} else {
return array("RESULT" => "OK", "VALUE" => 0);
}
}
if (is_array($arReturn) && $arReturn["RESULT"] == "OK" && $currency != $arHandler["BASE_CURRENCY"] && CModule::IncludeModule('currency')) {
$arReturn["VALUE"] = CCurrencyRates::ConvertCurrency($arReturn["VALUE"], $arHandler["BASE_CURRENCY"], $currency);
}
$arReturn["VALUE"] *= 1 + $arHandler["TAX_RATE"] / 100;
$arReturn = CSaleDeliveryHandler::__executeCalculateEvents($SID, $profile, $arOrder, $arReturn);
return $arReturn;
} else {
return array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DH_ERROR_WRONG_HANDLER_FILE"));
}
}