当前位置: 首页>>代码示例>>PHP>>正文


PHP CCatalogDiscount::SetProductSectionsCache方法代码示例

本文整理汇总了PHP中CCatalogDiscount::SetProductSectionsCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscount::SetProductSectionsCache方法的具体用法?PHP CCatalogDiscount::SetProductSectionsCache怎么用?PHP CCatalogDiscount::SetProductSectionsCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCatalogDiscount的用法示例。


在下文中一共展示了CCatalogDiscount::SetProductSectionsCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetOffersArray


//.........这里部分代码省略.........
					array('PRODUCT_ID' => $arOfferIDs),
					false,
					false,
					array('PRODUCT_ID', 'RATIO')
				);
				while ($arRatio = $rsRatios->Fetch())
				{
					$arRatio['PRODUCT_ID'] = intval($arRatio['PRODUCT_ID']);
					if (isset($arOffersLink[$arRatio['PRODUCT_ID']]))
					{
						$intRatio = intval($arRatio['RATIO']);
						$dblRatio = doubleval($arRatio['RATIO']);
						$mxRatio = ($dblRatio > $intRatio ? $dblRatio : $intRatio);
						if (CATALOG_VALUE_EPSILON > abs($mxRatio))
							$mxRatio = 1;
						elseif (0 > $mxRatio)
							$mxRatio = 1;
						$arOffersLink[$arRatio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
					}
				}

				if (!empty($arSelectProperties))
				{
					CIBlockElement::GetPropertyValuesArray($arOffersLink, $intOfferIBlockID, $arFilter);
					foreach ($arResult as &$arOffer)
					{
						CCatalogDiscount::SetProductPropertiesCache($arOffer['ID'], $arOffer["PROPERTIES"]);
						foreach ($arSelectProperties as $pid)
						{
							if (!isset($arOffer["PROPERTIES"][$pid]))
								continue;
							$prop = &$arOffer["PROPERTIES"][$pid];
							$boolArr = is_array($prop["VALUE"]);
							if(
								($boolArr && !empty($prop["VALUE"])) ||
								(!$boolArr && strlen($prop["VALUE"])>0))
							{
								$arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
							}
						}
						if (isset($arOffer))
							unset($arOffer);
					}
				}

				CCatalogDiscount::SetProductSectionsCache($arOfferIDs);
				CCatalogDiscount::SetDiscountProductCache($arOfferIDs, array('IBLOCK_ID' => $intOfferIBlockID, 'GET_BY_ID' => 'Y'));
				foreach ($arResult as &$arOffer)
				{
					$arOffer['CATALOG_QUANTITY'] = (
						0 < $arOffer['CATALOG_QUANTITY'] && is_float($arOffer['CATALOG_MEASURE_RATIO'])
						? floatval($arOffer['CATALOG_QUANTITY'])
						: intval($arOffer['CATALOG_QUANTITY'])
					);
					$arOffer['MIN_PRICE'] = false;
					$arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
					if (!empty($arOffer["PRICES"]))
					{
						foreach ($arOffer['PRICES'] as &$arOnePrice)
						{
							if ('Y' == $arOnePrice['MIN_PRICE'])
							{
								$arOffer['MIN_PRICE'] = $arOnePrice;
								break;
							}
						}
						unset($arOnePrice);
					}
					$arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
				}
				if (isset($arOffer))
					unset($arOffer);
			}
			if (!empty($arMeasureMap))
			{
				$rsMeasures = CCatalogMeasure::getList(
					array(),
					array('@ID' => array_keys($arMeasureMap)),
					false,
					false,
					array('ID', 'SYMBOL_RUS')
				);
				while ($arMeasure = $rsMeasures->GetNext())
				{
					$arMeasure['ID'] = intval($arMeasure['ID']);
					if (isset($arMeasureMap[$arMeasure['ID']]) && !empty($arMeasureMap[$arMeasure['ID']]))
					{
						foreach ($arMeasureMap[$arMeasure['ID']] as &$intOneKey)
						{
							$arResult[$intOneKey]['CATALOG_MEASURE_NAME'] = $arMeasure['SYMBOL_RUS'];
							$arResult[$intOneKey]['~CATALOG_MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
						}
						unset($intOneKey);
					}
				}
			}
		}

		return $arResult;
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:101,代码来源:comp_pricetools.php

示例2: array

     if (!empty($arMeasureMap)) {
         $rsMeasures = CCatalogMeasure::getList(array(), array('@ID' => array_keys($arMeasureMap)), false, false, array('ID', 'SYMBOL_RUS'));
         while ($arMeasure = $rsMeasures->GetNext()) {
             $arMeasure['ID'] = (int) $arMeasure['ID'];
             if (isset($arMeasureMap[$arMeasure['ID']]) && !empty($arMeasureMap[$arMeasure['ID']])) {
                 foreach ($arMeasureMap[$arMeasure['ID']] as &$intOneKey) {
                     $arResult['ITEMS'][$intOneKey]['CATALOG_MEASURE_NAME'] = $arMeasure['SYMBOL_RUS'];
                     $arResult['ITEMS'][$intOneKey]['~CATALOG_MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
                 }
                 unset($intOneKey);
             }
         }
     }
 }
 if ($bCatalog && $boolNeedCatalogCache && !empty($arResult["ELEMENTS"])) {
     CCatalogDiscount::SetProductSectionsCache($arResult["ELEMENTS"]);
     CCatalogDiscount::SetDiscountProductCache($arResult["ELEMENTS"], array('IBLOCK_ID' => $arParams["IBLOCK_ID"], 'GET_BY_ID' => 'Y'));
 }
 if (isset($arItem)) {
     unset($arItem);
 }
 $currentPath = CHTTP::urlDeleteParams($APPLICATION->GetCurPageParam(), array($arParams['PRODUCT_ID_VARIABLE'], $arParams['ACTION_VARIABLE'], ''), array('delete_system_params' => true));
 $currentPath .= stripos($currentPath, '?') === false ? '?' : '&';
 if ($arParams['COMPARE_PATH'] == '') {
     $comparePath = $currentPath;
 } else {
     $comparePath = CHTTP::urlDeleteParams($arParams['COMPARE_PATH'], array($arParams['PRODUCT_ID_VARIABLE'], $arParams['ACTION_VARIABLE'], ''), array('delete_system_params' => true));
     $comparePath .= stripos($comparePath, '?') === false ? '?' : '&';
 }
 $arParams['COMPARE_PATH'] = $comparePath . $arParams['ACTION_VARIABLE'] . '=COMPARE';
 $arResult['~BUY_URL_TEMPLATE'] = $currentPath . $arParams["ACTION_VARIABLE"] . "=BUY&" . $arParams["PRODUCT_ID_VARIABLE"] . "=#ID#";
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:component.php

示例3: GetOffersArray


//.........这里部分代码省略.........
                     }
                     $arMeasureMap[$arOffer['CATALOG_MEASURE']][] = $intKey;
                 }
                 $arOfferIDs[] = $arOffer['ID'];
                 $arResult[$intKey] = $arOffer;
                 if (!isset($arOffersLink[$arOffer['ID']])) {
                     $arOffersLink[$arOffer['ID']] =& $arResult[$intKey];
                 } else {
                     if (!isset($extPrices[$arOffer['ID']])) {
                         $extPrices[$arOffer['ID']] = array();
                     }
                     $extPrices[$arOffer['ID']][] =& $arResult[$intKey];
                 }
                 $intKey++;
             }
         }
         if (!empty($arOfferIDs)) {
             $rsRatios = CCatalogMeasureRatio::getList(array(), array('@PRODUCT_ID' => $arOfferIDs), false, false, array('PRODUCT_ID', 'RATIO'));
             while ($arRatio = $rsRatios->Fetch()) {
                 $arRatio['PRODUCT_ID'] = (int) $arRatio['PRODUCT_ID'];
                 if (isset($arOffersLink[$arRatio['PRODUCT_ID']])) {
                     $intRatio = (int) $arRatio['RATIO'];
                     $dblRatio = (double) $arRatio['RATIO'];
                     $mxRatio = $dblRatio > $intRatio ? $dblRatio : $intRatio;
                     if (CATALOG_VALUE_EPSILON > abs($mxRatio)) {
                         $mxRatio = 1;
                     } elseif (0 > $mxRatio) {
                         $mxRatio = 1;
                     }
                     $arOffersLink[$arRatio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
                 }
             }
             if (!empty($arSelectProperties)) {
                 CIBlockElement::GetPropertyValuesArray($arOffersLink, $intOfferIBlockID, $arFilter);
                 foreach ($arResult as &$arOffer) {
                     if (self::$needDiscountCache) {
                         CCatalogDiscount::SetProductPropertiesCache($arOffer['ID'], $arOffer["PROPERTIES"]);
                     }
                     foreach ($arSelectProperties as $pid) {
                         if (!isset($arOffer["PROPERTIES"][$pid])) {
                             continue;
                         }
                         $prop =& $arOffer["PROPERTIES"][$pid];
                         $boolArr = is_array($prop["VALUE"]);
                         if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                             $arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
                         }
                         unset($prop);
                     }
                 }
                 unset($arOffer);
             }
             if (!empty($extPrices)) {
                 foreach ($extPrices as $origID => $prices) {
                     foreach ($prices as $oneRow) {
                         $oneRow['PROPERTIES'] = $arOffersLink[$origID]['PROPERTIES'];
                         $oneRow['DISPLAY_PROPERTIES'] = $arOffersLink[$origID]['DISPLAY_PROPERTIES'];
                         $oneRow['CATALOG_MEASURE_RATIO'] = $arOffersLink[$origID]['CATALOG_MEASURE_RATIO'];
                     }
                 }
             }
             if (self::$needDiscountCache) {
                 CCatalogDiscount::SetProductSectionsCache($arOfferIDs);
                 CCatalogDiscount::SetDiscountProductCache($arOfferIDs, array('IBLOCK_ID' => $intOfferIBlockID, 'GET_BY_ID' => 'Y'));
             }
             foreach ($arResult as &$arOffer) {
                 $arOffer['CATALOG_QUANTITY'] = 0 < $arOffer['CATALOG_QUANTITY'] && is_float($arOffer['CATALOG_MEASURE_RATIO']) ? (double) $arOffer['CATALOG_QUANTITY'] : (int) $arOffer['CATALOG_QUANTITY'];
                 $arOffer['MIN_PRICE'] = false;
                 $arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
                 if (!empty($arOffer["PRICES"])) {
                     foreach ($arOffer['PRICES'] as &$arOnePrice) {
                         if ($arOnePrice['MIN_PRICE'] == 'Y') {
                             $arOffer['MIN_PRICE'] = $arOnePrice;
                             break;
                         }
                     }
                     unset($arOnePrice);
                 }
                 $arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
             }
             if (isset($arOffer)) {
                 unset($arOffer);
             }
         }
         if (!empty($arMeasureMap)) {
             $rsMeasures = CCatalogMeasure::getList(array(), array('@ID' => array_keys($arMeasureMap)), false, false, array('ID', 'SYMBOL_RUS'));
             while ($arMeasure = $rsMeasures->GetNext()) {
                 $arMeasure['ID'] = (int) $arMeasure['ID'];
                 if (isset($arMeasureMap[$arMeasure['ID']]) && !empty($arMeasureMap[$arMeasure['ID']])) {
                     foreach ($arMeasureMap[$arMeasure['ID']] as &$intOneKey) {
                         $arResult[$intOneKey]['CATALOG_MEASURE_NAME'] = $arMeasure['SYMBOL_RUS'];
                         $arResult[$intOneKey]['~CATALOG_MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
                     }
                     unset($intOneKey);
                 }
             }
         }
     }
     return $arResult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:comp_pricetools.php


注:本文中的CCatalogDiscount::SetProductSectionsCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。