本文整理汇总了PHP中CSaleDeliveryHandler::CalculateFull方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleDeliveryHandler::CalculateFull方法的具体用法?PHP CSaleDeliveryHandler::CalculateFull怎么用?PHP CSaleDeliveryHandler::CalculateFull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleDeliveryHandler
的用法示例。
在下文中一共展示了CSaleDeliveryHandler::CalculateFull方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onFinishChange
/**
* @param \DDelivery\Order\DDeliveryOrder $order
* @throws \Bitrix\Main\ArgumentException
*/
public function onFinishChange($order)
{
global $APPLICATION;
$point = $order->getPoint();
if ($order->type == DDeliverySDK::TYPE_SELF) {
$replaceData = array('%1' => $order->cityName, '%2' => $point['address'], '%3' => $point['delivery_company_name'], '%4' => $point['_id'], '%5' => $point['type'] == 1 ? 'Постомат' : 'ПВЗ');
$replaceData = $APPLICATION->ConvertCharsetArray($replaceData, 'UTF-8', SITE_CHARSET);
$comment = GetMessage('DDELIVERY_ABOUT_SELF', $replaceData);
} else {
if ($order->type == DDeliverySDK::TYPE_COURIER) {
$replaceData = array('%1' => $order->getFullAddress(), '%2' => $point['delivery_company_name']);
$replaceData = $APPLICATION->ConvertCharsetArray($replaceData, 'UTF-8', SITE_CHARSET);
$comment = GetMessage('DDELIVERY_ABOUT_COURIER', $replaceData);
} else {
$comment = 'error';
}
}
$orderId = $this->formData['bx_order_id'];
$params = array('DD_ABOUT' => $comment, 'DD_LOCAL_ID' => $order->localId);
$orderDeliveryTableData = OrderDeliveryTable::getList(array('filter' => array('ORDER_ID' => $orderId)))->fetch();
if ($orderDeliveryTableData) {
OrderDeliveryTable::update($orderDeliveryTableData['ID'], array('PARAMS' => serialize($params)));
} else {
OrderDeliveryTable::add(array('ORDER_ID' => $orderId, 'PARAMS' => serialize($params)));
}
$order = CSaleOrder::GetByID($orderId);
$arDeliveryResult = CSaleDeliveryHandler::CalculateFull('ddelivery', 'ddelivery:all', $order, CSaleLang::GetLangCurrency(SITE_ID), SITE_ID);
if ($arDeliveryResult['RESULT'] == 'OK') {
CSaleOrder::Update($orderId, array('PRICE_DELIVERY' => $arDeliveryResult['VALUE']));
}
}
示例2: DoLoadDelivery
public static function DoLoadDelivery($location, $locationZip, $weight, $price, $currency, $siteId = null)
{
$location = intval($location);
if ($location <= 0) {
return null;
}
if ($siteId == null) {
$siteId = SITE_ID;
}
$arResult = array();
$arFilter = array("COMPABILITY" => array("WEIGHT" => $weight, "PRICE" => $price, "LOCATION_FROM" => COption::GetOptionString('sale', 'location', false, $siteId), "LOCATION_TO" => $location, "LOCATION_ZIP" => $locationZip), "SITE_ID" => $siteId);
$dbDeliveryServices = CSaleDeliveryHandler::GetList(array("SORT" => "ASC"), $arFilter);
while ($arDeliveryService = $dbDeliveryServices->GetNext()) {
if (!is_array($arDeliveryService) || !is_array($arDeliveryService["PROFILES"])) {
continue;
}
foreach ($arDeliveryService["PROFILES"] as $profileId => $arDeliveryProfile) {
if ($arDeliveryProfile["ACTIVE"] != "Y") {
continue;
}
if (!array_key_exists($arDeliveryService["SID"], $arResult)) {
$arResult[$arDeliveryService["SID"]] = array("SID" => $arDeliveryService["SID"], "TITLE" => $arDeliveryService["NAME"], "DESCRIPTION" => $arDeliveryService["DESCRIPTION"], "PROFILES" => array());
}
$arResult[$arDeliveryService["SID"]]["PROFILES"][$profileId] = array("ID" => $arDeliveryService["SID"] . ":" . $profileId, "SID" => $profileId, "TITLE" => $arDeliveryProfile["TITLE"], "DESCRIPTION" => $arDeliveryProfile["DESCRIPTION"], "FIELD_NAME" => "DELIVERY_ID");
$arDeliveryPriceTmp = CSaleDeliveryHandler::CalculateFull($arDeliveryService["SID"], $profileId, array("PRICE" => $price, "WEIGHT" => $weight, "LOCATION_FROM" => COption::GetOptionString('sale', 'location', false, $siteId), "LOCATION_TO" => $location, "LOCATION_ZIP" => $locationZip), $currency);
if ($arDeliveryPriceTmp["RESULT"] != "ERROR") {
$arResult[$arDeliveryService["SID"]]["PROFILES"][$profileId]["DELIVERY_PRICE"] = roundEx($arDeliveryPriceTmp["VALUE"], SALE_VALUE_PRECISION);
$arResult[$arDeliveryService["SID"]]["PROFILES"][$profileId]["CURRENCY"] = $currency;
}
}
}
$dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("LID" => $siteId, "+<=WEIGHT_FROM" => $weight, "+>=WEIGHT_TO" => $weight, "+<=ORDER_PRICE_FROM" => $price, "+>=ORDER_PRICE_TO" => $price, "ACTIVE" => "Y", "LOCATION" => $location));
while ($arDelivery = $dbDelivery->GetNext()) {
$arDeliveryDescription = CSaleDelivery::GetByID($arDelivery["ID"]);
$arDelivery["DESCRIPTION"] = $arDeliveryDescription["DESCRIPTION"];
$arDelivery["FIELD_NAME"] = "DELIVERY_ID";
if (intval($arDelivery["PERIOD_FROM"]) > 0 || intval($arDelivery["PERIOD_TO"]) > 0) {
$arDelivery["PERIOD_TEXT"] = GetMessage("SALE_DELIV_PERIOD");
if (intval($arDelivery["PERIOD_FROM"]) > 0) {
$arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_FROM") . " " . intval($arDelivery["PERIOD_FROM"]);
}
if (intval($arDelivery["PERIOD_TO"]) > 0) {
$arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_TO") . " " . intval($arDelivery["PERIOD_TO"]);
}
if ($arDelivery["PERIOD_TYPE"] == "H") {
$arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_HOUR") . " ";
} elseif ($arDelivery["PERIOD_TYPE"] == "M") {
$arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_MONTH") . " ";
} else {
$arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_DAY") . " ";
}
}
$arResult[] = $arDelivery;
}
return $arResult;
}
示例3: unserialize
"LOCATION_ZIP" => $locationZip,
"ITEMS" => $arBasketItems
);
$depList = \Bitrix\Sale\Delivery\OrderDeliveryTable::getList(array(
'filter'=>array('=ORDER_ID' => $ID),
));
if($dep = $depList->fetch())
{
$arDeliveryOrder["EXTRA_PARAMS"] = unserialize($dep["PARAMS"]);
}
$arPacks = CSaleDeliveryHelper::getBoxesFromConfig($profileId, $arDeliveryData["CONFIG"]["CONFIG"]);
$arDeliveryResult = CSaleDeliveryHandler::CalculateFull($arDeliveryData["SID"], $profileId, $arDeliveryOrder, $arOrder["CURRENCY"], $LID);
$delDiscountDiff = roundEx($arDeliveryResult["VALUE"] - $arOrder["PRICE_DELIVERY"], SALE_VALUE_PRECISION);
$tabControl->BeginCustomField("ORDER_DELIVERY_ADDITIONAL_INFO", "");
if (!empty($arPacks)):
$arBox = array_shift(array_values($arPacks));
?>
<tr>
<td width="40%"></td>
<td width="60%">
<a class="dashed-link" href="javascript:void(0);" onclick="fToggleDeliveryInfo();"><?php
echo GetMessage("SOD_SHOW_DELIVERY_ADDITIONAL_INFO");
?>
</a></td>
</td>
示例4: array
$bFirst = True;
$bFound = false;
$_SESSION["SALE_DELIVERY_EXTRA_PARAMS"] = array();
// here we will store params for params dialog
//select calc delivery
foreach ($arDeliveryServiceAll as $arDeliveryService) {
foreach ($arDeliveryService["PROFILES"] as $profile_id => $arDeliveryProfile) {
if ($arDeliveryProfile["ACTIVE"] == "Y" && (count($arP2D[$arUserResult["PAY_SYSTEM_ID"]]) <= 0 || in_array($arDeliveryService["SID"], $arP2D[$arUserResult["PAY_SYSTEM_ID"]]) || empty($arD2P[$arDeliveryService["SID"]]))) {
$delivery_id = $arDeliveryService["SID"];
$arProfile = array("SID" => $profile_id, "TITLE" => $arDeliveryProfile["TITLE"], "DESCRIPTION" => $arDeliveryProfile["DESCRIPTION"], "FIELD_NAME" => "DELIVERY_ID");
if (strlen($arUserResult["DELIVERY_ID"]) > 0 && $arUserResult["DELIVERY_ID"] == $delivery_id . ":" . $profile_id) {
$arProfile["CHECKED"] = "Y";
$arUserResult["DELIVERY_ID"] = $delivery_id . ":" . $profile_id;
$bSelected = true;
$arOrderTmpDel = array("PRICE" => $arResult["ORDER_PRICE"], "WEIGHT" => $arResult["ORDER_WEIGHT"], "DIMENSIONS" => $arResult["ORDER_DIMENSIONS"], "LOCATION_FROM" => COption::GetOptionInt('sale', 'location'), "LOCATION_TO" => $arUserResult["DELIVERY_LOCATION"], "LOCATION_ZIP" => $arUserResult["DELIVERY_LOCATION_ZIP"], "ITEMS" => $arResult["BASKET_ITEMS"], "EXTRA_PARAMS" => $arResult["DELIVERY_EXTRA"]);
$arDeliveryPrice = CSaleDeliveryHandler::CalculateFull($delivery_id, $profile_id, $arOrderTmpDel, $arResult["BASE_LANG_CURRENCY"]);
}
if (empty($arResult["DELIVERY"][$delivery_id])) {
$arResult["DELIVERY"][$delivery_id] = array("SID" => $delivery_id, "SORT" => $arDeliveryService["SORT"], "TITLE" => $arDeliveryService["NAME"], "DESCRIPTION" => $arDeliveryService["DESCRIPTION"], "PROFILES" => array());
}
$arDeliveryExtraParams = CSaleDeliveryHandler::GetHandlerExtraParams($delivery_id, $profile_id, $arOrderTmpDel, SITE_ID);
if (!empty($arDeliveryExtraParams)) {
$_SESSION["SALE_DELIVERY_EXTRA_PARAMS"][$delivery_id . ":" . $profile_id] = $arDeliveryExtraParams;
$arResult["DELIVERY"][$delivery_id]["ISNEEDEXTRAINFO"] = "Y";
} else {
$arResult["DELIVERY"][$delivery_id]["ISNEEDEXTRAINFO"] = "N";
}
if ($arDeliveryPrice["RESULT"] == "ERROR") {
$arResult["ERROR"][] = $arDeliveryPrice["TEXT"];
} else {
$arResult["DELIVERY_PRICE"] = roundEx($arDeliveryPrice["VALUE"], SALE_VALUE_PRECISION);
示例5: array
$arResult["DELIVERY"][$k]["PROFILES"][$kk]["CHECKED"] = "Y";
$arUserResult["DELIVERY_ID"] = $k.":".$kk;
$bf = false;
$arOrderTmpDel = array(
"PRICE" => $arResult["ORDER_PRICE"],
"WEIGHT" => $arResult["ORDER_WEIGHT"],
"DIMENSIONS" => $arResult["ORDER_DIMENSIONS"],
"LOCATION_FROM" => COption::GetOptionInt('sale', 'location'),
"LOCATION_TO" => $arUserResult["DELIVERY_LOCATION"],
"LOCATION_ZIP" => $arUserResult["DELIVERY_LOCATION_ZIP"],
"ITEMS" => $arResult["BASKET_ITEMS"],
"EXTRA_PARAMS" => $arResult["DELIVERY_EXTRA"]
);
$arDeliveryPrice = CSaleDeliveryHandler::CalculateFull($k, $kk, $arOrderTmpDel, $arResult["BASE_LANG_CURRENCY"]);
if ($arDeliveryPrice["RESULT"] == "ERROR")
{
$arResult["ERROR"][] = $arDeliveryPrice["TEXT"];
}
else
{
$arResult["DELIVERY_PRICE"] = roundEx($arDeliveryPrice["VALUE"], SALE_VALUE_PRECISION);
$arResult["PACKS_COUNT"] = $arDeliveryPrice["PACKS_COUNT"];
}
break;
}
}
}
}
示例6: intval
}
$arParams["LOCATION_TO"] = intval($arParams["LOCATION_TO"]);
$arParams["LOCATION_FROM"] = intval($arParams["LOCATION_FROM"]);
if ($arParams["LOCATION_FROM"] <= 0) {
$arParams["LOCATION_FROM"] = COption::GetOptionString('sale', 'location');
}
$arParams["STEP"] = intval($arParams["STEP"]);
if ($arParams["STEP"] <= 0) {
$arParams["AJAX_CALL"] = 'N';
}
if (is_set($arParams["START_VALUE"])) {
$arParams["START_VALUE"] = doubleval($arParams["START_VALUE"]);
}
if ($arParams["AJAX_CALL"] == "Y") {
if ($arParams['NO_AJAX'] == 'Y') {
$result = CSaleDeliveryHandler::CalculateFull($arParams["DELIVERY"], $arParams["PROFILE"], array("PRICE" => $arParams["ORDER_PRICE"], "WEIGHT" => $arParams["ORDER_WEIGHT"], "LOCATION_FROM" => $arParams["LOCATION_FROM"], "LOCATION_TO" => $arParams["LOCATION_TO"], "LOCATION_ZIP" => $arParams['LOCATION_ZIP'], "ITEMS" => $arParams["ITEMS"], "EXTRA_PARAMS" => $arParams["EXTRA_PARAMS"]), $arParams["CURRENCY"]);
if (is_array($result)) {
if ($result["RESULT"] == "OK" && CModule::IncludeModule('currency')) {
$result["VALUE_FORMATTED"] = CurrencyFormat($result["VALUE"], $arParams["CURRENCY"]);
} elseif ($result["RESULT"] == "NEXT_STEP" && strlen($result["TEMP"]) > 0) {
$result["TEMP"] = CUtil::JSEscape($result["TEMP"]);
}
$arResult["RESULT"] = $result;
}
} else {
$dbHandler = CSaleDeliveryHandler::GetBySID($arParams["DELIVERY"]);
if ($arHandler = $dbHandler->Fetch()) {
foreach ($arHandler["PROFILES"] as $profile_id => $arProfile) {
if ($profile_id != $arParams["PROFILE"]) {
unset($arHandler["PROFILES"][$profile_id]);
}
示例7: roundEx
}
$deliveryPrice = 0;
if ($bNeedReCount) {
if ($bUseOldDelivery) {
if ($DELIVERY_ID > 0) {
if ($arDelivery = CSaleDelivery::GetByID($DELIVERY_ID)) {
$deliveryPrice = roundEx(CCurrencyRates::ConvertCurrency($arDelivery["PRICE"], $arDelivery["CURRENCY"], $BASE_LANG_CURRENCY), SALE_VALUE_PRECISION);
} else {
$errorMessage .= GetMessage("SOE_DELIVERY_NOT_FOUND") . "<br>";
}
}
} else {
list($DELIVERY_SERVICE, $DELIVERY_PROFILE) = explode(':', $DELIVERY_ID);
if (strlen($DELIVERY_SERVICE) > 0 && strlen($DELIVERY_PROFILE) > 0) {
$arDeliveryOrder = array("LOCATION_TO" => $DELIVERY_LOCATION, "LOCATION_FROM" => COption::GetOptionInt('sale', 'location', '', $LID), "WEIGHT" => $basketTotalWeight, "PRICE" => $basketTotalPrice + array_sum($arTaxPrice));
$arDeliveryResult = CSaleDeliveryHandler::CalculateFull($DELIVERY_SERVICE, $DELIVERY_PROFILE, $arDeliveryOrder, $BASE_LANG_CURRENCY, $LID);
//echo '<pre>'; print_r($arDeliveryResult ); echo '</pre>';
// die();
if ($arDeliveryResult["RESULT"] != 'OK') {
if ($ex = $APPLICATION->GetException()) {
$errorMessage .= $ex->GetString() . '<br>';
} else {
$errorMessage .= GetMessage("SOE_DELIVERY_ERROR") . '<br>';
}
} else {
$deliveryPrice = roundEx($arDeliveryResult["VALUE"], SALE_VALUE_PRECISION);
}
}
}
} else {
$PRICE_DELIVERY = DoubleVal(str_replace(",", ".", $PRICE_DELIVERY));
示例8: getDeliveryOptions
public function getDeliveryOptions($locationId = null, $from = null)
{
if (empty($locationId)) {
$locationId = $this->getLocationId();
}
if (empty($locationId)) {
throw new \Exception('Для получения служб доставки нужно указать место доставки ' . __METHOD__);
}
$filter = array('COMPABILITY' => array('WEIGHT' => $this->getWeight(), 'PRICE' => $this->getTotal(), 'LOCATION_FROM' => !empty($from) ? $from : \COption::GetOptionString('sale', 'location', false, SITE_ID), 'LOCATION_TO' => $locationId, 'ITEMS' => $this->getItemsRaw()));
$delivery = array();
$res = \CSaleDeliveryHandler::GetList(array('SORT' => 'ASC'), $filter);
while ($deliveryItem = $res->Fetch()) {
if (!is_array($deliveryItem) || !is_array($deliveryItem['PROFILES'])) {
continue;
}
foreach ($deliveryItem['PROFILES'] as $key => $profile) {
$deliveryProfile = array('ID' => $deliveryItem['SID'] . ':' . $key, 'SID' => $deliveryItem['SID'], 'PROFILE' => $key, 'NAME' => $deliveryItem['NAME'], 'TITLE' => $profile['TITLE'], 'DESCRIPTION' => $deliveryItem['DESCRIPTION'], 'DESCRIPTION_INNER' => $deliveryItem['DESCRIPTION_INNER'], 'BASE_CURRENCY' => $deliveryItem['BASE_CURRENCY'], 'HANDLER' => $deliveryItem['HANDLER'], 'DELIVERY' => $deliveryItem);
$delivery[] = $deliveryProfile;
}
}
$res = \CSaleDelivery::GetList(array('SORT' => 'ASC', 'NAME' => 'ASC'), array('LID' => SITE_ID, '+<=WEIGHT_FROM' => $this->getWeight(), '+>=WEIGHT_TO' => $this->getWeight(), 'ACTIVE' => 'Y', 'LOCATION' => $locationId));
while ($deliveryItem = $res->Fetch()) {
$deliveryDescription = \CSaleDelivery::GetByID($deliveryItem['ID']);
$deliveryItem['DESCRIPTION'] = htmlspecialcharsbx($deliveryDescription['DESCRIPTION']);
$delivery[] = $deliveryItem;
}
foreach ($delivery as $k => $deliveryItem) {
if ($deliveryItem['NAME'] == 'Самовывоз') {
continue;
}
if (empty($deliveryItem['SID'])) {
continue;
}
/**
* TODO
* dimensions
*/
$arOrderTmpDel = array('PRICE' => $this->getTotal(), 'WEIGHT' => $this->getWeight() / 1000, 'DIMENSIONS' => array(10, 10, 10), 'LOCATION_FROM' => COption::GetOptionInt('sale', 'location'), 'LOCATION_TO' => $locationId, 'ITEMS' => $this->getItemsRaw());
$price = \CSaleDeliveryHandler::CalculateFull($deliveryItem['SID'], $deliveryItem['PROFILE'], $arOrderTmpDel, 'RUB');
$delivery[$k]['PRICE'] = $price['VALUE'];
}
return $delivery;
}
示例9: elseif
}
if (strlen($arVal["COUNTRY_NAME"]) > 0 || strlen($arVal["REGION_NAME"]) > 0) {
$locationName .= " - " . $arVal["CITY_NAME"];
} elseif (strlen($arVal["CITY_NAME"]) > 0) {
$locationName .= $arVal["CITY_NAME"];
}
$arProperties["VALUE_FORMATED"] .= htmlspecialcharsEx($locationName);
}
$arResult["ORDER_PROPS_PRINT"][] = $arProperties;
}
if (is_array($arResult["DELIVERY_ID"])) {
$obDeliveryHandler = CSaleDeliveryHandler::GetBySID($arResult["DELIVERY_ID"][0]);
$arResult["DELIVERY"] = $obDeliveryHandler->Fetch();
$arResult["DELIVERY_PROFILE"] = $arResult["DELIVERY_ID"][1];
$arOrderTmpDel = array("PRICE" => $arResult["ORDER_PRICE"], "WEIGHT" => $arResult["ORDER_WEIGHT"], "LOCATION_FROM" => COption::GetOptionInt('sale', 'location'), "LOCATION_TO" => $arResult["DELIVERY_LOCATION"], "LOCATION_ZIP" => $arResult["DELIVERY_LOCATION_ZIP"]);
$arDeliveryPrice = CSaleDeliveryHandler::CalculateFull($arResult["DELIVERY_ID"][0], $arResult["DELIVERY_ID"][1], $arOrderTmpDel, $arResult["BASE_LANG_CURRENCY"]);
if ($arDeliveryPrice["RESULT"] == "ERROR") {
$arResult["ERROR_MESSAGE"] = $arDeliveryPrice["TEXT"];
} else {
$arResult["DELIVERY_PRICE"] = roundEx($arDeliveryPrice["VALUE"], SALE_VALUE_PRECISION);
}
} elseif (IntVal($arResult["DELIVERY_ID"]) > 0 && ($arDeliv = CSaleDelivery::GetByID($arResult["DELIVERY_ID"]))) {
$arDeliv["NAME"] = htmlspecialcharsEx($arDeliv["NAME"]);
$arResult["DELIVERY"] = $arDeliv;
$arResult["DELIVERY_PRICE"] = roundEx(CCurrencyRates::ConvertCurrency($arDeliv["PRICE"], $arDeliv["CURRENCY"], $arResult["BASE_LANG_CURRENCY"]), SALE_VALUE_PRECISION);
} elseif (IntVal($DELIVERY_ID) > 0) {
$arResult["DELIVERY"] = "ERROR";
}
if (IntVal($arResult["PAY_SYSTEM_ID"]) > 0 && ($arPaySys = CSalePaySystem::GetByID($arResult["PAY_SYSTEM_ID"], $arResult["PERSON_TYPE"]))) {
$arResult["PAY_SYSTEM"] = $arPaySys;
$arResult["PAY_SYSTEM"]["PSA_NAME"] = htmlspecialcharsEx($arResult["PAY_SYSTEM"]["PSA_NAME"]);