本文整理汇总了PHP中CSaleDeliveryHandler类的典型用法代码示例。如果您正苦于以下问题:PHP CSaleDeliveryHandler类的具体用法?PHP CSaleDeliveryHandler怎么用?PHP CSaleDeliveryHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSaleDeliveryHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Compability
function Compability($arOrder, $arConfig)
{
$result = array();
$aviableBoxes = CSaleDeliveryHelper::getBoxesFromConfig('distant_inner', $arConfig);
foreach ($aviableBoxes as $arBox) {
if (CSaleDeliveryHandler::checkDimensions($arOrder["MAX_DIMENSIONS"], $arBox["DIMENSIONS"])) {
$result = array('distant_inner');
break;
}
}
return $result;
}
示例4: Compability
function Compability($arOrder, $arConfig)
{
if (floatval($arOrder["WEIGHT"]) <= self::$MAX_WEIGHT) {
$profiles = array('ware', 'door');
} else {
$profiles = array();
}
$arRes = array();
foreach ($profiles as $profile) {
$aviableBoxes = CSaleDeliveryHelper::getBoxesFromConfig($profile, $arConfig);
foreach ($aviableBoxes as $arBox) {
if (CSaleDeliveryHandler::checkDimensions($arOrder["MAX_DIMENSIONS"], $arBox["DIMENSIONS"])) {
$arRes[] = $profile;
break;
}
}
}
return $arRes;
}
示例5: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
if (is_set($arFields, "SITE_ID") && strlen($arFields["SITE_ID"]) > 0) {
$arFields["LID"] = $arFields["SITE_ID"];
}
if ((is_set($arFields, "LID") || $ACTION == "ADD") && strlen($arFields["LID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_SITE"), "EMPTY_SITE_ID");
return false;
}
if ((is_set($arFields, "PERSON_TYPE_ID") || $ACTION == "ADD") && IntVal($arFields["PERSON_TYPE_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_PERS_TYPE"), "EMPTY_PERSON_TYPE_ID");
return false;
}
if ((is_set($arFields, "USER_ID") || $ACTION == "ADD") && IntVal($arFields["USER_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_USER_ID"), "EMPTY_USER_ID");
return false;
}
if (is_set($arFields, "PAYED") && $arFields["PAYED"] != "Y") {
$arFields["PAYED"] = "N";
}
if (is_set($arFields, "CANCELED") && $arFields["CANCELED"] != "Y") {
$arFields["CANCELED"] = "N";
}
if (is_set($arFields, "STATUS_ID") && strlen($arFields["STATUS_ID"]) <= 0) {
$arFields["STATUS_ID"] = "N";
}
if (is_set($arFields, "ALLOW_DELIVERY") && $arFields["ALLOW_DELIVERY"] != "Y") {
$arFields["ALLOW_DELIVERY"] = "N";
}
if (is_set($arFields, "PRICE") || $ACTION == "ADD") {
$arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
$arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
}
if (is_set($arFields, "PRICE_DELIVERY") || $ACTION == "ADD") {
$arFields["PRICE_DELIVERY"] = str_replace(",", ".", $arFields["PRICE_DELIVERY"]);
$arFields["PRICE_DELIVERY"] = DoubleVal($arFields["PRICE_DELIVERY"]);
}
if (is_set($arFields, "SUM_PAID") || $ACTION == "ADD") {
$arFields["SUM_PAID"] = str_replace(",", ".", $arFields["SUM_PAID"]);
$arFields["SUM_PAID"] = DoubleVal($arFields["SUM_PAID"]);
}
if (is_set($arFields, "DISCOUNT_VALUE") || $ACTION == "ADD") {
$arFields["DISCOUNT_VALUE"] = str_replace(",", ".", $arFields["DISCOUNT_VALUE"]);
$arFields["DISCOUNT_VALUE"] = DoubleVal($arFields["DISCOUNT_VALUE"]);
}
if (is_set($arFields, "TAX_VALUE") || $ACTION == "ADD") {
$arFields["TAX_VALUE"] = str_replace(",", ".", $arFields["TAX_VALUE"]);
$arFields["TAX_VALUE"] = DoubleVal($arFields["TAX_VALUE"]);
}
if (!is_set($arFields, "LOCKED_BY") && (!is_set($arFields, "UPDATED_1C") || is_set($arFields, "UPDATED_1C") && $arFields["UPDATED_1C"] != "Y")) {
$arFields["UPDATED_1C"] = "N";
}
if ((is_set($arFields, "CURRENCY") || $ACTION == "ADD") && strlen($arFields["CURRENCY"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_CURRENCY"), "EMPTY_CURRENCY");
return false;
}
if (is_set($arFields, "CURRENCY")) {
if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["CURRENCY"], GetMessage("SKGO_WRONG_CURRENCY")), "ERROR_NO_CURRENCY");
return false;
}
}
if (is_set($arFields, "LID")) {
$dbSite = CSite::GetByID($arFields["LID"]);
if (!$dbSite->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["LID"], GetMessage("SKGO_WRONG_SITE")), "ERROR_NO_SITE");
return false;
}
}
if (is_set($arFields, "USER_ID")) {
$dbUser = CUser::GetByID($arFields["USER_ID"]);
if (!$dbUser->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["USER_ID"], GetMessage("SKGO_WRONG_USER")), "ERROR_NO_USER_ID");
return false;
}
}
if (is_set($arFields, "PERSON_TYPE_ID")) {
if (!($arPersonType = CSalePersonType::GetByID($arFields["PERSON_TYPE_ID"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PERSON_TYPE_ID"], GetMessage("SKGO_WRONG_PERSON_TYPE")), "ERROR_NO_PERSON_TYPE");
return false;
}
}
if (is_set($arFields, "PAY_SYSTEM_ID") && IntVal($arFields["PAY_SYSTEM_ID"]) > 0) {
if (!($arPaySystem = CSalePaySystem::GetByID(IntVal($arFields["PAY_SYSTEM_ID"])))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PAY_SYSTEM_ID"], GetMessage("SKGO_WRONG_PS")), "ERROR_NO_PAY_SYSTEM");
return false;
}
}
if (is_set($arFields, "DELIVERY_ID") && (strpos($arFields["DELIVERY_ID"], ":") !== false || IntVal($arFields["DELIVERY_ID"]) > 0)) {
if (strpos($arFields["DELIVERY_ID"], ":") !== false) {
$arId = explode(":", $arFields["DELIVERY_ID"]);
$obDelivery = new CSaleDeliveryHandler();
if ($arDelivery = $obDelivery->GetBySID($arId[0])) {
if ($arDelivery = $arDelivery->Fetch()) {
if (!is_set($arDelivery["PROFILES"], $arId[1])) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
return false;
}
}
} else {
//.........这里部分代码省略.........
示例6: 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>
示例7: foreach
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);
$arResult["PACKS_COUNT"] = $arDeliveryPrice["PACKS_COUNT"];
}
if (!empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") !== false) {
if ($arUserResult["DELIVERY_ID"] == $delivery_id . ":" . $profile_id) {
$bFound = true;
示例8: ShowStep
function ShowStep()
{
$wizard =& $this->GetWizard();
$shopLocalization = $wizard->GetVar("shopLocalization", true);
$personType = $wizard->GetVar("personType");
$arAutoDeliveries = array();
if (CModule::IncludeModule("sale")) {
$dbDelivery = CSaleDeliveryHandler::GetList();
while ($arDelivery = $dbDelivery->Fetch()) {
$arAutoDeliveries[$arDelivery["SID"]] = $arDelivery["ACTIVE"];
}
}
$siteID = WizardServices::GetCurrentSiteID($wizard->GetVar("siteID"));
$this->content .= '<div class="wizard-input-form">';
$this->content .= '
<div class="wizard-input-form-block">
<div class="wizard-catalog-title">' . GetMessage("WIZ_PAY_SYSTEM_TITLE") . '</div>
<div>
<div class="wizard-input-form-field wizard-input-form-field-checkbox">
<div class="wizard-catalog-form-item">
' . $this->ShowCheckboxField('paysystem[cash]', 'Y', array("id" => "paysystemC")) . ' <label for="paysystemC">' . GetMessage("WIZ_PAY_SYSTEM_C") . '</label>
</div>';
if (LANGUAGE_ID == "ru") {
if ($shopLocalization == "ua" && ($personType["fiz"] == "Y" || $personType["fiz_ua"] == "Y")) {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[oshad]', 'Y', array("id" => "paysystemO")) . ' <label for="paysystemS">' . GetMessage("WIZ_PAY_SYSTEM_O") . '</label>
</div>';
}
if ($shopLocalization == "ru") {
if ($personType["fiz"] == "Y") {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[sber]', 'Y', array("id" => "paysystemS")) . ' <label for="paysystemS">' . GetMessage("WIZ_PAY_SYSTEM_S") . '</label>
</div>';
}
if ($personType["fiz"] == "Y" || $personType["ur"] == "Y") {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[collect]', 'Y', array("id" => "paysystemCOL")) . ' <label for="paysystemCOL">' . GetMessage("WIZ_PAY_SYSTEM_COL") . '</label>
</div>';
}
}
if ($personType["ur"] == "Y") {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[bill]', 'Y', array("id" => "paysystemB")) . ' <label for="paysystemB">';
if ($shopLocalization == "ua") {
$this->content .= GetMessage("WIZ_PAY_SYSTEM_B_UA");
} else {
$this->content .= GetMessage("WIZ_PAY_SYSTEM_B");
}
$this->content .= '</label>
</div>';
}
} else {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[paypal]', 'Y', array("id" => "paysystemP")) . ' <label for="paysystemP">PayPal</label>
</div>';
}
$this->content .= '</div>
</div>
<div class="wizard-catalog-form-item">' . GetMessage("WIZ_PAY_SYSTEM") . '</div>
</div>';
if (LANGUAGE_ID != "ru" || LANGUAGE_ID == "ru" && (COption::GetOptionString("youstore", "wizard_installed", "N", $siteID) != "Y" || $shopLocalization == "ru" && ($arAutoDeliveries["russianpost"] != "Y" || $arAutoDeliveries["rus_post"] != "Y" || $arAutoDeliveries["rus_post_first"] != "Y") || $shopLocalization == "ua" && $arAutoDeliveries["ua_post"] != "Y" || $shopLocalization == "kz" && $arAutoDeliveries["kaz_post"] != "Y")) {
$this->content .= '
<div class="wizard-input-form-block">
<div class="wizard-catalog-title">' . GetMessage("WIZ_DELIVERY_TITLE") . '</div>
<div>
<div class="wizard-input-form-field wizard-input-form-field-checkbox">';
if (COption::GetOptionString("youstore", "wizard_installed", "N", $siteID) != "Y") {
$this->content .= '<div class="wizard-catalog-form-item">
' . $this->ShowCheckboxField('delivery[courier]', 'Y', array("id" => "deliveryC")) . ' <label for="deliveryC">' . GetMessage("WIZ_DELIVERY_C") . '</label>
</div>
<div class="wizard-catalog-form-item">
' . $this->ShowCheckboxField('delivery[self]', 'Y', array("id" => "deliveryS")) . ' <label for="deliveryS">' . GetMessage("WIZ_DELIVERY_S") . '</label>
</div>';
}
if (LANGUAGE_ID == "ru") {
if ($shopLocalization == "ru") {
if ($arAutoDeliveries["russianpost"] != "Y") {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[russianpost]', 'Y', array("id" => "deliveryR")) . ' <label for="deliveryR">' . GetMessage("WIZ_DELIVERY_R") . '</label>
</div>';
}
if ($arAutoDeliveries["rus_post"] != "Y") {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[rus_post]', 'Y', array("id" => "deliveryR2")) . ' <label for="deliveryR2">' . GetMessage("WIZ_DELIVERY_R2") . '</label>
</div>';
}
if ($arAutoDeliveries["rus_post_first"] != "Y") {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[rus_post_first]', 'Y', array("id" => "deliveryRF")) . ' <label for="deliveryRF">' . GetMessage("WIZ_DELIVERY_RF") . '</label>
</div>';
}
} elseif ($shopLocalization == "ua") {
if ($arAutoDeliveries["ua_post"] != "Y") {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[ua_post]', 'Y', array("id" => "deliveryU")) . ' <label for="deliveryU">' . GetMessage("WIZ_DELIVERY_UA") . '</label>
</div>';
}
} elseif ($shopLocalization == "kz") {
if ($arAutoDeliveries["kaz_post"] != "Y") {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[kaz_post]', 'Y', array("id" => "deliveryK")) . ' <label for="deliveryK">' . GetMessage("WIZ_DELIVERY_KZ") . '</label>
</div>';
}
}
} else {
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[dhl]', 'Y', array("id" => "deliveryD")) . ' <label for="deliveryD">DHL</label>
</div>';
$this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[ups]', 'Y', array("id" => "deliveryU")) . ' <label for="deliveryU">UPS</label>
</div>';
}
//.........这里部分代码省略.........
示例9: isset
if (isset($order['summ']) === false || $order['summ'] <= 0) {
$order['summ'] = $arFields['PRICE'] - $arFields['PRICE_DELIVERY'];
}
$wasCanaceled = $arFields['CANCELED'] == 'Y' ? true : false;
if (isset($optionsDelivTypes[$order['delivery']['code']])) {
$resultDeliveryTypeId = $optionsDelivTypes[$order['delivery']['code']];
} else {
$resultDeliveryTypeId = isset($order['delivery']['service']) && isset($order['delivery']['service']['code']) ?
reset(explode(":", $arFields['DELIVERY_ID'], 1)) :
$arFields['DELIVERY_ID'];
}
if(isset($order['delivery']['service']) && isset($order['delivery']['service']['code'])) {
$deliveryHandler = reset(CSaleDeliveryHandler::GetBySID($resultDeliveryTypeId)->arResult);
if (count($deliveryHandler) > 0 && array_key_exists($order['delivery']['service']['code'], $deliveryHandler['PROFILES'])) {
$resultDeliveryTypeId = $resultDeliveryTypeId . ':' . $order['delivery']['service']['code'];
}
}
// orderUpdate
$arFields = ICrmOrderActions::clearArr(array(
'PRICE_DELIVERY' => $order['delivery']['cost'],
'PRICE' => $order['summ'] + (double) $order['delivery']['cost'],
'DATE_MARKED' => $order['markDatetime'],
'USER_ID' => $userId,
'PAY_SYSTEM_ID' => $optionsPayTypes[$order['paymentType']],
'DELIVERY_ID' => $resultDeliveryTypeId,
'STATUS_ID' => $optionsPayStatuses[$order['status']],
'REASON_CANCELED' => ICrmOrderActions::fromJSON($order['statusComment']),
示例10: 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;
}
示例11: CSaleDeliveryHandler
if ($saleModulePermissions >= "W")
$fieldValue .= "</a>";
$fieldValue .= "] ".$LOCAL_PAY_SYSTEM_CACHE[$arOrder["PAY_SYSTEM_ID"]];
}
}
$row->AddField("PAY_SYSTEM", $fieldValue);
$fieldValue = "";
if (in_array("DELIVERY", $arVisibleColumns))
{
if (strpos($arOrder["DELIVERY_ID"], ":") !== false)
{
if (!isset($obDelivery))
{
$obDelivery = new CSaleDeliveryHandler();
$obDelivery->GetList(array("SITE_ID" => "ASC"), array("SITE_ID" => "ALL", "ACTIVE" => "ALL"));
}
$arId = explode(":", $arOrder["DELIVERY_ID"]);
$rsDelivery = CSaleDeliveryHandler::GetBySID($arId[0]);
$arDelivery = $rsDelivery->Fetch();
$fieldValue .= "[";
if ($saleModulePermissions >= "W")
$fieldValue .= '<a href="/bitrix/admin/sale_delivery_handler_edit.php?SID='.$arId[0].'&lang='.LANGUAGE_ID.'">';
$fieldValue .= $arOrder["DELIVERY_ID"];
if ($saleModulePermissions >= "W")
$fieldValue .= "</a>";
示例12: CheckFields
//.........这里部分代码省略.........
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["USER_ID"], GetMessage("SKGO_WRONG_USER")), "ERROR_NO_USER_ID");
return false;
}
}
if (is_set($arFields, "PERSON_TYPE_ID"))
{
if (!($arPersonType = CSalePersonType::GetByID($arFields["PERSON_TYPE_ID"])))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PERSON_TYPE_ID"], GetMessage("SKGO_WRONG_PERSON_TYPE")), "ERROR_NO_PERSON_TYPE");
return false;
}
}
if (is_set($arFields, "PAY_SYSTEM_ID") && IntVal($arFields["PAY_SYSTEM_ID"]) > 0)
{
if (!($arPaySystem = CSalePaySystem::GetByID(IntVal($arFields["PAY_SYSTEM_ID"]))))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PAY_SYSTEM_ID"], GetMessage("SKGO_WRONG_PS")), "ERROR_NO_PAY_SYSTEM");
return false;
}
}
if (is_set($arFields, "DELIVERY_ID") && (
strpos($arFields["DELIVERY_ID"], ":") !== false
||
IntVal($arFields["DELIVERY_ID"]) > 0
)
)
{
if (strpos($arFields["DELIVERY_ID"], ":") !== false)
{
$arId = explode(":", $arFields["DELIVERY_ID"]);
$obDelivery = new CSaleDeliveryHandler();
if ($arDelivery = $obDelivery->GetBySID($arId[0]))
{
if ($arDelivery = $arDelivery->Fetch())
{
if (!is_set($arDelivery["PROFILES"], $arId[1]))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
return false;
}
}
}
else
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
return false;
}
}
else
{
if (!($arDelivery = CSaleDelivery::GetByID(IntVal($arFields["DELIVERY_ID"]))))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
return false;
}
}
}
if (is_set($arFields, "STATUS_ID"))
{
if (!($arStatus = CSaleStatus::GetByID($arFields["STATUS_ID"])))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["STATUS_ID"], GetMessage("SKGO_WRONG_STATUS")), "ERROR_NO_STATUS_ID");
示例13: array
:
</td>
<td width="60%">
<select multiple="multiple" size="5" name="DELIVERY_HANDLERS[]">
<?php
$arDeliveryId = array();
$arDeliverySid = array();
$dbRes = CSaleDelivery2PaySystem::GetList(array("PAYSYSTEM_ID" => $ID));
while ($arRes = $dbRes->Fetch()) {
$deliveryId = $arRes["DELIVERY_ID"];
if (isset($arRes["DELIVERY_PROFILE_ID"]) && strlen($arRes["DELIVERY_PROFILE_ID"]) > 0) {
$deliveryId .= ":" . $arRes["DELIVERY_PROFILE_ID"];
}
$arDeliveryId[] = $deliveryId;
}
$rsDeliveryServicesList = CSaleDeliveryHandler::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array());
$arDeliveryServicesList = array();
while ($arDeliveryService = $rsDeliveryServicesList->Fetch()) {
if (!is_array($arDeliveryService) || !is_array($arDeliveryService["PROFILES"])) {
continue;
}
foreach ($arDeliveryService["PROFILES"] as $profile_id => $arDeliveryProfile) {
$delivery_id = $arDeliveryService["SID"] . ":" . $profile_id;
?>
<option
value="<?php
echo htmlspecialcharsbx($delivery_id);
?>
"
<?php
if (is_array($arDeliveryId) && (in_array($delivery_id, $arDeliveryId) || in_array($arDeliveryService["SID"], $arDeliveryId) || empty($arDeliveryId))) {
示例14: execHandlerAction
public static function execHandlerAction($orderId, $actionId)
{
global $DB, $USER;
$arResult = array();
$arOrder = CSaleOrder::GetById($orderId);
$handlerActions = CSaleDeliveryHandler::getActionsList($arOrder["DELIVERY_ID"]);
if (!array_key_exists($actionId, $handlerActions)) {
$arResult = array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DHLP_HANDLER_HAS_NO_ACTION"));
}
$dt = new \Bitrix\Main\Type\DateTime();
$depList = \Bitrix\Sale\Internals\OrderDeliveryReqTable::getList(array('filter' => array('=ORDER_ID' => $orderId)));
$dep = $depList->fetch();
if ($dep && !is_null($dep["DATE_REQUEST"])) {
$arResult = array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DHLP_HANDLER_REQUEST_ALREADY_SENT"));
}
if (empty($arResult)) {
$arUserGroups = $USER->GetUserGroupArray();
$arOrder["ITEMS"] = array();
$dbItemsList = CSaleBasket::GetList(array("SET_PARENT_ID" => "DESC", "TYPE" => "DESC", "NAME" => "ASC"), array("ORDER_ID" => $orderId));
while ($arItem = $dbItemsList->GetNext()) {
$arItem["DIMENSIONS"] = unserialize($arItem["~DIMENSIONS"]);
unset($arItem["~DIMENSIONS"]);
$arOrder["ITEMS"][] = $arItem;
}
$arResult = CSaleDeliveryHandler::executeAction($arOrder["DELIVERY_ID"], $actionId, $arOrder);
if ($actionId == "REQUEST_SELF" && isset($arResult["TRACKING_NUMBER"])) {
$bUserCanEditOrder = CSaleOrder::CanUserUpdateOrder($orderId, $arUserGroups);
if ($bUserCanEditOrder) {
if ($dep) {
\Bitrix\Sale\Internals\OrderDeliveryReqTable::update($dep["ID"], array("DATE_REQUEST" => $dt));
} else {
\Bitrix\Sale\Internals\OrderDeliveryReqTable::add(array("ORDER_ID" => $orderId, "DATE_REQUEST" => $dt));
}
$fields = array();
if (isset($arResult["TRACKING_NUMBER"])) {
$fields["TRACKING_NUMBER"] = $arResult["TRACKING_NUMBER"];
}
if (isset($arResult["DELIVERY_DOC_NUM"])) {
$fields["DELIVERY_DOC_NUM"] = $arResult["DELIVERY_DOC_NUM"];
$fields["DELIVERY_DOC_DATE"] = Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", $arOrder["LID"])));
}
CSaleOrder::Update($orderId, $fields);
}
}
CSaleOrderChange::AddRecord($orderId, "ORDER_DELIVERY_REQUEST_SENT", $arResult);
}
return $arResult;
}
示例15: FormatOrderDeliverySystemChanged
public static function FormatOrderDeliverySystemChanged($arData)
{
$info = GetMessage("SOC_ORDER_DELIVERY_SYSTEM_CHANGED_INFO");
foreach ($arData as $param => $value) {
if ($param == "DELIVERY_ID") {
if (strpos($value, ":") !== false) {
$arId = explode(":", $value);
$dbDelivery = CSaleDeliveryHandler::GetBySID($arId[0]);
$arDelivery = $dbDelivery->Fetch();
$value = "\"" . htmlspecialcharsEx($arDelivery["NAME"]) . "\"";
} elseif (intval($value) > 0) {
$arDelivery = CSaleDelivery::GetByID($value);
$value = "\"" . $arDelivery["NAME"] . "\"";
}
}
$info = str_replace("#" . $param . "#", $value, $info);
}
return array("NAME" => GetMessage("SOC_ORDER_DELIVERY_SYSTEM_CHANGED"), "INFO" => $info);
}