本文整理汇总了PHP中CCatalogDiscount::GetDiscountIBlocksList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::GetDiscountIBlocksList方法的具体用法?PHP CCatalogDiscount::GetDiscountIBlocksList怎么用?PHP CCatalogDiscount::GetDiscountIBlocksList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscount
的用法示例。
在下文中一共展示了CCatalogDiscount::GetDiscountIBlocksList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ConvertDiscount
public static function ConvertDiscount($intStep = 100, $intMaxExecutionTime = 15)
{
global $DBType;
global $DB;
global $APPLICATION;
self::InitStep();
$intStep = intval($intStep);
if (0 >= $intStep) {
$intStep = 100;
}
$startConvertTime = getmicrotime();
$obDiscount = new CCatalogDiscount();
$strQueryPriceTypes = '';
$strQueryUserGroups = '';
$strTableName = '';
switch (ToUpper($DBType)) {
case 'MYSQL':
$strQueryPriceTypes = 'select CATALOG_GROUP_ID from b_catalog_discount2cat where DISCOUNT_ID = #ID#';
$strQueryUserGroups = 'select GROUP_ID from b_catalog_discount2group where DISCOUNT_ID = #ID#';
$strTableName = 'b_catalog_discount';
break;
case 'MSSQL':
$strQueryPriceTypes = 'select CATALOG_GROUP_ID from B_CATALOG_DISCOUNT2CAT where DISCOUNT_ID = #ID#';
$strQueryUserGroups = 'select GROUP_ID from B_CATALOG_DISCOUNT2GROUP where DISCOUNT_ID = #ID#';
$strTableName = 'B_CATALOG_DISCOUNT';
break;
case 'ORACLE':
$strQueryPriceTypes = 'select CATALOG_GROUP_ID from B_CATALOG_DISCOUNT2CAT where DISCOUNT_ID = #ID#';
$strQueryUserGroups = 'select GROUP_ID from B_CATALOG_DISCOUNT2GROUP where DISCOUNT_ID = #ID#';
$strTableName = 'B_CATALOG_DISCOUNT';
break;
}
CTimeZone::Disable();
$rsDiscounts = CCatalogDiscount::GetList(array('ID' => 'ASC'), array('TYPE' => DISCOUNT_TYPE_STANDART, 'VERSION' => CATALOG_DISCOUNT_OLD_VERSION), false, array('nTopCount' => $intStep), array('ID', 'MODIFIED_BY', 'TIMESTAMP_X', 'NAME'));
while ($arDiscount = $rsDiscounts->Fetch()) {
$boolActive = true;
$arSrcEntity = array();
$arFields = array();
$arFields['MODIFIED_BY'] = $arDiscount['MODIFIED_BY'];
$arPriceTypes = array();
$arUserGroups = array();
$rsPriceTypes = $DB->Query(str_replace('#ID#', $arDiscount['ID'], $strQueryPriceTypes), false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($arPrice = $rsPriceTypes->Fetch()) {
$arPrice['CATALOG_GROUP_ID'] = intval($arPrice['CATALOG_GROUP_ID']);
if (0 < $arPrice['CATALOG_GROUP_ID']) {
$arPriceTypes[] = $arPrice['CATALOG_GROUP_ID'];
}
}
if (!empty($arPriceTypes)) {
$arPriceTypes = array_values(array_unique($arPriceTypes));
} else {
$arPriceTypes = array(-1);
}
$rsUserGroups = $DB->Query(str_replace('#ID#', $arDiscount['ID'], $strQueryUserGroups), false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($arGroup = $rsUserGroups->Fetch()) {
$arGroup['GROUP_ID'] = intval($arGroup['GROUP_ID']);
if (0 < $arGroup['GROUP_ID']) {
$arUserGroups[] = $arGroup['GROUP_ID'];
}
}
if (!empty($arUserGroups)) {
$arUserGroups = array_values(array_unique($arUserGroups));
} else {
$arUserGroups = array(-1);
}
$arFields['CATALOG_GROUP_IDS'] = $arPriceTypes;
$arFields['GROUP_IDS'] = $arUserGroups;
$arIBlockList = array();
$arSectionList = array();
$arElementList = array();
$arConditions = array('CLASS_ID' => 'CondGroup', 'DATA' => array('All' => 'AND', 'True' => 'True'), 'CHILDREN' => array());
$intEntityCount = 0;
$boolEmpty = true;
$arSrcList = array();
$rsIBlocks = CCatalogDiscount::GetDiscountIBlocksList(array(), array('DISCOUNT_ID' => $arDiscount['ID']), false, false, array('IBLOCK_ID'));
while ($arIBlock = $rsIBlocks->Fetch()) {
$boolEmpty = false;
$arSrcList[] = $arIBlock['IBLOCK_ID'];
$arIBlock['IBLOCK_ID'] = intval($arIBlock['IBLOCK_ID']);
if (0 < $arIBlock['IBLOCK_ID']) {
$strName = CIBlock::GetArrayByID($arIBlock['IBLOCK_ID'], 'NAME');
if (false !== $strName && !is_null($strName)) {
$arIBlockList[] = $arIBlock['IBLOCK_ID'];
}
}
}
if (!empty($arIBlockList)) {
$arIBlockList = array_values(array_unique($arIBlockList));
$intEntityCount++;
} else {
if (!$boolEmpty) {
$boolActive = false;
$arSrcEntity[] = str_replace('#IDS#', implode(', ', $arSrcList), GetMessage('BT_MOD_CAT_DSC_CONV_ENTITY_IBLOCK_ERR'));
}
}
$boolEmpty = true;
$arSrcList = array();
$rsSections = CCatalogDiscount::GetDiscountSectionsList(array(), array('DISCOUNT_ID' => $arDiscount['ID']), false, false, array('SECTION_ID'));
while ($arSection = $rsSections->Fetch()) {
$boolEmpty = false;
//.........这里部分代码省略.........