本文整理汇总了PHP中CCatalog::IsUserExists方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalog::IsUserExists方法的具体用法?PHP CCatalog::IsUserExists怎么用?PHP CCatalog::IsUserExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalog
的用法示例。
在下文中一共展示了CCatalog::IsUserExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductById
/**
* Wraps Product Provider Class::GetProductData from module catalog.
* @param int $productId Product Id.
* @param int $quantity Product quantity.
* @param string $siteId Site id.
* @return array.
* @throws \Bitrix\Main\SystemException
*/
public static function getProductById($productId, $quantity, $siteId)
{
$result = array();
if (\CModule::IncludeModule('catalog')) {
if ($productProvider = \CSaleBasket::GetProductProvider(array("MODULE" => "catalog", "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider"))) {
global $USER;
$bTmpUserCreated = false;
if (!\CCatalog::IsUserExists()) {
$bTmpUserCreated = true;
if (isset($USER)) {
$USER_TMP = $USER;
unset($USER);
}
$USER = new \CUser();
}
$result = $productProvider::GetProductData(array("PRODUCT_ID" => $productId, "RENEWAL" => "N", "QUANTITY" => $quantity, "SITE_ID" => $siteId));
$result["MODULE"] = "catalog";
$result["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
$dbIblockElement = \CIBlockElement::GetList(array(), array("ID" => $productId), false, false, array('XML_ID', 'IBLOCK_EXTERNAL_ID'));
if ($IblockElement = $dbIblockElement->Fetch()) {
if (strlen($IblockElement["XML_ID"]) > 0) {
$result["PRODUCT_XML_ID"] = $IblockElement["XML_ID"];
}
if (strlen($IblockElement["IBLOCK_EXTERNAL_ID"]) > 0) {
$result["CATALOG_XML_ID"] = $IblockElement["IBLOCK_EXTERNAL_ID"];
}
}
if ($bTmpUserCreated) {
unset($USER);
if (isset($USER_TMP)) {
$USER = $USER_TMP;
unset($USER_TMP);
}
}
}
} else {
throw new \Bitrix\Main\SystemException("Can't include module \"Catalog\"!");
}
return $result;
}
示例2: GetDiscount
public function GetDiscount($arParams = array(), $getAll = false)
{
global $DB, $USER;
$adminSection = defined('ADMIN_SECTION') && ADMIN_SECTION === true;
$arResult = array();
if (!CCatalog::IsUserExists() || !$USER->IsAuthorized() || !self::IsEnabled()) {
return $arResult;
}
foreach (GetModuleEvents("catalog", "OnGetDiscountSave", true) as $arEvent) {
$mxResult = ExecuteModuleEventEx($arEvent, $arParams);
if ($mxResult !== true) {
return $mxResult;
}
}
if (empty($arParams) || !is_array($arParams)) {
return $arResult;
}
$intUserID = 0;
$arUserGroups = array();
$strSiteID = false;
if (isset($arParams['USER_ID'])) {
$intUserID = (int) $arParams['USER_ID'];
}
if (isset($arParams['USER_GROUPS'])) {
$arUserGroups = $arParams['USER_GROUPS'];
}
if (isset($arParams['SITE_ID'])) {
$strSiteID = $arParams['SITE_ID'];
}
if (self::GetDiscountUserID() > 0) {
$intUserID = (int) self::GetDiscountUserID();
$arUserGroups = array();
}
if ($intUserID <= 0 && !$adminSection) {
$intUserID = (int) $USER->GetID();
$arUserGroups = array();
}
if (empty($arUserGroups)) {
if (!isset(self::$userGroups[$intUserID])) {
self::$userGroups[$intUserID] = $USER->GetUserGroup($intUserID);
}
$arUserGroups = self::$userGroups[$intUserID];
}
if (empty($arUserGroups) || !is_array($arUserGroups) || $intUserID <= 0) {
return $arResult;
}
$key = array_search(2, $arUserGroups);
if ($key !== false) {
unset($arUserGroups[$key]);
}
if (empty($arUserGroups)) {
return $arResult;
}
Main\Type\Collection::normalizeArrayValuesByInt($arUserGroups, true);
if (empty($arUserGroups)) {
return $arResult;
}
if ($strSiteID === false) {
$strSiteID = SITE_ID;
}
$cacheKey = md5('U' . implode('_', $arUserGroups));
if (!isset(self::$discountFilterCache[$cacheKey])) {
self::$discountFilterCache[$cacheKey] = CCatalogDiscountSave::__GetDiscountIDByGroup($arUserGroups);
}
if (empty(self::$discountFilterCache[$cacheKey])) {
return $arResult;
}
$arCurrentDiscountID = self::$discountFilterCache[$cacheKey];
if (isset($arParams['ID'])) {
Main\Type\Collection::normalizeArrayValuesByInt($arUserGroups, true);
if (!empty($arParams['ID'])) {
$arCurrentDiscountID = array_intersect($arCurrentDiscountID, $arParams['ID']);
}
}
if (!empty($arCurrentDiscountID)) {
$getAll = $getAll === true;
$intCurrentTime = getmicrotime();
$strDate = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCurrentTime);
$arFilter = array('ID' => $arCurrentDiscountID, 'SITE_ID' => $strSiteID, 'TYPE' => self::ENTITY_ID, 'ACTIVE' => 'Y', '+<=ACTIVE_FROM' => $strDate, '+>=ACTIVE_TO' => $strDate);
CTimeZone::Disable();
$rsDiscSaves = CCatalogDiscountSave::GetList(array(), $arFilter);
CTimeZone::Enable();
while ($arDiscSave = $rsDiscSaves->Fetch()) {
$arDiscSave['ACTION_SIZE'] = (int) $arDiscSave['ACTION_SIZE'];
$arDiscSave['COUNT_SIZE'] = (int) $arDiscSave['COUNT_SIZE'];
$arDiscSave['ACTIVE_FROM_UT'] = false;
$arDiscSave['ACTIVE_TO_UT'] = false;
$arDiscSave['COUNT_FROM_UT'] = false;
$arDiscSave['COUNT_TO_UT'] = false;
$arDiscSave['TYPE'] = (int) $arDiscSave['TYPE'];
$arDiscSave['MODULE_ID'] = 'catalog';
$strCountPeriod = self::COUNT_TIME_ALL;
$strActionPeriod = self::ACTION_TIME_ALL;
$arCountPeriodBack = array();
$arActionPeriodBack = array();
$arActionPeriod = array();
$arStartDate = false;
$arOldOrderSumm = false;
$arOrderSumm = false;
$boolPeriodInsert = true;
//.........这里部分代码省略.........
示例3: CheckFields
/**
* <p>Метод служит для проверки (и корректировки, если это возможно) параметров, переданных в методы <a href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/add.php">CCatalogDiscountCoupon::Add</a> и <a href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/update.php">CCatalogDiscountCoupon::Update</a>.</p>
*
*
*
*
* @param string $ACTION указывает, для какого метода идет проверка. Возможные значения:
* <br><ul> <li> <b>ADD</b> - для метода <a
* href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/add.php">CCatalogDiscountCoupon::Add</a>;</li>
* <li> <b>UPDATE</b> - для метода <a
* href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/update.php">CCatalogDiscountCoupon::Update</a>.</li>
* </ul>
*
*
*
* @param array &$arFields Ассоциативный массив параметров купона. Массив передается по
* ссылке и его значения могут быть изменены функцией. <br> Допустимые
* ключи: <ul> <li> <b>DISCOUNT_ID</b> - код (ID) скидки;</li> <li> <b>ACTIVE</b> - флаг
* активности купона (Y/N);</li> <li> <b>ONE_TIME</b> - флаг однократного
* использования купона (Y|N);</li> <li> <b>COUPON</b> - код купона;</li> <li>
* <b>DATE_APPLY</b> - дата применения купона;</li> <li> <b>DESCRIPTION</b> -
* комментарий.</li> </ul>
*
*
*
* @param int $ID = 0 код (ID) купона (только для CCatalogDiscountCoupon::Update). </htm
*
*
*
* @return boolean <p> В случае корректности переданных параметров возвращает true,
* иначе - false. Если функция вернула false, с помощью $APPLICATION->GetException()
* можно получить текст ошибок.</p> <p><b>Обязательные проверки</b></p>
* </htm<ul> <li>для <b>CCatalogDiscountCoupon::Add</b> <ul> <li>поле DISCOUNT_ID присутствует и
* содержит код (ID) существующей скидки;</li> <li>если поле ACTIVE не
* существует или не равно N, ему присваивается значение Y;</li> <li>если
* поле ONE_TIME не существует или не равно N, ему присваивается значение
* Y;</li> <li>поле COUPON существует и содержит уникальный код,
* отсутствующий в списке купонов;</li> <li>если поле DATE_APPLY не
* существует или не содержит корректную дату, ему присваивается
* значение false.</li> </ul> <br> </li> <li>для <b>CCatalogDiscountCoupon::Update</b> <ul> <li>если
* поле DISCOUNT_ID присутствует, оно должно содержать код (ID)
* существующей скидки;</li> <li>если поле ACTIVE существует и не равно N,
* ему присваивается значение Y;</li> <li>если поле ONE_TIME существует и не
* равно N, ему присваивается значение Y;</li> <li>если поле COUPON
* существует, оно содержит уникальный код, заданный только для
* этого купона (с таким ID);</li> <li>если поле DATE_APPLY существует и
* содержит некорректную дату, ему присваивается значение false.</li> </ul>
* </li> </ul>
*
*
* <h4>See Also</h4>
* <ul> <li><a href="http://dev.1c-bitrix.ru/api_help/catalog/fields.php">Структура таблицы</a></li> <li><a
* href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/add.php">CCatalogDiscountCoupon::Add</a></li>
* <li><a
* href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/update.php">CCatalogDiscountCoupon::Update</a></li>
* </ul> </ht<br><br>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/checkfields.php
* @author Bitrix
*/
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $DB;
global $APPLICATION;
global $USER;
$ACTION = strtoupper($ACTION);
if ('UPDATE' != $ACTION && 'ADD' != $ACTION) {
return false;
}
if ((is_set($arFields, "DISCOUNT_ID") || $ACTION == "ADD") && intval($arFields["DISCOUNT_ID"]) <= 0) {
$APPLICATION->ThrowException(GetMessage("KGDC_EMPTY_DISCOUNT"), "EMPTY_DISCOUNT_ID");
return false;
}
if ((is_set($arFields, "COUPON") || $ACTION == "ADD") && strlen($arFields["COUPON"]) <= 0) {
$APPLICATION->ThrowException(GetMessage("KGDC_EMPTY_COUPON"), "EMPTY_COUPON");
return false;
} elseif (is_set($arFields, "COUPON")) {
$arFilter = array("COUPON" => substr($arFields["COUPON"], 0, 32));
if ($ID > 0) {
$arFilter["!ID"] = $ID;
}
$rsCoupon = CCatalogDiscountCoupon::GetList(array(), $arFilter);
if ($arCoupon = $rsCoupon->Fetch()) {
$APPLICATION->ThrowException(GetMessage("KGDC_DUPLICATE_COUPON"), "DUPLICATE_COUPON");
return false;
}
}
if ((is_set($arFields, "ACTIVE") || $ACTION == "ADD") && $arFields["ACTIVE"] != "N") {
$arFields["ACTIVE"] = "Y";
}
if ((is_set($arFields, "ONE_TIME") || $ACTION == "ADD") && !in_array($arFields["ONE_TIME"], self::GetCoupontTypes())) {
$arFields["ONE_TIME"] = self::TYPE_ONE_TIME;
}
if ((is_set($arFields, "DATE_APPLY") || $ACTION == "ADD") && !$DB->IsDate($arFields["DATE_APPLY"], false, SITE_ID, "FULL")) {
$arFields["DATE_APPLY"] = false;
}
$intUserID = 0;
$boolUserExist = CCatalog::IsUserExists();
//.........这里部分代码省略.........
示例4: IncludeModuleLangFile
<?php
//<title>CSV</title>
IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/catalog/import_setup_templ.php');
$startImportExecTime = getmicrotime();
global $USER;
global $APPLICATION;
$bTmpUserCreated = false;
if (!CCatalog::IsUserExists()) {
$bTmpUserCreated = true;
if (isset($USER)) {
$USER_TMP = $USER;
unset($USER);
}
$USER = new CUser();
}
$strImportErrorMessage = "";
$strImportOKMessage = "";
global $arCatalogAvailProdFields, $defCatalogAvailProdFields, $arCatalogAvailPriceFields, $defCatalogAvailPriceFields, $arCatalogAvailValueFields, $defCatalogAvailValueFields, $arCatalogAvailQuantityFields, $defCatalogAvailQuantityFields, $arCatalogAvailGroupFields, $defCatalogAvailGroupFields, $defCatalogAvailCurrencies;
if (!isset($arCatalogAvailProdFields)) {
$arCatalogAvailProdFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_ELEMENT);
}
if (!isset($arCatalogAvailPriceFields)) {
$arCatalogAvailPriceFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_CATALOG);
}
if (!isset($arCatalogAvailValueFields)) {
$arCatalogAvailValueFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_PRICE);
}
if (!isset($arCatalogAvailQuantityFields)) {
$arCatalogAvailQuantityFields = CCatalogCSVSettings::getSettingsFields(CCatalogCSVSettings::FIELDS_PRICE_EXT);
}
示例5: GetQueryBuildArrays
//.........这里部分代码省略.........
break;
case "QUANTITY":
$res = CIBlock::FilterCreate("CAT_PR.QUANTITY", $val, "number", $cOperationType);
break;
case "AVAILABLE":
if ('N' !== $val) {
$val = 'Y';
}
$res = " (IF (\n\t\t\t\t\tCAT_PR.QUANTITY > 0 OR\n\t\t\t\t\tIF (CAT_PR.QUANTITY_TRACE = 'D', '" . $strDefQuantityTrace . "', CAT_PR.QUANTITY_TRACE) = 'N' OR\n\t\t\t\t\tIF (CAT_PR.CAN_BUY_ZERO = 'D', '" . $strDefCanBuyZero . "', CAT_PR.CAN_BUY_ZERO) = 'Y',\n\t\t\t\t\t'Y', 'N'\n\t\t\t\t\t) " . ($cOperationType == "N" ? "<>" : "=") . " '" . $val . "') ";
break;
case "WEIGHT":
$res = CIBlock::FilterCreate("CAT_PR.WEIGHT", $val, "number", $cOperationType);
break;
case 'TYPE':
$res = CIBlock::FilterCreate("CAT_PR.TYPE", $val, "number", $cOperationType);
break;
case 'PURCHASING_PRICE':
$res = CIBlock::FilterCreate("CAT_PR.PURCHASING_PRICE", $val, "number", $cOperationType);
break;
case 'PURCHASING_CURRENCY':
$res = CIBlock::FilterCreate("CAT_PR.PURCHASING_PRICE", $val, "string", $cOperationType);
break;
}
if ('' == $res) {
continue;
}
if (!array_key_exists($inum, $arWhereTmp)) {
$arWhereTmp[$inum] = array();
}
$arWhereTmp[$inum][] = $res;
$arJoinGroup[$inum] = true;
}
}
if (!empty($arSelect)) {
foreach ($arSelect as &$strOneSelect) {
$val = strtoupper($strOneSelect);
if (0 != strncmp($val, 'CATALOG_GROUP_', 14)) {
continue;
}
$num = (int) substr($val, 14);
if ($num > 0) {
$arJoinGroup[$num] = true;
}
}
if (isset($strOneSelect)) {
unset($strOneSelect);
}
}
if (!empty($arJoinGroup)) {
$strSubWhere = implode(',', array_keys($arJoinGroup));
$strUserGroups = CCatalog::IsUserExists() ? $USER->GetGroups() : '2';
$strCacheKey = "P_" . $strUserGroups;
$strCacheKey .= "_" . $strSubWhere;
$strCacheKey .= "_" . LANGUAGE_ID;
$cacheTime = CATALOG_CACHE_DEFAULT_TIME;
if (defined("CATALOG_CACHE_TIME")) {
$cacheTime = intval(CATALOG_CACHE_TIME);
}
$stackCacheManager->SetLength("catalog_GetQueryBuildArrays", 50);
$stackCacheManager->SetTTL("catalog_GetQueryBuildArrays", $cacheTime);
if ($stackCacheManager->Exist("catalog_GetQueryBuildArrays", $strCacheKey)) {
$arResult = $stackCacheManager->Get("catalog_GetQueryBuildArrays", $strCacheKey);
} else {
$strSql = "SELECT CAT_CG.ID, CAT_CGL.NAME as CATALOG_GROUP_NAME, " . "\tIF(CAT_CGG.ID IS NULL, 'N', 'Y') as CATALOG_CAN_ACCESS, " . "\tIF(CAT_CGG1.ID IS NULL, 'N', 'Y') as CATALOG_CAN_BUY " . "FROM b_catalog_group CAT_CG " . "\tLEFT JOIN b_catalog_group2group CAT_CGG ON (CAT_CG.ID = CAT_CGG.CATALOG_GROUP_ID AND CAT_CGG.GROUP_ID IN (" . $strUserGroups . ") AND CAT_CGG.BUY <> 'Y') " . "\tLEFT JOIN b_catalog_group2group CAT_CGG1 ON (CAT_CG.ID = CAT_CGG1.CATALOG_GROUP_ID AND CAT_CGG1.GROUP_ID IN (" . $strUserGroups . ") AND CAT_CGG1.BUY = 'Y') " . "\tLEFT JOIN b_catalog_group_lang CAT_CGL ON (CAT_CG.ID = CAT_CGL.CATALOG_GROUP_ID AND CAT_CGL.LID = '" . LANGUAGE_ID . "') " . " WHERE CAT_CG.ID IN (" . $strSubWhere . ") " . " GROUP BY CAT_CG.ID ";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$arResult = array();
while ($arRes = $dbRes->Fetch()) {
$arResult[] = $arRes;
}
$stackCacheManager->Set("catalog_GetQueryBuildArrays", $strCacheKey, $arResult);
}
foreach ($arResult as &$row) {
$i = (int) $row["ID"];
if (isset($arWhereTmp[$i]) && !empty($arWhereTmp[$i]) && is_array($arWhereTmp[$i])) {
$sResWhere .= ' AND ' . implode(' AND ', $arWhereTmp[$i]);
}
if (isset($arOrderTmp[$i]) && !empty($arOrderTmp[$i]) && is_array($arOrderTmp[$i])) {
foreach ($arOrderTmp[$i] as $k => $v) {
$arResOrder[$k] = $v;
}
}
$sResSelect .= ", CAT_P" . $i . ".ID as CATALOG_PRICE_ID_" . $i . ", " . " CAT_P" . $i . ".CATALOG_GROUP_ID as CATALOG_GROUP_ID_" . $i . ", " . " CAT_P" . $i . ".PRICE as CATALOG_PRICE_" . $i . ", " . " CAT_P" . $i . ".CURRENCY as CATALOG_CURRENCY_" . $i . ", " . " CAT_P" . $i . ".QUANTITY_FROM as CATALOG_QUANTITY_FROM_" . $i . ", " . " CAT_P" . $i . ".QUANTITY_TO as CATALOG_QUANTITY_TO_" . $i . ", " . " '" . $DB->ForSql($row["CATALOG_GROUP_NAME"]) . "' as CATALOG_GROUP_NAME_" . $i . ", " . " '" . $DB->ForSql($row["CATALOG_CAN_ACCESS"]) . "' as CATALOG_CAN_ACCESS_" . $i . ", " . " '" . $DB->ForSql($row["CATALOG_CAN_BUY"]) . "' as CATALOG_CAN_BUY_" . $i . ", " . " CAT_P" . $i . ".EXTRA_ID as CATALOG_EXTRA_ID_" . $i;
$sResFrom .= " LEFT JOIN b_catalog_price CAT_P" . $i . " ON (CAT_P" . $i . ".PRODUCT_ID = BE.ID AND CAT_P" . $i . ".CATALOG_GROUP_ID = " . $row["ID"] . ") ";
if (isset($arAddJoinOn[$i])) {
$sResFrom .= ' AND ' . $arAddJoinOn[$i];
}
}
if (isset($row)) {
unset($row);
}
}
$sResSelect .= ", CAT_PR.QUANTITY as CATALOG_QUANTITY, CAT_PR.QUANTITY_RESERVED as CATALOG_QUANTITY_RESERVED, " . " IF (CAT_PR.QUANTITY_TRACE = 'D', '" . $strDefQuantityTrace . "', CAT_PR.QUANTITY_TRACE) as CATALOG_QUANTITY_TRACE, " . " CAT_PR.QUANTITY_TRACE as CATALOG_QUANTITY_TRACE_ORIG, " . " IF (CAT_PR.CAN_BUY_ZERO = 'D', '" . $strDefCanBuyZero . "', CAT_PR.CAN_BUY_ZERO) as CATALOG_CAN_BUY_ZERO, " . " CAT_PR.CAN_BUY_ZERO as CATALOG_CAN_BUY_ZERO_ORIG, " . " IF (CAT_PR.NEGATIVE_AMOUNT_TRACE = 'D', '" . $strDefNegAmount . "', CAT_PR.NEGATIVE_AMOUNT_TRACE) as CATALOG_NEGATIVE_AMOUNT_TRACE, " . " CAT_PR.NEGATIVE_AMOUNT_TRACE as CATALOG_NEGATIVE_AMOUNT_ORIG, " . " IF (CAT_PR.SUBSCRIBE = 'D', '" . $strSubscribe . "', CAT_PR.SUBSCRIBE) as CATALOG_SUBSCRIBE, " . " CAT_PR.SUBSCRIBE as CATALOG_SUBSCRIBE_ORIG, " . " IF (\n\t\t\t\tCAT_PR.QUANTITY > 0 OR\n\t\t\t\tIF (CAT_PR.QUANTITY_TRACE = 'D', '" . $strDefQuantityTrace . "', CAT_PR.QUANTITY_TRACE) = 'N' OR\n\t\t\t\tIF (CAT_PR.CAN_BUY_ZERO = 'D', '" . $strDefCanBuyZero . "', CAT_PR.CAN_BUY_ZERO) = 'Y',\n\t\t\t\t'Y', 'N'\n\t\t\t) as CATALOG_AVAILABLE, " . " CAT_PR.WEIGHT as CATALOG_WEIGHT, CAT_PR.WIDTH as CATALOG_WIDTH, CAT_PR.LENGTH as CATALOG_LENGTH, CAT_PR.HEIGHT as CATALOG_HEIGHT, " . " CAT_PR.MEASURE as CATALOG_MEASURE, " . " CAT_VAT.RATE as CATALOG_VAT, CAT_PR.VAT_INCLUDED as CATALOG_VAT_INCLUDED, " . " CAT_PR.PRICE_TYPE as CATALOG_PRICE_TYPE, CAT_PR.RECUR_SCHEME_TYPE as CATALOG_RECUR_SCHEME_TYPE, " . " CAT_PR.RECUR_SCHEME_LENGTH as CATALOG_RECUR_SCHEME_LENGTH, CAT_PR.TRIAL_PRICE_ID as CATALOG_TRIAL_PRICE_ID, " . " CAT_PR.WITHOUT_ORDER as CATALOG_WITHOUT_ORDER, CAT_PR.SELECT_BEST_PRICE as CATALOG_SELECT_BEST_PRICE, " . " CAT_PR.PURCHASING_PRICE as CATALOG_PURCHASING_PRICE, CAT_PR.PURCHASING_CURRENCY as CATALOG_PURCHASING_CURRENCY, CAT_PR.TYPE as CATALOG_TYPE ";
$sResFrom .= " LEFT JOIN b_catalog_product CAT_PR ON (CAT_PR.ID = BE.ID) ";
$sResFrom .= " LEFT JOIN b_catalog_iblock CAT_IB ON ((CAT_PR.VAT_ID IS NULL OR CAT_PR.VAT_ID = 0) AND CAT_IB.IBLOCK_ID = BE.IBLOCK_ID) ";
$sResFrom .= " LEFT JOIN b_catalog_vat CAT_VAT ON (CAT_VAT.ID = IF((CAT_PR.VAT_ID IS NULL OR CAT_PR.VAT_ID = 0), CAT_IB.VAT_ID, CAT_PR.VAT_ID)) ";
if (isset($arWhereTmp[0]) && !empty($arWhereTmp[0]) && is_array($arWhereTmp[0])) {
$sResWhere .= ' AND ' . implode(' AND ', $arWhereTmp[0]);
}
return array("SELECT" => $sResSelect, "FROM" => $sResFrom, "WHERE" => $sResWhere, "ORDER" => $arResOrder);
}
示例6: GetList
function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
global $DB, $USER;
// for old-style execution
if (!is_array($arOrder) && !is_array($arFilter)) {
$arOrder = strval($arOrder);
$arFilter = strval($arFilter);
if ('' != $arOrder && '' != $arFilter) {
$arOrder = array($arOrder => $arFilter);
} else {
$arOrder = array();
}
if (is_array($arGroupBy)) {
$arFilter = $arGroupBy;
} else {
$arFilter = array();
}
$arGroupBy = false;
if ($arNavStartParams != false && '' != $arNavStartParams) {
$arFilter["LID"] = $arNavStartParams;
} else {
$arFilter["LID"] = LANGUAGE_ID;
}
}
if (!isset($arFilter['LID'])) {
$arFilter['LID'] = LANGUAGE_ID;
}
$strUserGroups = CCatalog::IsUserExists() ? $USER->GetGroups() : '2';
if (empty($arSelectFields)) {
$arSelectFields = array("ID", "NAME", "BASE", "SORT", "NAME_LANG", "CAN_ACCESS", "CAN_BUY", "XML_ID", "MODIFIED_BY", "CREATED_BY", "DATE_CREATE", "TIMESTAMP_X");
}
if ($arGroupBy == false) {
$arGroupBy = array("ID", "NAME", "BASE", "SORT", "XML_ID", "MODIFIED_BY", "CREATED_BY", "DATE_CREATE", "TIMESTAMP_X", "NAME_LANG");
}
$arFields = array("ID" => array("FIELD" => "CG.ID", "TYPE" => "int"), "NAME" => array("FIELD" => "CG.NAME", "TYPE" => "string"), "BASE" => array("FIELD" => "CG.BASE", "TYPE" => "char"), "SORT" => array("FIELD" => "CG.SORT", "TYPE" => "int"), "XML_ID" => array("FIELD" => "CG.XML_ID", "TYPE" => "string"), "TIMESTAMP_X" => array("FIELD" => "CG.TIMESTAMP_X", "TYPE" => "datetime"), "MODIFIED_BY" => array("FIELD" => "CG.MODIFIED_BY", "TYPE" => "int"), "DATE_CREATE" => array("FIELD" => "CG.DATE_CREATE", "TYPE" => "datetime"), "CREATED_BY" => array("FIELD" => "CG.CREATED_BY", "TYPE" => "int"), "NAME_LANG" => array("FIELD" => "CGL.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_catalog_group_lang CGL ON (CG.ID = CGL.CATALOG_GROUP_ID AND CGL.LANG = '" . $DB->ForSql($arFilter["LID"], 2) . "')"));
$arFields["CAN_ACCESS"] = array("FIELD" => "IF(CGG.ID IS NULL, 'N', 'Y')", "TYPE" => "char", "FROM" => "LEFT JOIN b_catalog_group2group CGG ON (CG.ID = CGG.CATALOG_GROUP_ID AND CGG.GROUP_ID IN (" . $strUserGroups . ") AND CGG.BUY <> 'Y')", "GROUPED" => "N");
$arFields["CAN_BUY"] = array("FIELD" => "IF(CGG1.ID IS NULL, 'N', 'Y')", "TYPE" => "char", "FROM" => "LEFT JOIN b_catalog_group2group CGG1 ON (CG.ID = CGG1.CATALOG_GROUP_ID AND CGG1.GROUP_ID IN (" . $strUserGroups . ") AND CGG1.BUY = 'Y')", "GROUPED" => "N");
$arSqls = CCatalog::_PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
$arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
if (empty($arGroupBy) && is_array($arGroupBy)) {
$strSql = "SELECT " . $arSqls["SELECT"] . " FROM b_catalog_group CG " . $arSqls["FROM"];
if (!empty($arSqls["WHERE"])) {
$strSql .= " WHERE " . $arSqls["WHERE"];
}
if (!empty($arSqls["GROUPBY"])) {
$strSql .= " GROUP BY " . $arSqls["GROUPBY"];
}
if (!empty($arSqls["HAVING"])) {
$strSql .= " HAVING " . $arSqls["HAVING"];
}
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
return $arRes["CNT"];
} else {
return false;
}
}
$strSql = "SELECT " . $arSqls["SELECT"] . " FROM b_catalog_group CG " . $arSqls["FROM"];
if (!empty($arSqls["WHERE"])) {
$strSql .= " WHERE " . $arSqls["WHERE"];
}
if (!empty($arSqls["GROUPBY"])) {
$strSql .= " GROUP BY " . $arSqls["GROUPBY"];
}
if (!empty($arSqls["HAVING"])) {
$strSql .= " HAVING " . $arSqls["HAVING"];
}
if (!empty($arSqls["ORDERBY"])) {
$strSql .= " ORDER BY " . $arSqls["ORDERBY"];
}
$intTopCount = 0;
$boolNavStartParams = !empty($arNavStartParams) && is_array($arNavStartParams);
if ($boolNavStartParams && array_key_exists('nTopCount', $arNavStartParams)) {
$intTopCount = intval($arNavStartParams["nTopCount"]);
}
if ($boolNavStartParams && 0 >= $intTopCount) {
$strSql_tmp = "SELECT COUNT('x') as CNT FROM b_catalog_group CG " . $arSqls["FROM"];
if (!empty($arSqls["WHERE"])) {
$strSql_tmp .= " WHERE " . $arSqls["WHERE"];
}
if (!empty($arSqls["GROUPBY"])) {
$strSql_tmp .= " GROUP BY " . $arSqls["GROUPBY"];
}
if (!empty($arSqls["HAVING"])) {
$strSql_tmp .= " HAVING " . $arSqls["HAVING"];
}
$dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$cnt = 0;
if (empty($arSqls["GROUPBY"])) {
if ($arRes = $dbRes->Fetch()) {
$cnt = $arRes["CNT"];
}
} else {
$cnt = $dbRes->SelectedRowsCount();
}
$dbRes = new CDBResult();
$dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
} else {
if ($boolNavStartParams && 0 < $intTopCount) {
$strSql .= " LIMIT " . $intTopCount;
//.........这里部分代码省略.........
示例7: CheckFields
public static function CheckFields($ACTION, &$arFields)
{
global $DB;
global $USER;
$ACTION = strtoupper($ACTION);
if ('UPDATE' != $ACTION && 'ADD' != $ACTION) {
return false;
}
if ((is_set($arFields, "FILE_NAME") || $ACTION == "ADD") && strlen($arFields["FILE_NAME"]) <= 0) {
return false;
}
if ((is_set($arFields, "NAME") || $ACTION == "ADD") && strlen($arFields["NAME"]) <= 0) {
return false;
}
if ((is_set($arFields, "IN_MENU") || $ACTION == "ADD") && $arFields["IN_MENU"] != "Y") {
$arFields["IN_MENU"] = "N";
}
if ((is_set($arFields, "DEFAULT_PROFILE") || $ACTION == "ADD") && $arFields["DEFAULT_PROFILE"] != "Y") {
$arFields["DEFAULT_PROFILE"] = "N";
}
if ((is_set($arFields, "IN_AGENT") || $ACTION == "ADD") && $arFields["IN_AGENT"] != "Y") {
$arFields["IN_AGENT"] = "N";
}
if ((is_set($arFields, "IN_CRON") || $ACTION == "ADD") && $arFields["IN_CRON"] != "Y") {
$arFields["IN_CRON"] = "N";
}
if ((is_set($arFields, "NEED_EDIT") || $ACTION == "ADD") && $arFields["NEED_EDIT"] != "Y") {
$arFields["NEED_EDIT"] = "N";
}
$arFields["IS_EXPORT"] = "N";
$intUserID = 0;
$boolUserExist = CCatalog::IsUserExists();
if ($boolUserExist) {
$intUserID = intval($USER->GetID());
}
$strDateFunction = $DB->GetNowFunction();
$boolNoUpdate = false;
if (isset($arFields['=LAST_USE']) && $strDateFunction == $arFields['=LAST_USE']) {
$arFields['~LAST_USE'] = $strDateFunction;
$boolNoUpdate = 'UPDATE' == $ACTION;
}
foreach ($arFields as $key => $value) {
if (0 == strncmp($key, '=', 1)) {
unset($arFields[$key]);
}
}
if (array_key_exists('TIMESTAMP_X', $arFields)) {
unset($arFields['TIMESTAMP_X']);
}
if (array_key_exists('DATE_CREATE', $arFields)) {
unset($arFields['DATE_CREATE']);
}
if ('ADD' == $ACTION) {
$arFields['~TIMESTAMP_X'] = $strDateFunction;
$arFields['~DATE_CREATE'] = $strDateFunction;
if ($boolUserExist) {
if (!array_key_exists('CREATED_BY', $arFields) || intval($arFields["CREATED_BY"]) <= 0) {
$arFields["CREATED_BY"] = $intUserID;
}
if (!array_key_exists('MODIFIED_BY', $arFields) || intval($arFields["MODIFIED_BY"]) <= 0) {
$arFields["MODIFIED_BY"] = $intUserID;
}
}
}
if ('UPDATE' == $ACTION) {
if (array_key_exists('CREATED_BY', $arFields)) {
unset($arFields['CREATED_BY']);
}
if ($boolNoUpdate) {
if (array_key_exists('MODIFIED_BY', $arFields)) {
unset($arFields['MODIFIED_BY']);
}
} else {
if ($boolUserExist) {
if (!array_key_exists('MODIFIED_BY', $arFields) || intval($arFields["MODIFIED_BY"]) <= 0) {
$arFields["MODIFIED_BY"] = $intUserID;
}
}
$arFields['~TIMESTAMP_X'] = $strDateFunction;
}
}
return true;
}
示例8: checkFieldsToUpdate
protected function checkFieldsToUpdate($intID, &$arFields)
{
global $DB;
global $USER;
$intCurrentUser = 0;
if (CCatalog::IsUserExists()) {
$intCurrentUser = (int) $USER->GetID();
}
if ($intCurrentUser <= 0) {
$intCurrentUser = false;
}
$strTimeFunc = $DB->GetNowFunction();
$arDefItem = self::getEmptyItemFields();
$arProductInSet = array();
$dblDiscountPercent = 0;
$boolItems = false;
$intID = (int) $intID;
if ($intID <= 0) {
self::$arErrors[] = array('id' => 'ID', 'text' => GetMessage('BT_CAT_SET_ERR_ID_IS_BAD'));
}
if (empty(self::$arErrors)) {
$arCurrent = CCatalogProductSet::getSetByID($intID);
if (empty($arCurrent)) {
self::$arErrors[] = array('id' => 'ID', 'text' => GetMessage('BT_CAT_SET_ERR_ID_IS_BAD'));
}
}
if (empty(self::$arErrors)) {
self::clearFieldsForUpdate($arFields, $arCurrent['TYPE']);
if (array_key_exists('ACTIVE', $arFields)) {
$arFields['ACTIVE'] = 'N' != $arFields['ACTIVE'] ? 'Y' : 'N';
}
if (array_key_exists('SORT', $arFields)) {
$arFields['SORT'] = (int) $arFields['SORT'];
if ($arFields['SORT'] <= 0) {
$arFields['SORT'] = 100;
}
}
$arFields['MODIFIED_BY'] = !array_key_exists('MODIFIED_BY', $arFields) ? 0 : (int) $arFields['MODIFIED_BY'];
if ($arFields['MODIFIED_BY'] <= 0) {
$arFields['MODIFIED_BY'] = $intCurrentUser;
}
$arFields['~TIMESTAMP_X'] = $strTimeFunc;
}
if (empty(self::$arErrors)) {
$arProductInSet[$arCurrent['ITEM_ID']] = true;
if (array_key_exists('ITEMS', $arFields)) {
if (empty($arFields['ITEMS']) || !is_array($arFields['ITEMS'])) {
self::$arErrors[] = array('id' => 'ITEMS', 'text' => GetMessage('BT_CAT_SET_ERR_ITEMS_IS_ABSENT'));
} else {
$arValidItems = array();
foreach ($arFields['ITEMS'] as &$arOneItem) {
if (empty($arOneItem) || !is_array($arOneItem)) {
continue;
}
if (array_key_exists('ID', $arOneItem)) {
unset($arOneItem['ID']);
}
if (!array_key_exists('ITEM_ID', $arOneItem)) {
continue;
}
$arOneItem['ITEM_ID'] = (int) $arOneItem['ITEM_ID'];
if ($arOneItem['ITEM_ID'] <= 0) {
continue;
}
if (isset($arProductInSet[$arOneItem['ITEM_ID']])) {
self::$arErrors[] = array('id' => 'ITEM_ID', 'text' => GetMessage('BT_CAT_PRODUCT_SET_ERR_ITEM_ID_DUBLICATE'));
continue;
}
$arProductInSet[$arOneItem['ITEM_ID']] = true;
$intRowID = self::searchItem($arOneItem['ITEM_ID'], $arCurrent['ITEMS']);
if (false === $intRowID) {
$arOneItem = array_merge($arDefItem, $arOneItem);
} else {
$arOneItem['ID'] = $intRowID;
}
if (array_key_exists('SORT', $arOneItem)) {
$arOneItem['SORT'] = (int) $arOneItem['SORT'];
if ($arOneItem['SORT'] <= 0) {
$arOneItem['SORT'] = 100;
}
}
if (array_key_exists('QUANTITY', $arOneItem)) {
$arOneItem['QUANTITY'] = doubleval($arOneItem['QUANTITY']);
if (0 >= $arOneItem['QUANTITY']) {
self::$arErrors[] = array('id' => 'QUANTITY', 'text' => self::TYPE_SET == $arFields['TYPE'] ? GetMessage('BT_CAT_PRODUCT_SET_ERR_QUANTITY_IS_BAD') : GetMessage('BT_CAT_PRODUCT_SET_ERR_QUANTITY_GROUP_IS_BAD'));
continue;
}
}
if (self::TYPE_SET == $arCurrent['TYPE']) {
if (array_key_exists('MEASURE', $arOneItem)) {
$arOneItem['MEASURE'] = (int) $arOneItem['MEASURE'];
if ($arOneItem['MEASURE'] < 0) {
$arOneItem['MEASURE'] = 0;
}
}
if (array_key_exists('DISCOUNT_PERCENT', $arOneItem)) {
if (false !== $arOneItem['DISCOUNT_PERCENT']) {
$arOneItem['DISCOUNT_PERCENT'] = doubleval($arOneItem['DISCOUNT_PERCENT']);
if (0 > $arOneItem['DISCOUNT_PERCENT'] || 100 < $arOneItem['DISCOUNT_PERCENT']) {
self::$arErrors[] = array('id' => 'DISCOUNT_PERCENT', 'text' => GetMessage('BT_CAT_PRODUCT_SET_ERR_DISCOUNT_PERCENT_IS_BAD'));
//.........这里部分代码省略.........
示例9: SubscribeProduct
/**
* @param int $intProductID
* @param array $arRewriteFields
* @param array $arProductParams
* @return bool|int
*/
function SubscribeProduct($intProductID, $arRewriteFields = array(), $arProductParams = array())
{
global $USER, $APPLICATION;
if (!CCatalog::IsUserExists()) {
return false;
}
if (!$USER->IsAuthorized()) {
return false;
}
$intUserID = (int) $USER->GetID();
$intProductID = (int) $intProductID;
if ($intProductID <= 0) {
$APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_EMPTY_PRODUCT_ID'), "EMPTY_PRODUCT_ID");
return false;
}
if (!Loader::includeModule("sale")) {
$APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_SALE_MODULE'), "NO_SALE_MODULE");
return false;
}
if (Loader::includeModule("statistic") && isset($_SESSION['SESS_SEARCHER_ID']) && (int) $_SESSION["SESS_SEARCHER_ID"] > 0) {
$APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_SESS_SEARCHER'), "SESS_SEARCHER");
return false;
}
$rsProducts = CCatalogProduct::GetList(array(), array('ID' => $intProductID), false, false, array('ID', 'WEIGHT', 'WIDTH', 'HEIGHT', 'LENGTH', 'TYPE', 'MEASURE', 'SUBSCRIBE'));
if (!($arCatalogProduct = $rsProducts->Fetch())) {
$APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_PRODUCT'), "NO_PRODUCT");
return false;
}
if ($arCatalogProduct['SUBSCRIBE'] == 'N') {
$APPLICATION->ThrowException(Loc::getMessage('CATALOG_ERR_NO_SUBSCRIBE'), 'SUBSCRIBE');
return false;
}
$arCatalogProduct['MEASURE'] = (int) $arCatalogProduct['MEASURE'];
$arCatalogProduct['MEASURE_NAME'] = '';
$arCatalogProduct['MEASURE_CODE'] = 0;
if ($arCatalogProduct['MEASURE'] <= 0) {
$arMeasure = CCatalogMeasure::getDefaultMeasure(true, true);
$arCatalogProduct['MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
$arCatalogProduct['MEASURE_CODE'] = $arMeasure['CODE'];
} else {
$rsMeasures = CCatalogMeasure::getList(array(), array('ID' => $arCatalogProduct['MEASURE']), false, false, array('ID', 'SYMBOL_RUS', 'CODE'));
if ($arMeasure = $rsMeasures->GetNext()) {
$arCatalogProduct['MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
$arCatalogProduct['MEASURE_CODE'] = $arMeasure['CODE'];
}
}
$rsItems = CIBlockElement::GetList(array(), array("ID" => $intProductID, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R"), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'XML_ID', 'DETAIL_PAGE_URL'));
if (!($arProduct = $rsItems->GetNext())) {
return false;
}
$arParentSku = CCatalogSku::GetProductInfo($intProductID, $arProduct['IBLOCK_ID']);
if (!empty($arParentSku)) {
if (strpos($arProduct["~XML_ID"], '#') === false) {
$parentIterator = Iblock\ElementTable::getList(array('select' => array('ID', 'XML_ID'), 'filter' => array('ID' => $arParentSku['ID'])));
if ($parent = $parentIterator->fetch()) {
$arProduct["~XML_ID"] = $parent['XML_ID'] . '#' . $arProduct["~XML_ID"];
}
unset($parent, $parentIterator);
}
}
$arPrice = array('PRICE' => 0.0, 'CURRENCY' => CSaleLang::GetLangCurrency(SITE_ID), 'VAT_RATE' => 0, 'PRODUCT_PRICE_ID' => 0, 'CATALOG_GROUP_NAME' => '');
$arBuyerGroups = $USER->GetUserGroupArray();
$arSubscrPrice = CCatalogProduct::GetOptimalPrice($intProductID, 1, $arBuyerGroups, "N", array(), SITE_ID, array());
if (!empty($arSubscrPrice) && is_array($arSubscrPrice)) {
$arPrice['PRICE'] = $arSubscrPrice['DISCOUNT_PRICE'];
$arPrice['CURRENCY'] = CCurrency::GetBaseCurrency();
$arPrice['VAT_RATE'] = $arSubscrPrice['PRICE']['VAT_RATE'];
$arPrice['PRODUCT_PRICE_ID'] = $arSubscrPrice["PRICE"]["ID"];
$arPrice['CATALOG_GROUP_NAME'] = $arSubscrPrice["PRICE"]["CATALOG_GROUP_NAME"];
}
$arProps = array();
$strIBlockXmlID = (string) CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID');
if ($strIBlockXmlID !== '') {
$arProps[] = array("NAME" => "Catalog XML_ID", "CODE" => "CATALOG.XML_ID", "VALUE" => $strIBlockXmlID);
}
if (!empty($arProductParams) && is_array($arProductParams)) {
foreach ($arProductParams as &$arOneProductParams) {
$arProps[] = array("NAME" => $arOneProductParams["NAME"], "CODE" => $arOneProductParams["CODE"], "VALUE" => $arOneProductParams["VALUE"], "SORT" => $arOneProductParams["SORT"]);
}
unset($arOneProductParams);
}
$arProps[] = array("NAME" => "Product XML_ID", "CODE" => "PRODUCT.XML_ID", "VALUE" => $arProduct["XML_ID"]);
$arFields = array("PRODUCT_ID" => $intProductID, "PRODUCT_PRICE_ID" => $arPrice['PRODUCT_PRICE_ID'], "PRICE" => $arPrice['PRICE'], "CURRENCY" => $arPrice['CURRENCY'], "WEIGHT" => $arCatalogProduct["WEIGHT"], "DIMENSIONS" => serialize(array("WIDTH" => $arCatalogProduct["WIDTH"], "HEIGHT" => $arCatalogProduct["HEIGHT"], "LENGTH" => $arCatalogProduct["LENGTH"])), "QUANTITY" => 1, "LID" => SITE_ID, "DELAY" => "N", "CAN_BUY" => "N", "SUBSCRIBE" => "Y", "NAME" => $arProduct["~NAME"], "MODULE" => "catalog", "PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider", "NOTES" => $arPrice["CATALOG_GROUP_NAME"], "DETAIL_PAGE_URL" => $arProduct["~DETAIL_PAGE_URL"], "CATALOG_XML_ID" => $strIBlockXmlID, "PRODUCT_XML_ID" => $arProduct["~XML_ID"], "PROPS" => $arProps, "TYPE" => $arCatalogProduct["TYPE"] == CCatalogProduct::TYPE_SET ? CCatalogProductSet::TYPE_SET : NULL, "MEASURE_NAME" => $arCatalogProduct['MEASURE_NAME'], "MEASURE_CODE" => $arCatalogProduct['MEASURE_CODE'], 'IGNORE_CALLBACK_FUNC' => 'Y');
if (!empty($arRewriteFields) && is_array($arRewriteFields)) {
if (array_key_exists('SUBSCRIBE', $arRewriteFields)) {
unset($arRewriteFields['SUBSCRIBE']);
}
if (array_key_exists('CAN_BUY', $arRewriteFields)) {
unset($arRewriteFields['CAN_BUY']);
}
if (array_key_exists('DELAY', $arRewriteFields)) {
unset($arRewriteFields['DELAY']);
}
if (!empty($arRewriteFields)) {
//.........这里部分代码省略.........
示例10: GetGroupsPerms
public static function GetGroupsPerms($arUserGroups = array(), $arCatalogGroupsFilter = array())
{
global $USER;
if (!is_array($arUserGroups))
$arUserGroups = array($arUserGroups);
if (empty($arUserGroups))
{
$arUserGroups = (CCatalog::IsUserExists() ? $USER->GetUserGroupArray() : array(2));
}
$arUserGroupsFilter = array();
foreach ($arUserGroups as &$intUserGroupID)
{
$intUserGroupID = intval($intUserGroupID);
if (0 < $intUserGroupID)
$arUserGroupsFilter[] = $intUserGroupID;
}
if (isset($intUserGroupID))
unset($intUserGroupID);
if (!is_array($arCatalogGroupsFilter))
$arCatalogGroupsFilter = array($arCatalogGroupsFilter);
$arResult = array();
$arResult["view"] = array();
$arResult["buy"] = array();
if (empty($arUserGroupsFilter))
return $arResult;
$arData = array();
if (defined("CATALOG_SKIP_CACHE") && CATALOG_SKIP_CACHE)
{
$dbPriceGroups = CCatalogGroup::GetGroupsList(array("GROUP_ID" => $arUserGroupsFilter));
while ($arPriceGroup = $dbPriceGroups->Fetch())
{
$arPriceGroup["CATALOG_GROUP_ID"] = intval($arPriceGroup["CATALOG_GROUP_ID"]);
$key = (($arPriceGroup["BUY"] == "Y") ? "buy" : "view");
if ($key == "view")
if (!empty($arCatalogGroupsFilter))
if (!in_array($arPriceGroup["CATALOG_GROUP_ID"], $arCatalogGroupsFilter))
continue;
if (!in_array($arPriceGroup["CATALOG_GROUP_ID"], $arResult[$key]))
$arResult[$key][] = $arPriceGroup["CATALOG_GROUP_ID"];
}
return $arResult;
}
$cacheTime = CATALOG_CACHE_DEFAULT_TIME;
if (defined("CATALOG_CACHE_TIME"))
$cacheTime = intval(CATALOG_CACHE_TIME);
global $CACHE_MANAGER;
if ($CACHE_MANAGER->Read($cacheTime, "catalog_group_perms"))
{
$arData = $CACHE_MANAGER->Get("catalog_group_perms");
}
else
{
$dbPriceGroups = CCatalogGroup::GetGroupsList(array());
while ($arPriceGroup = $dbPriceGroups->Fetch())
{
$arPriceGroup["GROUP_ID"] = intval($arPriceGroup["GROUP_ID"]);
$arPriceGroup["CATALOG_GROUP_ID"] = intval($arPriceGroup["CATALOG_GROUP_ID"]);
$key = (($arPriceGroup["BUY"] == "Y") ? "buy" : "view");
$arData[$arPriceGroup["GROUP_ID"]][$key][] = intval($arPriceGroup["CATALOG_GROUP_ID"]);
}
$CACHE_MANAGER->Set("catalog_group_perms", $arData);
}
for ($i = 0, $cnt = count($arUserGroupsFilter); $i < $cnt; $i++)
{
if (array_key_exists($arUserGroupsFilter[$i], $arData))
{
if (array_key_exists("view", $arData[$arUserGroupsFilter[$i]]))
$arResult["view"] = array_merge($arResult["view"], $arData[$arUserGroupsFilter[$i]]["view"]);
if (array_key_exists("buy", $arData[$arUserGroupsFilter[$i]]))
$arResult["buy"] = array_merge($arResult["buy"], $arData[$arUserGroupsFilter[$i]]["buy"]);
}
}
$arResult["view"] = array_unique($arResult["view"]);
$arResult["buy"] = array_unique($arResult["buy"]);
if (!empty($arCatalogGroupsFilter))
{
$arTmp = array();
foreach ($arResult["view"] as $i => $arView)
//for ($i = 0, $cnt = count($arResult["view"]); $i < $cnt; $i++)
{
if (in_array($arResult["view"][$i], $arCatalogGroupsFilter))
$arTmp[] = $arResult["view"][$i];
//.........这里部分代码省略.........
示例11: GetList
/**
* @param array $arOrder
* @param array $arFilter
* @param bool|array $arGroupBy
* @param bool|array $arNavStartParams
* @param array $arSelectFields
* @return bool|CDBResult
*/
function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
global $DB, $USER;
// for old execution style
if (!is_array($arOrder) && !is_array($arFilter)) {
$arOrder = (string) $arOrder;
$arFilter = (string) $arFilter;
$arOrder = $arOrder != '' && $arFilter != '' ? array($arOrder => $arFilter) : array();
$arFilter = is_array($arGroupBy) ? $arGroupBy : array();
$arGroupBy = false;
}
$strUserGroups = CCatalog::IsUserExists() ? $USER->GetGroups() : '2';
if (empty($arSelectFields)) {
$arSelectFields = array("ID", "PRODUCT_ID", "EXTRA_ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY", "TIMESTAMP_X", "QUANTITY_FROM", "QUANTITY_TO", "BASE", "SORT", "CATALOG_GROUP_NAME", "CAN_ACCESS", "CAN_BUY");
}
$arFields = array("ID" => array("FIELD" => "P.ID", "TYPE" => "int"), "PRODUCT_ID" => array("FIELD" => "P.PRODUCT_ID", "TYPE" => "int"), "EXTRA_ID" => array("FIELD" => "P.EXTRA_ID", "TYPE" => "int"), "CATALOG_GROUP_ID" => array("FIELD" => "P.CATALOG_GROUP_ID", "TYPE" => "int"), "PRICE" => array("FIELD" => "P.PRICE", "TYPE" => "double"), "CURRENCY" => array("FIELD" => "P.CURRENCY", "TYPE" => "string"), "TIMESTAMP_X" => array("FIELD" => "P.TIMESTAMP_X", "TYPE" => "datetime"), "QUANTITY_FROM" => array("FIELD" => "P.QUANTITY_FROM", "TYPE" => "int"), "QUANTITY_TO" => array("FIELD" => "P.QUANTITY_TO", "TYPE" => "int"), "TMP_ID" => array("FIELD" => "P.TMP_ID", "TYPE" => "string"), "PRICE_BASE_RATE" => array("FIELD" => "P.PRICE*CC.CURRENT_BASE_RATE", "TYPE" => "double", "FROM" => "LEFT JOIN b_catalog_currency CC ON (P.CURRENCY = CC.CURRENCY)"), "BASE" => array("FIELD" => "CG.BASE", "TYPE" => "char", "FROM" => "INNER JOIN b_catalog_group CG ON (P.CATALOG_GROUP_ID = CG.ID)"), "SORT" => array("FIELD" => "CG.SORT", "TYPE" => "int", "FROM" => "INNER JOIN b_catalog_group CG ON (P.CATALOG_GROUP_ID = CG.ID)"), "PRODUCT_QUANTITY" => array("FIELD" => "CP.QUANTITY", "TYPE" => "int", "FROM" => "INNER JOIN b_catalog_product CP ON (P.PRODUCT_ID = CP.ID)"), "PRODUCT_QUANTITY_TRACE" => array("FIELD" => "IF (CP.QUANTITY_TRACE = 'D', '" . $DB->ForSql((string) Option::get('catalog', 'default_quantity_trace', 'N')) . "', CP.QUANTITY_TRACE)", "TYPE" => "char", "FROM" => "INNER JOIN b_catalog_product CP ON (P.PRODUCT_ID = CP.ID)"), "PRODUCT_CAN_BUY_ZERO" => array("FIELD" => "IF (CP.CAN_BUY_ZERO = 'D', '" . $DB->ForSql((string) Option::get('catalog', 'default_can_buy_zero', 'N')) . "', CP.CAN_BUY_ZERO)", "TYPE" => "char", "FROM" => "INNER JOIN b_catalog_product CP ON (P.PRODUCT_ID = CP.ID)"), "PRODUCT_NEGATIVE_AMOUNT_TRACE" => array("FIELD" => "IF (CP.NEGATIVE_AMOUNT_TRACE = 'D', '" . $DB->ForSql((string) Option::get('catalog', 'allow_negative_amount', 'N')) . "', CP.NEGATIVE_AMOUNT_TRACE)", "TYPE" => "char", "FROM" => "INNER JOIN b_catalog_product CP ON (P.PRODUCT_ID = CP.ID)"), "PRODUCT_WEIGHT" => array("FIELD" => "CP.WEIGHT", "TYPE" => "int", "FROM" => "INNER JOIN b_catalog_product CP ON (P.PRODUCT_ID = CP.ID)"), "ELEMENT_IBLOCK_ID" => array("FIELD" => "IE.IBLOCK_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_iblock_element IE ON (P.PRODUCT_ID = IE.ID)"), "CATALOG_GROUP_NAME" => array("FIELD" => "CGL.NAME", "TYPE" => "string", "FROM" => "LEFT JOIN b_catalog_group_lang CGL ON (P.CATALOG_GROUP_ID = CGL.CATALOG_GROUP_ID AND CGL.LANG = '" . LANGUAGE_ID . "')"));
$arFields["CAN_ACCESS"] = array("FIELD" => "IF(CGG.ID IS NULL, 'N', 'Y')", "TYPE" => "char", "FROM" => "LEFT JOIN b_catalog_group2group CGG ON (CG.ID = CGG.CATALOG_GROUP_ID AND CGG.GROUP_ID IN (" . $strUserGroups . ") AND CGG.BUY <> 'Y')");
$arFields["CAN_BUY"] = array("FIELD" => "IF(CGG1.ID IS NULL, 'N', 'Y')", "TYPE" => "char", "FROM" => "LEFT JOIN b_catalog_group2group CGG1 ON (CG.ID = CGG1.CATALOG_GROUP_ID AND CGG1.GROUP_ID IN (" . $strUserGroups . ") AND CGG1.BUY = 'Y')");
$arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
if (array_key_exists("CAN_ACCESS", $arFields) || array_key_exists("CAN_BUY", $arFields)) {
$arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "DISTINCT", $arSqls["SELECT"]);
} else {
$arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
}
if (empty($arGroupBy) && is_array($arGroupBy)) {
$strSql = "SELECT " . $arSqls["SELECT"] . " FROM b_catalog_price P " . $arSqls["FROM"];
if (!empty($arSqls["WHERE"])) {
$strSql .= " WHERE " . $arSqls["WHERE"];
}
if (!empty($arSqls["GROUPBY"])) {
$strSql .= " GROUP BY " . $arSqls["GROUPBY"];
}
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
return $arRes["CNT"];
} else {
return false;
}
}
$strSql = "SELECT " . $arSqls["SELECT"] . " FROM b_catalog_price P " . $arSqls["FROM"];
if (!empty($arSqls["WHERE"])) {
$strSql .= " WHERE " . $arSqls["WHERE"];
}
if (!empty($arSqls["GROUPBY"])) {
$strSql .= " GROUP BY " . $arSqls["GROUPBY"];
}
if (!empty($arSqls["ORDERBY"])) {
$strSql .= " ORDER BY " . $arSqls["ORDERBY"];
}
$intTopCount = 0;
$boolNavStartParams = !empty($arNavStartParams) && is_array($arNavStartParams);
if ($boolNavStartParams && isset($arNavStartParams['nTopCount'])) {
$intTopCount = (int) $arNavStartParams["nTopCount"];
}
if ($boolNavStartParams && $intTopCount <= 0) {
$strSql_tmp = "SELECT COUNT('x') as CNT FROM b_catalog_price P " . $arSqls["FROM"];
if (!empty($arSqls["WHERE"])) {
$strSql_tmp .= " WHERE " . $arSqls["WHERE"];
}
if (!empty($arSqls["GROUPBY"])) {
$strSql_tmp .= " GROUP BY " . $arSqls["GROUPBY"];
}
$dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$cnt = 0;
if (empty($arSqls["GROUPBY"])) {
if ($arRes = $dbRes->Fetch()) {
$cnt = $arRes["CNT"];
}
} else {
$cnt = $dbRes->SelectedRowsCount();
}
$dbRes = new CDBResult();
$dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
} else {
if ($boolNavStartParams && $intTopCount > 0) {
$strSql .= " LIMIT " . $intTopCount;
}
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
return $dbRes;
}
示例12: CheckFields
//.........这里部分代码省略.........
$arMsg[] = array('id' => 'VALUE', 'text' => Loc::getMessage("BT_MOD_CATALOG_DISC_ERR_BAD_VALUE"));
}
}
if (isset($arFields['MIN_ORDER_SUM'])) {
$arFields['MIN_ORDER_SUM'] = str_replace(',', '.', $arFields['MIN_ORDER_SUM']);
$arFields['MIN_ORDER_SUM'] = doubleval($arFields['MIN_ORDER_SUM']);
}
if (isset($arFields['PRIORITY'])) {
$arFields['PRIORITY'] = (int) $arFields['PRIORITY'];
if (0 >= $arFields['PRIORITY']) {
$arFields['PRIORITY'] = 1;
}
}
if (isset($arFields['LAST_DISCOUNT'])) {
$arFields['LAST_DISCOUNT'] = $arFields['LAST_DISCOUNT'] != 'N' ? 'Y' : 'N';
}
}
if ($boolResult) {
if (isset($arFields['CONDITIONS'])) {
if (empty($arFields['CONDITIONS'])) {
$boolResult = false;
$arMsg[] = array('id' => 'CONDITIONS', 'text' => Loc::getMessage("BT_MOD_CATALOG_DISC_ERR_EMPTY_CONDITIONS"));
} else {
$usedHandlers = array();
$boolCond = true;
$strEval = '';
if (!is_array($arFields['CONDITIONS'])) {
if (!CheckSerializedData($arFields['CONDITIONS'])) {
$boolCond = false;
$boolResult = false;
$arMsg[] = array('id' => 'CONDITIONS', 'text' => Loc::getMessage("BT_MOD_CATALOG_DISC_ERR_BAD_CONDITIONS"));
} else {
$arFields['CONDITIONS'] = unserialize($arFields['CONDITIONS']);
if (empty($arFields['CONDITIONS']) || !is_array($arFields['CONDITIONS'])) {
$boolCond = false;
$boolResult = false;
$arMsg[] = array('id' => 'CONDITIONS', 'text' => Loc::getMessage("BT_MOD_CATALOG_DISC_ERR_BAD_CONDITIONS"));
}
}
}
if ($boolCond) {
$obCond = new CCatalogCondTree();
$boolCond = $obCond->Init(BT_COND_MODE_GENERATE, BT_COND_BUILD_CATALOG, array());
if (!$boolCond) {
return false;
}
$strEval = $obCond->Generate($arFields['CONDITIONS'], array('FIELD' => '$arProduct'));
if (empty($strEval) || 'false' == $strEval) {
$boolCond = false;
$boolResult = false;
$arMsg[] = array('id' => 'CONDITIONS', 'text' => Loc::getMessage("BT_MOD_CATALOG_DISC_ERR_BAD_CONDITIONS"));
} else {
$usedHandlers = $obCond->GetConditionHandlers();
}
}
if ($boolCond) {
$arFields['UNPACK'] = $strEval;
$arFields['CONDITIONS'] = serialize($arFields['CONDITIONS']);
if (!empty($usedHandlers)) {
$arFields['HANDLERS'] = $usedHandlers;
}
if (strtolower($DB->type) == 'mysql') {
if (64000 < CUtil::BinStrlen($arFields['UNPACK']) || 64000 < CUtil::BinStrlen($arFields['CONDITIONS'])) {
$boolResult = false;
$arMsg[] = array('id' => 'CONDITIONS', 'text' => Loc::getMessage('BT_MOD_CATALOG_DISC_ERR_CONDITIONS_TOO_LONG'));
unset($arFields['UNPACK']);
$arFields['CONDITIONS'] = unserialize($arFields['CONDITIONS']);
}
}
}
}
}
}
$intUserID = 0;
$boolUserExist = CCatalog::IsUserExists();
if ($boolUserExist) {
$intUserID = (int) $USER->GetID();
}
$strDateFunction = $DB->GetNowFunction();
$arFields['~TIMESTAMP_X'] = $strDateFunction;
if ($boolUserExist) {
if (!isset($arFields['MODIFIED_BY']) || (int) $arFields["MODIFIED_BY"] <= 0) {
$arFields["MODIFIED_BY"] = $intUserID;
}
}
if ($ACTION == 'ADD') {
$arFields['~DATE_CREATE'] = $strDateFunction;
if ($boolUserExist) {
if (!isset($arFields['CREATED_BY']) || (int) $arFields["CREATED_BY"] <= 0) {
$arFields["CREATED_BY"] = $intUserID;
}
}
}
if (!$boolResult) {
$obError = new CAdminException($arMsg);
$APPLICATION->ResetException();
$APPLICATION->ThrowException($obError);
}
return $boolResult;
}
示例13: OnBuildSaleMenu
function OnBuildSaleMenu(&$arGlobalMenu, &$arModuleMenu)
{
if (defined("BX_CATALOG_UNINSTALLED"))
return;
global $USER;
if (!CCatalog::IsUserExists())
return;
if (!Loader::includeModule("sale"))
return;
if (!defined("BX_SALE_MENU_CATALOG_CLEAR") || BX_SALE_MENU_CATALOG_CLEAR != 'Y')
return;
self::$catalogRead = $USER->CanDoOperation('catalog_read');
self::$catalogGroup = $USER->CanDoOperation('catalog_group');
self::$catalogPrice = $USER->CanDoOperation('catalog_price');
self::$catalogMeasure = $USER->CanDoOperation('catalog_measure');
self::$catalogDiscount = $USER->CanDoOperation('catalog_discount');
self::$catalogVat = $USER->CanDoOperation('catalog_vat');
self::$catalogExtra = $USER->CanDoOperation('catalog_extra');
self::$catalogStore = $USER->CanDoOperation('catalog_store');
self::$catalogExportEdit = $USER->CanDoOperation('catalog_export_edit');
self::$catalogExportExec = $USER->CanDoOperation('catalog_export_exec');
self::$catalogImportEdit = $USER->CanDoOperation('catalog_import_edit');
self::$catalogImportExec = $USER->CanDoOperation('catalog_import_exec');
CCatalogAdmin::OnBuildSaleMenuItem($arModuleMenu);
}
示例14: OnBuildSaleImportMenu
public static function OnBuildSaleImportMenu($strItemID)
{
global $USER;
global $adminMenu;
if (!CCatalog::IsUserExists()) {
return;
}
if (empty($strItemID)) {
return array();
}
$boolRead = $USER->CanDoOperation('catalog_read');
$boolImportEdit = $USER->CanDoOperation('catalog_import_edit');
$boolImportExec = $USER->CanDoOperation('catalog_import_exec');
$arProfileList = array();
if (($boolRead || $boolImportEdit || $boolImportExec) && method_exists($adminMenu, "IsSectionActive")) {
if ($adminMenu->IsSectionActive($strItemID)) {
$rsProfiles = CCatalogImport::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("IN_MENU" => "Y"));
while ($arProfile = $rsProfiles->Fetch()) {
$strName = strlen($arProfile["NAME"]) > 0 ? $arProfile["NAME"] : $arProfile["FILE_NAME"];
if ('Y' == $arProfile['DEFAULT_PROFILE']) {
$arProfileList[] = array("text" => htmlspecialcharsbx($strName), "url" => "cat_exec_imp.php?lang=" . LANGUAGE_ID . "&ACT_FILE=" . $arProfile["FILE_NAME"] . "&ACTION=IMPORT&PROFILE_ID=" . $arProfile["ID"] . "&" . bitrix_sessid_get(), "title" => Loc::getMessage("CAM_IMPORT_DESCR_IMPORT") . " "" . htmlspecialcharsbx($strName) . """, "readonly" => !$boolImportExec);
} else {
$arProfileList[] = array("text" => htmlspecialcharsbx($strName), "url" => "cat_import_setup.php?lang=" . LANGUAGE_ID . "&ACT_FILE=" . $arProfile["FILE_NAME"] . "&ACTION=IMPORT_EDIT&PROFILE_ID=" . $arProfile["ID"] . "&" . bitrix_sessid_get(), "title" => Loc::getMessage("CAM_IMPORT_DESCR_EDIT") . " "" . htmlspecialcharsbx($strName) . """, "readonly" => !$boolImportEdit);
}
}
}
}
return $arProfileList;
}
示例15: SubscribeProduct
function SubscribeProduct($intProductID, $arRewriteFields = array(), $arProductParams = array())
{
global $USER;
if (!CCatalog::IsUserExists())
return false;
if (!$USER->IsAuthorized())
return false;
$intUserID = intval($USER->GetID());
$intProductID = intval($intProductID);
if (0 >= $intProductID)
{
$APPLICATION->ThrowException(GetMessage('CATALOG_ERR_EMPTY_PRODUCT_ID'), "EMPTY_PRODUCT_ID");
return false;
}
if (!CModule::IncludeModule("sale"))
{
$APPLICATION->ThrowException(GetMessage('CATALOG_ERR_NO_SALE_MODULE'), "NO_SALE_MODULE");
return false;
}
if (CModule::IncludeModule("statistic") && array_key_exists('SESS_SEARCHER_ID', $_SESSION) && 0 < intval($_SESSION["SESS_SEARCHER_ID"]))
{
$APPLICATION->ThrowException(GetMessage('CATALOG_ERR_SESS_SEARCHER'), "SESS_SEARCHER");
return false;
}
$rsProducts = CCatalogProduct::GetList(
array(),
array('ID' => $intProductID),
false,
false,
array(
'ID',
'WEIGHT',
)
);
if (!($arCatalogProduct = $rsProducts->Fetch()))
{
$APPLICATION->ThrowException(GetMessage('CATALOG_ERR_NO_PRODUCT'), "NO_PRODUCT");
return false;
}
$rsItems = CIBlockElement::GetList(
array(),
array(
"ID" => $intProductID,
"ACTIVE" => "Y",
"ACTIVE_DATE" => "Y",
"CHECK_PERMISSIONS" => "Y",
"MIN_PERMISSION" => "R"
),
false,
false,
array(
'ID',
'IBLOCK_ID',
'NAME',
'XML_ID',
'DETAIL_PAGE_URL'
)
);
if (!($arProduct = $rsItems->Fetch()))
return false;
$arPrice = array(
'PRICE' => 0.0,
'CURRENCY' => CSaleLang::GetLangCurrency(SITE_ID),
'VAT_RATE' => 0,
'PRODUCT_PRICE_ID' => 0,
'CATALOG_GROUP_NAME' => '',
);
$arBuyerGroups = $USER->GetUserGroupArray();
$arSubscrPrice = CCatalogProduct::GetOptimalPrice($intProductID, 1, $arBuyerGroups, "N", array(), SITE_ID, array());
if (!empty($arSubscrPrice) && is_array($arSubscrPrice))
{
$arPrice['PRICE'] = $arSubscrPrice['DISCOUNT_PRICE'];
$arPrice['CURRENCY'] = CCurrency::GetBaseCurrency();
$arPrice['VAT_RATE'] = $arSubscrPrice['PRICE']['VAT_RATE'];
$arPrice['PRODUCT_PRICE_ID'] = $arSubscrPrice["PRICE"]["ID"];
$arPrice['CATALOG_GROUP_NAME'] = $arSubscrPrice["PRICE"]["CATALOG_GROUP_NAME"];
}
$arProps = array();
$strIBlockXmlID = strval(CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID'));
if ('' != $strIBlockXmlID)
{
$arProps[] = array(
"NAME" => "Catalog XML_ID",
"CODE" => "CATALOG.XML_ID",
"VALUE" => $strIBlockXmlID
);
}
$arProps[] = array(
"NAME" => "Product XML_ID",
"CODE" => "PRODUCT.XML_ID",
//.........这里部分代码省略.........