本文整理汇总了PHP中CSaleDelivery类的典型用法代码示例。如果您正苦于以下问题:PHP CSaleDelivery类的具体用法?PHP CSaleDelivery怎么用?PHP CSaleDelivery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSaleDelivery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDelivery
public static function getDelivery($id = false)
{
static $result = null;
static $resultById = null;
if($result === null)
{
$rs = \CSaleDelivery::GetList(array(), array(), false, false, array('ID', 'NAME'));
while($ar = $rs->GetNext(true, false))
{
$obj = new Delivery($ar);
$resultById[ $ar['ID'] ] = &$obj;
$result[] = &$obj;
unset($obj);
}
}
return $id ? (isset($resultById[$id]) ? $resultById[$id] : false) : $result;
}
示例2: DoProcessOrder
public static function DoProcessOrder(&$arOrder, $arOptions, &$arErrors)
{
if (empty($arOrder['BASKET_ITEMS']) || !is_array($arOrder['BASKET_ITEMS'])) {
return;
}
$isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
$oldDelivery = '';
$checkIds = true;
$arIDS = array();
if ($isOrderConverted == 'Y') {
if (isset($arOrder['DELIVERY_ID']) && $arOrder['DELIVERY_ID'] != '') {
$oldDelivery = $arOrder['DELIVERY_ID'];
$arOrder['DELIVERY_ID'] = \CSaleDelivery::getIdByCode($arOrder['DELIVERY_ID']);
}
$adminSection = defined('ADMIN_SECTION') && ADMIN_SECTION === true;
if (!$adminSection) {
$mode = Sale\Compatible\DiscountCompatibility::MODE_MANAGER;
$modeParams = array();
if (isset($arOrder['CURRENCY'])) {
$modeParams['CURRENCY'] = $arOrder['CURRENCY'];
}
if (isset($arOrder['SITE_ID'])) {
$modeParams['SITE_ID'] = $arOrder['SITE_ID'];
if (!isset($modeParams['CURRENCY'])) {
$modeParams['CURRENCY'] = Sale\Internals\SiteCurrencyTable::getSiteCurrency($modeParams['SITE_ID']);
}
}
} else {
$mode = Sale\Compatible\DiscountCompatibility::MODE_CLIENT;
$modeParams = array('SITE_ID' => SITE_ID, 'CURRENCY' => Sale\Internals\SiteCurrencyTable::getSiteCurrency(SITE_ID));
}
unset($adminSection);
if (!empty($modeParams)) {
Sale\Discount\Actions::setUseMode(Sale\Discount\Actions::MODE_CALCULATE, array('USE_BASE_PRICE' => \Bitrix\Main\Config\Option::get('sale', 'get_discount_percent_from_base_price'), 'SITE_ID' => $modeParams['SITE_ID'], 'CURRENCY' => $modeParams['CURRENCY']));
}
if (!Sale\Compatible\DiscountCompatibility::isInited()) {
if (!empty($modeParams)) {
Sale\Compatible\DiscountCompatibility::init($mode, $modeParams);
}
}
unset($modeParams, $mode);
Sale\Compatible\DiscountCompatibility::clearDiscountResult();
Sale\Compatible\DiscountCompatibility::fillBasketData($arOrder['BASKET_ITEMS']);
Sale\Compatible\DiscountCompatibility::calculateBasketDiscounts($arOrder['BASKET_ITEMS']);
Sale\Compatible\DiscountCompatibility::setApplyMode($arOrder['BASKET_ITEMS']);
$applyMode = Sale\Discount::getApplyMode();
if ($applyMode == Sale\Discount::APPLY_MODE_FULL_LAST || $applyMode == Sale\Discount::APPLY_MODE_FULL_DISABLE) {
foreach ($arOrder['BASKET_ITEMS'] as &$basketItem) {
if (isset($basketItem['LAST_DISCOUNT']) && $basketItem['LAST_DISCOUNT'] == 'Y') {
$checkIds = false;
break;
}
}
unset($basketItem);
}
}
if ($checkIds) {
$groupDiscountIterator = Sale\Internals\DiscountGroupTable::getList(array('select' => array('DISCOUNT_ID'), 'filter' => array('@GROUP_ID' => CUser::GetUserGroup($arOrder['USER_ID']), '=ACTIVE' => 'Y')));
while ($groupDiscount = $groupDiscountIterator->fetch()) {
$groupDiscount['DISCOUNT_ID'] = (int) $groupDiscount['DISCOUNT_ID'];
if ($groupDiscount['DISCOUNT_ID'] > 0) {
$arIDS[$groupDiscount['DISCOUNT_ID']] = true;
}
}
}
if (!empty($arIDS)) {
$arIDS = array_keys($arIDS);
$couponList = Sale\DiscountCouponsManager::getForApply(array('MODULE_ID' => 'sale', 'DISCOUNT_ID' => $arIDS), array(), true);
//TODO: fix this condition
$useProps = true;
$iblockPropList = array();
$entityList = Sale\Internals\DiscountEntitiesTable::getByDiscount($arIDS, array('=MODULE_ID' => 'catalog', '=ENTITY' => 'ELEMENT_PROPERTY'));
if (empty($entityList)) {
$useProps = false;
} else {
if (empty($entityList['catalog']['ELEMENT_PROPERTY'])) {
$useProps = false;
} else {
foreach ($entityList['catalog']['ELEMENT_PROPERTY'] as $entity) {
$entityField = explode(':', $entity['FIELD_TABLE']);
if (isset($entityField[1])) {
$propId = (int) $entityField[1];
if ($propId > 0) {
$iblockPropList[$propId] = $propId;
}
unset($propId);
}
unset($entityField);
}
unset($entity);
if (empty($iblockPropList)) {
$useProps = false;
}
}
}
$arExtend = array('catalog' => array('fields' => true, 'props' => $useProps));
if ($useProps) {
$arExtend['iblock']['props'] = $iblockPropList;
}
unset($iblockPropList, $useProps);
//.........这里部分代码省略.........
示例3: obtainDataReferences
/**
* Function returns reference data as shared cache between this component and sale.personal.order.list.
*
* @throws Exception
* @return void
*/
protected function obtainDataReferences()
{
if ($this->startCache(array('spo-shared'))) {
try {
$cachedData = array();
/////////////////////
/////////////////////
// Person type
$dbPType = CSalePersonType::GetList(array("SORT" => "ASC"));
while ($arPType = $dbPType->Fetch()) {
$cachedData['PERSON_TYPE'][$arPType["ID"]] = $arPType;
}
// Save statuses for Filter form
$dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
while ($arStatus = $dbStatus->Fetch()) {
$cachedData['STATUS'][$arStatus["ID"]] = $arStatus;
}
$dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"));
while ($arPaySystem = $dbPaySystem->Fetch()) {
$cachedData['PAYSYS'][$arPaySystem["ID"]] = $arPaySystem;
}
$dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"));
while ($arDelivery = $dbDelivery->Fetch()) {
$cachedData['DELIVERY'][$arDelivery["ID"]] = $arDelivery;
}
$dbDelivery = CSaleDeliveryHandler::GetList(array(), array(array("SITE_ID" => SITE_ID)));
while ($arDeliveryHandler = $dbDelivery->Fetch()) {
$cachedData['DELIVERY_HANDLERS'][$arDeliveryHandler["SID"]] = $arDeliveryHandler;
}
/////////////////////
/////////////////////
} catch (Exception $e) {
$this->abortCache();
throw $e;
}
$this->endCache($cachedData);
} else {
$cachedData = $this->getCacheData();
}
$this->dbResult = array_merge($this->dbResult, $this->adaptCachedReferences($cachedData));
}
示例4: 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 {
//.........这里部分代码省略.........
示例5: array
if (IntVal($locationGroupID) > 0) {
$arLocation4Delivery[] = array("LOCATION_ID" => $locationGroupID, "LOCATION_TYPE" => "G");
}
$dbDelivery = CSaleDelivery::GetList(array(), array("LID" => WIZARD_SITE_ID));
if (!$dbDelivery->Fetch()) {
//delivery handler
$arFields = array("NAME" => GetMessage("SALE_WIZARD_COUR"), "LID" => WIZARD_SITE_ID, "PERIOD_FROM" => 0, "PERIOD_TO" => 0, "PERIOD_TYPE" => "D", "WEIGHT_FROM" => 0, "WEIGHT_TO" => 0, "ORDER_PRICE_FROM" => 0, "ORDER_PRICE_TO" => 0, "ORDER_CURRENCY" => $defCurrency, "ACTIVE" => "Y", "PRICE" => $bRus ? "500" : "30", "CURRENCY" => $defCurrency, "SORT" => 100, "DESCRIPTION" => GetMessage("SALE_WIZARD_COUR_DESCR"), "LOCATIONS" => $arLocation4Delivery);
if ($delivery["courier"] != "Y") {
$arFields["ACTIVE"] = "N";
}
CSaleDelivery::Add($arFields);
$arFields = array("NAME" => GetMessage("SALE_WIZARD_COUR1"), "LID" => WIZARD_SITE_ID, "PERIOD_FROM" => 0, "PERIOD_TO" => 0, "PERIOD_TYPE" => "D", "WEIGHT_FROM" => 0, "WEIGHT_TO" => 0, "ORDER_PRICE_FROM" => 0, "ORDER_PRICE_TO" => 0, "ORDER_CURRENCY" => $defCurrency, "ACTIVE" => "Y", "PRICE" => 0, "CURRENCY" => $defCurrency, "SORT" => 200, "DESCRIPTION" => GetMessage("SALE_WIZARD_COUR1_DESCR"), "LOCATIONS" => $arLocation4Delivery);
if ($delivery["self"] != "Y") {
$arFields["ACTIVE"] = "N";
}
CSaleDelivery::Add($arFields);
}
$dbDelivery = CSaleDeliveryHandler::GetList();
if (!$dbDelivery->Fetch()) {
if ($bRus) {
$arFields = array("LID" => "", "ACTIVE" => "N", "HID" => "cpcr", "NAME" => GetMessage("SALE_WIZARD_SPSR"), "SORT" => 100, "DESCRIPTION" => GetMessage("SALE_WIZARD_SPSR_DESCR"), "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_cpcr.php", "SETTINGS" => "8", "PROFILES" => "", "TAX_RATE" => 0);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif")) {
$arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif");
}
CSaleDeliveryHandler::Set("cpcr", $arFields);
$arFields = array("LID" => "", "ACTIVE" => "Y", "HID" => "russianpost", "NAME" => GetMessage("SALE_WIZARD_MAIL"), "SORT" => 200, "DESCRIPTION" => "", "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_russianpost.php", "SETTINGS" => "23", "PROFILES" => "", "TAX_RATE" => 0);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif")) {
$arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif");
}
if ($delivery["russianpost"] != "Y") {
$arFields["ACTIVE"] = "N";
示例6: fGetDeliverySystemsHTML
function fGetDeliverySystemsHTML($location, $locationZip, $weight, $price, $currency, $siteId, $defaultDelivery, $arShoppingCart)
{
$arResult = array();
$description = "";
$error = "";
$setDeliveryPrice = false;
$arDelivery = CSaleDelivery::DoLoadDelivery($location, $locationZip, $weight, $price, $currency, $siteId, $arShoppingCart);
$deliveryHTML = "<select name=\"DELIVERY_ID\" id=\"DELIVERY_ID\" onchange=\"fChangeDelivery();\">";
$deliveryHTML .= "<option value=\"\">".GetMessage('NEWO_DELIVERY_NO')."</option>";
if (count($arDelivery) > 0)
{
foreach($arDelivery as $val)
{
if (isset($val["PROFILES"]))
{
foreach($val["PROFILES"] as $k => $v)
{
$currency = $v["CURRENCY"];
$selected = "";
if ($v["ID"] == $defaultDelivery)
{
$selected = " selected=\"selected\"";
if (floatval($v["DELIVERY_PRICE"]) <= 0)
{
$error = "<div class='error'>".GetMessage('NEWO_DELIVERY_ERR')."</div>";
$v["DELIVERY_PRICE"] = 0;
$val["DESCRIPTION"] = "";
}
$price = $v["DELIVERY_PRICE"];
$description = $val["DESCRIPTION"];
$setDeliveryPrice = true;
}
$deliveryHTML .= "<option".$selected." value=\"".$v["ID"]."\">".$val["TITLE"]." (".$v["TITLE"].") [".$v["ID"]."]</option>";
}
}
else
{
$currency = $val["CURRENCY"];
$selected = "";
if ($val["ID"] == $defaultDelivery)
{
$selected = " selected=\"selected\"";
$price = $val["PRICE"];
$setDeliveryPrice = true;
$description = $val["DESCRIPTION"];
}
$deliveryHTML .= "<option".$selected." value=\"".$val["ID"]."\">".$val["NAME"]." [".$val["ID"]."]</option>";
}
}
}
$deliveryHTML .= "</select>";
$arResult["DELIVERY"] = $deliveryHTML;
$arResult["DELIVERY_DEFAULT"] = $defaultDelivery;
$arResult["DELIVERY_DEFAULT_PRICE"] = (count($arDelivery) > 0 && $setDeliveryPrice === true) ? $price : 0;
$arResult["DELIVERY_DEFAULT_DESCRIPTION"] = $description;
$arResult["DELIVERY_DEFAULT_ERR"] = $error;
$arResult["CURRENCY"] = $currency;
return $arResult;
}
示例7: array
<span id="allow_delivery_name">
<?
$arDeliveryName = array();
$arDeliveryData = array();
if (strpos($arOrder["DELIVERY_ID"], ":") !== false)
{
$arDeliveryName = explode(":", $arOrder["DELIVERY_ID"]);
$dbDelivery = CSaleDeliveryHandler::GetBySID($arDeliveryName[0]);
$arDeliveryData = $dbDelivery->Fetch();
echo "[".$arDeliveryData["SID"]."] ".htmlspecialcharsEx($arDeliveryData["NAME"])." (".$arOrder["LID"].")";
}
elseif (intval($arOrder["DELIVERY_ID"]) > 0)
{
$arDeliveryData = CSaleDelivery::GetByID($arOrder["DELIVERY_ID"]);
echo htmlspecialcharsbx($arDeliveryData["NAME"]);
}
else
echo GetMessage("SOD_NONE");
?>
</span>
</td>
</tr>
<?
if (!empty($arDeliveryName)):
?>
<tr>
<td><?php
echo GetMessage("SOD_DELIVERY_SERVICE_NAME");
?>
示例8: getDeliveriesInfo
public static function getDeliveriesInfo($arDeliveryIds)
{
if (!is_array($arDeliveryIds)) {
return false;
}
static $arDeliveries = array();
$arTmpSD = array();
foreach ($arDeliveryIds as $deliveryId) {
if (!$deliveryId || is_null($deliveryId)) {
continue;
}
if (!isset($arDeliveries[$deliveryId])) {
if (strpos($deliveryId, ":") !== false) {
$arId = explode(":", $deliveryId);
$dbDelivery = CSaleDeliveryHandler::GetList(array(), array("SID" => $arId[0]));
if ($arDelivery = $dbDelivery->Fetch()) {
$arDeliveries[$deliveryId] = htmlspecialcharsEx($arDelivery["NAME"]);
if (strlen($arId[1]) > 0 && isset($arDelivery["PROFILES"][$arId[1]]["TITLE"])) {
$arDeliveries[$deliveryId] .= " / " . htmlspecialcharsEx($arDelivery["PROFILES"][$arId[1]]["TITLE"]);
}
}
} else {
$arTmpSD[] = $deliveryId;
}
}
}
if (is_array($arTmpSD)) {
$dbDelivery = CSaleDelivery::GetList(array(), array("ID" => $arTmpSD), false, false, array("ID", "NAME"));
while ($arDelivery = $dbDelivery->Fetch()) {
$arDeliveries[$arDelivery["ID"]] = htmlspecialcharsbx($arDelivery["NAME"]);
}
}
return $arDeliveries;
}
示例9: 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="<?echo htmlspecialcharsbx($delivery_id)?>"<?if (is_array($filter_delivery) && in_array($delivery_id, $filter_delivery)) echo " selected"?>>[<?echo htmlspecialcharsbx($delivery_id)?>] <?echo htmlspecialcharsbx($arDeliveryService["NAME"].": ".$arDeliveryProfile["TITLE"])?></option><?
}
}
/*Old Delivery*/
$dbDelivery = CSaleDelivery::GetList(
array("SORT"=>"ASC", "NAME"=>"ASC"),
array(
"ACTIVE" => "Y",
)
);
while ($arDelivery = $dbDelivery->GetNext())
{
?><option value="<?echo $arDelivery["ID"]?>"<?if (is_array($filter_delivery) && in_array($arDelivery["ID"], $filter_delivery)) echo " selected"?>>[<?echo $arDelivery["ID"]?>] <?echo $arDelivery["NAME"]?></option><?
}
?>
</select>
</td>
</tr>
<tr>
<td><?echo GetMessage("SALE_F_CANCELED")?>:</td>
<td>
<select name="filter_canceled">
示例10: getDeliveryOptions
protected function getDeliveryOptions($delivery, $price, $weight = 0)
{
$arResult = array();
$locationId = $this->locationMapper->getLocationByCityName($delivery["region"]["name"]);
if ($locationId > 0) {
foreach ($this->mapDelivery as $deliveryId => $deliveryType) {
if ($deliveryType == "") {
continue;
}
$filter = array("ID" => $deliveryId, "LID" => $this->siteId, "ACTIVE" => "Y", "LOCATION" => $locationId, "+<=ORDER_PRICE_FROM" => $price, "+>=ORDER_PRICE_TO" => $price);
if (intval($weight) > 0) {
$filter["+<=WEIGHT_FROM"] = $weight;
$filter["+>=WEIGHT_TO"] = $weight;
}
$dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC", "NAME" => "ASC"), $filter);
if ($arDelivery = $dbDelivery->Fetch()) {
$arDates = $this->getDeliveryDates($arDelivery["PERIOD_FROM"], $arDelivery["PERIOD_TO"], $arDelivery["PERIOD_TYPE"]);
if (!empty($arDates)) {
$arDeliveryTmp = array("id" => $arDelivery["ID"], "type" => $deliveryType, "serviceName" => substr($arDelivery["NAME"], 0, 50), "price" => round(floatval($arDelivery["PRICE"]), 2), "dates" => $arDates);
if ($deliveryType == "PICKUP" && !empty($this->outlets)) {
foreach ($this->outlets as $outlet) {
$arDeliveryTmp["outlets"][] = array("id" => intval($outlet));
}
}
$arResult[] = $arDeliveryTmp;
}
}
}
}
return $arResult;
}
示例11: Add
/**
* <p>Функция добавляет новый способ (службу) доставки с параметрами из массива arFields.</p>
*
*
*
*
* @param array $arFields Ассоциативный массив параметров доставки, ключами в котором
* являются названия параметров доставки, а значениями - значения
* параметров. <br><br> Допустимые ключи: <br><ul> <li> <b>NAME</b> - название
* доставки (обязательное, задается на языке сайта, к которому
* привязана эта доставка);</li> <li> <b>LID</b> - код сайта, к которому
* привязана эта доставка;</li> <li> <b>PERIOD_FROM</b> - минимальный срок
* доставки;</li> <li> <b>PERIOD_TO</b> - максимальный срок доставки;</li> <li>
* <b>PERIOD_TYPE</b> - единица измерения срока: D - дни, H - часы, M - месяцы;</li> <li>
* <b>WEIGHT_FROM</b> - минимальный вес заказа, для которого возможна эта
* доставка (единица измерения должна быть едина на сайте);</li> <li>
* <b>WEIGHT_TO</b> - максимальный вес заказа, для которого возможна эта
* доставка (единица измерения должна быть едина на сайте);</li> <li>
* <b>ORDER_PRICE_FROM</b> - минимальная стоимость заказа, для которой возможна
* эта доставка;</li> <li> <b>ORDER_PRICE_TO</b> - максимальная стоимость заказа,
* для которой возможна эта доставка;</li> <li> <b>ORDER_CURRENCY</b> - валюта
* ограничений по стоимости;</li> <li> <b>ACTIVE</b> - флаг (Y/N) активности
* доставки;</li> <li> <b>PRICE</b> - стоимость доставки;</li> <li> <b>CURRENCY</b> - валюта
* стоимости доставки;</li> <li> <b>SORT</b> - индекс сортировки;</li> <li>
* <b>DESCRIPTION</b> - описание доставки;</li> <li> <b>LOCATIONS</b> - массив массивов
* вида: <pre class="syntax">array("LOCATION_ID" => "код местоположения или <br> группы
* местоположений",<br> "LOCATION_TYPE"=>"L - для местоположения, <br> G - для
* группы")</pre> содержащий местоположения и группы местоположений,
* для которых работает эта доставка</li> </ul>
*
*
*
* @return int <p>Возвращает код добавленной записи или <i>false</i> в случае
* ошибки.</p><a name="examples"></a>
*
*
* <h4>Example</h4>
* <pre>
* <?<br>$arFields = array(<br> "NAME" => "Доставка курьером",<br> "LID" => "ru",<br> "PERIOD_FROM" => 1,<br> "PERIOD_TO" => 3,<br> "PERIOD_TYPE" => "D",<br> "WEIGHT_FROM" => 0,<br> "WEIGHT_TO" => 2500,<br> "ORDER_PRICE_FROM" => 0,<br> "ORDER_PRICE_TO" => 10000,<br> "ORDER_CURRENCY" => "RUB",<br> "ACTIVE" => "Y",<br> "PRICE" => 58,<br> "CURRENCY" => "RUB",<br> "SORT" => 100,<br> "DESCRIPTION" => "Заказ будет доставлен Вам в течение 3 - 10 рабочих дней после передачи его в курьерскую службу.",<br> "LOCATIONS" => array(<br> array("LOCATION_ID"=>1, "LOCATION_TYPE"=>"L"),<br> array("LOCATION_ID"=>3, "LOCATION_TYPE"=>"G")<br> )<br>);<br><br>$ID = CSaleDelivery::Add($arFields);<br>if ($ID<=0)<br> echo "Ошибка добавления доставки";<br>?><br>
* </pre>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/sale/classes/csaledelivery/csaledelivery__add.564001a4.php
* @author Bitrix
*/
public static function Add($arFields)
{
global $DB;
if (!CSaleDelivery::CheckFields("ADD", $arFields))
return false;
if (array_key_exists("LOGOTIP", $arFields) && is_array($arFields["LOGOTIP"]))
$arFields["LOGOTIP"]["MODULE_ID"] = "sale";
CFile::SaveForDB($arFields, "LOGOTIP", "sale/delivery/logotip");
$arInsert = $DB->PrepareInsert("b_sale_delivery", $arFields);
$strSql =
"INSERT INTO b_sale_delivery(".$arInsert[0].") ".
"VALUES(".$arInsert[1].")";
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
$ID = IntVal($DB->LastID());
foreach($arFields["LOCATIONS"] as $location)
{
$arInsert = $DB->PrepareInsert("b_sale_delivery2location", $location);
$strSql =
"INSERT INTO b_sale_delivery2location(DELIVERY_ID, ".$arInsert[0].") ".
"VALUES(".$ID.", ".$arInsert[1].")";
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
}
if (is_set($arFields, "PAY_SYSTEM"))
{
CSaleDelivery::UpdateDeliveryPay($ID, $arFields["PAY_SYSTEM"]);
}
return $ID;
}
示例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: define
<?php
define("NOT_CHECK_PERMISSIONS", true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
__IncludeLang($_SERVER['DOCUMENT_ROOT'] . '/bitrix/components/bitrix/sale.order.ajax/lang/' . LANGUAGE_ID . '/map.php');
CModule::IncludeModule('sale');
CModule::IncludeModule('catalog');
$location = "";
$arStore = array();
$arStoreId = array();
if ($_REQUEST["delivery"]) {
$deliveryId = IntVal($_REQUEST["delivery"]);
$dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"), array("ID" => $deliveryId), false, false, array("ID", "STORE"));
$arDelivery = $dbDelivery->Fetch();
if (count($arDelivery) > 0 && strlen($arDelivery["STORE"]) > 0) {
$arStore = unserialize($arDelivery["STORE"]);
foreach ($arStore as $val) {
$arStoreId[$val] = $val;
}
}
$arStore = array();
$arStoreLocation = array("yandex_scale" => 11, "PLACEMARKS" => array());
$dbList = CCatalogStore::GetList(array("ID" => "DESC"), array("ACTIVE" => "Y", "ID" => $arStoreId), false, false, array("ID", "TITLE", "ADDRESS", "DESCRIPTION", "IMAGE_ID", "PHONE", "SCHEDULE", "GPS_N", "GPS_S"));
while ($arStoreTmp = $dbList->Fetch()) {
$arStore[$arStoreTmp["ID"]] = $arStoreTmp;
if (floatval($arStoreLocation["yandex_lat"]) <= 0) {
$arStoreLocation["yandex_lat"] = $arStoreTmp["GPS_N"];
}
if (floatval($arStoreLocation["yandex_lon"]) <= 0) {
$arStoreLocation["yandex_lon"] = $arStoreTmp["GPS_S"];
}
示例14: getDeliveryList
/**
* @param string $siteId Site id.
* @return array List of diliveries for given site.
*/
public static function getDeliveryList($siteId)
{
$arDeliveryFilter = array("LID" => $siteId, "ACTIVE" => "Y");
$dbDeliveryList = \CSaleDelivery::GetList(array("NAME" => "ASC"), $arDeliveryFilter, false, false, array("ID", "NAME"));
$arDeliveryList = array();
while ($arDelivery = $dbDeliveryList->Fetch()) {
$arDeliveryList[$arDelivery["ID"]] = $arDelivery["NAME"];
}
return $arDeliveryList;
}
示例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);
}