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


PHP CIBlockPriceTools::GetOffersIBlock方法代码示例

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


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

示例1: array

if('Y' == $arCurrentValues['SHOW_SECTION_PICTURE']){
	$arTemplateParameters['SECTION_PICTURE_WIDTH'] = array(
		'PARENT' => 'LIST_SETTINGS',
		'NAME' => getMessage('RS_SLINE.SECTION_PICTURE_WIDTH'),
		'TYPE' => 'STRING',
		'DEFAULT' => '',
	);
	$arTemplateParameters['SECTION_PICTURE_HEIGHT'] = array(
		'PARENT' => 'LIST_SETTINGS',
		'NAME' => getMessage('RS_SLINE.SECTION_PICTURE_HEIGHT'),
		'TYPE' => 'STRING',
		'DEFAULT' => '',
	);
}

$arOffers = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
$OFFERS_IBLOCK_ID = is_array($arOffers) ? $arOffers['OFFERS_IBLOCK_ID']: 0;

if($OFFERS_IBLOCK_ID){
	$arProperty_Offers = array();
	$rsProp = CIBlockProperty::GetList(array('sort'=>'asc', 'name'=>'asc'), array('IBLOCK_ID'=>$OFFERS_IBLOCK_ID, 'ACTIVE'=>'Y'));
	while($arr=$rsProp->Fetch()){
		$arr['ID'] = intval($arr['ID']);
		if ($arOffers['OFFERS_PROPERTY_ID'] == $arr['ID'])
			continue;
		$strPropName = '['.$arr['ID'].']'.('' != $arr['CODE'] ? '['.$arr['CODE'].']' : '').' '.$arr['NAME'];
		if ('' == $arr['CODE'])
			$arr['CODE'] = $arr['ID'];
		$arProperty_Offers[$arr['CODE']] = $strPropName;
	}
开发者ID:Andreyjktl,项目名称:test_mega_template,代码行数:30,代码来源:.parameters.php

示例2: array

		if($arResult["ID"])
			$arFilter["SECTION_ID"] = $arResult["ID"];
		elseif(!$arParams["SHOW_ALL_WO_SECTION"])
			$arFilter["SECTION_ID"] = 0;
		else
		{
			if (is_set($arFilter, 'INCLUDE_SUBSECTIONS'))
				unset($arFilter["INCLUDE_SUBSECTIONS"]);
			if (is_set($arFilter, 'SECTION_GLOBAL_ACTIVE'))
				unset($arFilter["SECTION_GLOBAL_ACTIVE"]);
		}
	}

	if(is_array($arrFilter["OFFERS"]))
	{
		$arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($arParams["IBLOCK_ID"]);
		if(is_array($arOffersIBlock))
		{
			if(!empty($arrFilter["OFFERS"]))
			{
				$arSubFilter = $arrFilter["OFFERS"];
				$arSubFilter["IBLOCK_ID"] = $arOffersIBlock["OFFERS_IBLOCK_ID"];
				$arSubFilter["ACTIVE_DATE"] = "Y";
				$arSubFilter["ACTIVE"] = "Y";
				if ('Y' == $arParams['HIDE_NOT_AVAILABLE'])
					$arSubFilter['CATALOG_AVAILABLE'] = 'Y';
				$arFilter["=ID"] = CIBlockElement::SubQuery("PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"], $arSubFilter);
			}

			$arPriceFilter = array();
			foreach($arrFilter as $key => $value)
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:component.php

示例3: array

    }
}
if (!empty($arCurrentValues['IBLOCK_ID'])) {
    $arIBlocks = $arCurrentValues['IBLOCK_ID'];
} else {
    $rsIBlock = CIBlock::GetList(array("sort" => "asc"), array("TYPE" => $arCurrentValues["IBLOCK_TYPE_ID"], "ACTIVE" => "Y"));
    while ($arr = $rsIBlock->Fetch()) {
        $arIBlocks = $arr["ID"];
    }
}
if (!empty($arIBlocks)) {
    $arProperty_Offers = array();
    //foreach ($arIBlocks as $intIBlockID)
    //{
    if (intval($arIBlocks) > 0) {
        $arOffers = CIBlockPriceTools::GetOffersIBlock($arIBlocks);
        $OFFERS_IBLOCK_ID = is_array($arOffers) ? $arOffers["OFFERS_IBLOCK_ID"] : 0;
        if ($OFFERS_IBLOCK_ID) {
            $OFFERS_IBLOCK_ID2 = true;
            $rsProp = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", "IBLOCK_ID" => $OFFERS_IBLOCK_ID));
            while ($arr = $rsProp->Fetch()) {
                if ($arr["PROPERTY_TYPE"] != "F") {
                    $arProperty_Offers[$arr["CODE"]] = "[" . $arr["CODE"] . "] " . $arr["NAME"];
                }
            }
        }
    }
    //}
}
$arPrice = array();
if (CModule::IncludeModule("catalog")) {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:.parameters.php

示例4: count

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$curSkuView = COption::GetOptionString("eshop", "catalogDetailSku", "select", SITE_ID);
if (is_array($arResult["OFFERS"]) && !empty($arResult["OFFERS"])) {
    $pricesCount = count($arResult["CAT_PRICES"]);
    $arOffersIblock = CIBlockPriceTools::GetOffersIBlock($arResult["IBLOCK_ID"]);
    $OFFERS_IBLOCK_ID = is_array($arOffersIblock) ? $arOffersIblock["OFFERS_IBLOCK_ID"] : 0;
    $dbOfferProperties = CIBlock::GetProperties($OFFERS_IBLOCK_ID, array(), array("!XML_ID" => "CML2_LINK"));
    $arIblockOfferProps = array();
    $offerPropsExists = false;
    while ($arOfferProperties = $dbOfferProperties->Fetch()) {
        if (!in_array($arOfferProperties["CODE"], $arParams["OFFERS_PROPERTY_CODE"])) {
            continue;
        }
        $arIblockOfferProps[] = array("CODE" => $arOfferProperties["CODE"], "NAME" => $arOfferProperties["NAME"]);
        $offerPropsExists = true;
    }
    foreach ($arIblockOfferProps as $key => $arCode) {
        $emptyProp = true;
        foreach ($arResult["OFFERS"] as $key2 => $arOffer) {
            if (array_key_exists($arCode["CODE"], $arOffer["PROPERTIES"]) && !empty($arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"])) {
                $emptyProp = false;
            }
        }
        if ($emptyProp) {
            unset($arIblockOfferProps[$key]);
        }
    }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:result_modifier.php

示例5: GetOffersArray

	public static function GetOffersArray($arFilter, $arElementID, $arOrder, $arSelectFields, $arSelectProperties, $limit, $arPrices, $vat_include, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
	{
		$arResult = array();

		$boolCheckPermissions = false;
		$boolHideNotAvailable = false;
		$IBLOCK_ID = 0;
		if (!empty($arFilter) && is_array($arFilter))
		{
			if (isset($arFilter['IBLOCK_ID']))
				$IBLOCK_ID = $arFilter['IBLOCK_ID'];
			if (isset($arFilter['HIDE_NOT_AVAILABLE']))
				$boolHideNotAvailable = 'Y' === $arFilter['HIDE_NOT_AVAILABLE'];
			if (isset($arFilter['CHECK_PERMISSIONS']))
				$boolCheckPermissions = 'Y' === $arFilter['CHECK_PERMISSIONS'];
		}
		else
		{
			$IBLOCK_ID = $arFilter;
		}

		$arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
		if($arOffersIBlock)
		{
			$arDefaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);

			$limit = intval($limit);
			if (0 > $limit)
				$limit = 0;

			if(!isset($arOrder["ID"]))
				$arOrder["ID"] = "DESC";

			$intOfferIBlockID = $arOffersIBlock["OFFERS_IBLOCK_ID"];

			$arFilter = array(
				"IBLOCK_ID" => $intOfferIBlockID,
				"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => $arElementID,
				"ACTIVE" => "Y",
				"ACTIVE_DATE" => "Y",
			);
			if ($boolHideNotAvailable)
				$arFilter['CATALOG_AVAILABLE'] = 'Y';
			if ($boolCheckPermissions)
			{
				$arFilter['CHECK_PERMISSIONS'] = "Y";
				$arFilter['MIN_PERMISSION'] = "R";
			}

			$arSelect = array(
				"ID" => 1,
				"IBLOCK_ID" => 1,
				"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => 1,
				"CATALOG_QUANTITY" => 1
			);
			//if(!$arParams["USE_PRICE_COUNT"])
			{
				foreach($arPrices as $value)
				{
					if (!$value['CAN_VIEW'] && !$value['CAN_BUY'])
						continue;
					$arSelect[$value["SELECT"]] = 1;
				}
			}

			foreach($arSelectFields as $code)
				$arSelect[$code] = 1; //mark to select
			if (!isset($arSelect['PREVIEW_PICTURE']))
				$arSelect['PREVIEW_PICTURE'] = 1;
			if (!isset($arSelect['DETAIL_PICTURE']))
				$arSelect['DETAIL_PICTURE'] = 1;

			$arOfferIDs = array();
			$arMeasureMap = array();
			$intKey = 0;
			$arOffersPerElement = array();
			$arOffersLink = array();
			$rsOffers = CIBlockElement::GetList($arOrder, $arFilter, false, false, array_keys($arSelect));
			while($arOffer = $rsOffers->GetNext())
			{
				$arOffer['ID'] = intval($arOffer['ID']);
				$element_id = $arOffer["PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"]."_VALUE"];
				//No more than limit offers per element
				if($limit > 0)
				{
					$arOffersPerElement[$element_id]++;
					if($arOffersPerElement[$element_id] > $limit)
						continue;
				}

				if($element_id > 0)
				{
					$arOffer["LINK_ELEMENT_ID"] = intval($element_id);
					$arOffer["PROPERTIES"] = array();
					$arOffer["DISPLAY_PROPERTIES"] = array();

					$arOffer['CHECK_QUANTITY'] = ('Y' == $arOffer['CATALOG_QUANTITY_TRACE'] && 'N' == $arOffer['CATALOG_CAN_BUY_ZERO']);
					$arOffer['CATALOG_TYPE'] = CCatalogProduct::TYPE_OFFER;
					$arOffer['CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
					$arOffer['~CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:open_bx,代码行数:101,代码来源:comp_pricetools.php

示例6: GetOffersArray

	public static function GetOffersArray($IBLOCK_ID, $arElementID, $arOrder, $arSelectFields, $arSelectProperties, $limit, $arPrices, $vat_include, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
	{
		$arResult = array();

		$arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
		if($arOffersIBlock)
		{
			$limit = intval($limit);
			if (0 > $limit)
				$limit = 0;

			if(!array_key_exists("ID", $arOrder))
				$arOrder["ID"] = "DESC";

			$arFilter = array(
				"IBLOCK_ID" => $arOffersIBlock["OFFERS_IBLOCK_ID"],
				"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => $arElementID,
				"ACTIVE" => "Y",
				"ACTIVE_DATE" => "Y",
			);

			$arSelect = array(
				"ID" => 1,
				"IBLOCK_ID" => 1,
				"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => 1,
			);
			//if(!$arParams["USE_PRICE_COUNT"])
			{
				foreach($arPrices as $value)
				{
					$arSelect[$value["SELECT"]] = 1;
					//$arrFilter["CATALOG_SHOP_QUANTITY_".$value["ID"]] = $arParams["SHOW_PRICE_COUNT"];
				}
			}

			foreach($arSelectFields as $code)
				$arSelect[$code] = 1; //mark to select

			$arOffersPerElement = array();
			$rsOffers = CIBlockElement::GetList($arOrder, $arFilter, false, false, array_keys($arSelect));
			while($obOffer = $rsOffers->GetNextElement())
			{
				$arOffer = $obOffer->GetFields();
				$element_id = $arOffer["PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"]."_VALUE"];
				//No more than limit offers per element
				if($limit > 0)
				{
					$arOffersPerElement[$element_id]++;
					if($arOffersPerElement[$element_id] > $limit)
						continue;
				}

				if($element_id > 0)
				{
					$arOffer["LINK_ELEMENT_ID"] = $element_id;
					$arOffer["DISPLAY_PROPERTIES"] = array();
					if(!empty($arSelectProperties))
					{
						$arOffer["PROPERTIES"] = $obOffer->GetProperties();
						foreach($arSelectProperties as $pid)
						{
							$prop = &$arOffer["PROPERTIES"][$pid];
							if((is_array($prop["VALUE"]) && count($prop["VALUE"])>0) ||
							(!is_array($prop["VALUE"]) && strlen($prop["VALUE"])>0))
							{
								$arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
							}
						}
					}

					$arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
					$arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
				}
				$arResult[] = $arOffer;
			}
		}

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

示例7: array

     }
 }
 if (!isset($arParams["OFFERS_PROPERTY_CODE"])) {
     $arParams["OFFERS_PROPERTY_CODE"] = array();
 }
 foreach ($arParams["OFFERS_PROPERTY_CODE"] as $key => $value) {
     if ($value === "") {
         unset($arParams["OFFERS_PROPERTY_CODE"][$key]);
     }
 }
 $baseCurrency = CCurrency::GetBaseCurrency();
 if (!empty($arResult["IDS"]) && (!empty($arParams["OFFERS_FIELD_CODE"]) || !empty($arParams["OFFERS_PROPERTY_CODE"]))) {
     $arOffers = array();
     //foreach($arParams['IBLOCK_ID'] as $key => $iblockID)
     //{
     $arOffersIblock = CIBlockPriceTools::GetOffersIBlock($arParams['IBLOCK_ID']);
     $OFFERS_IBLOCK_ID = is_array($arOffersIblock) ? $arOffersIblock["OFFERS_IBLOCK_ID"] : 0;
     //if(!$OFFERS_IBLOCK_ID)
     //	continue;
     $arElementsOffer = array();
     foreach ($arResult["ITEMS"] as $key2 => $arElement) {
         if ($arElement["IBLOCK_ID"] == $arParams['IBLOCK_ID']) {
             $arElementsOffer[$key2] = $arElement["ID"];
         }
     }
     //if (empty($arElementsOffer)) continue;
     $arOffers = CIBlockPriceTools::GetOffersArray($arParams['IBLOCK_ID'], $arElementsOffer, array($arParams["OFFERS_SORT_FIELD"] => $arParams["OFFERS_SORT_ORDER"], "ID" => "DESC"), $arParams["OFFERS_FIELD_CODE"], $arParams["OFFERS_PROPERTY_CODE"], $arParams["OFFERS_LIMIT"], $arResult["PRICES"], $arParams['PRICE_VAT_INCLUDE'], $arConvertParams);
     if (!empty($arOffers)) {
         $arElementOffer = array();
         foreach ($arElementsOffer as $i => $id) {
             $arResult["ITEMS"][$i]["OFFERS"] = array();
开发者ID:Bogacheva-Elena,项目名称:Components-EKO-KOVRY,代码行数:31,代码来源:component.php

示例8: GetOffersArray

 public static function GetOffersArray($arFilter, $arElementID, $arOrder, $arSelectFields, $arSelectProperties, $limit, $arPrices, $vat_include, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
 {
     global $USER;
     $arResult = array();
     $boolCheckPermissions = false;
     $boolHideNotAvailable = false;
     $showPriceCount = false;
     $IBLOCK_ID = 0;
     if (!empty($arFilter) && is_array($arFilter)) {
         if (isset($arFilter['IBLOCK_ID'])) {
             $IBLOCK_ID = $arFilter['IBLOCK_ID'];
         }
         if (isset($arFilter['HIDE_NOT_AVAILABLE'])) {
             $boolHideNotAvailable = $arFilter['HIDE_NOT_AVAILABLE'] === 'Y';
         }
         if (isset($arFilter['CHECK_PERMISSIONS'])) {
             $boolCheckPermissions = $arFilter['CHECK_PERMISSIONS'] === 'Y';
         }
         if (isset($arFilter['SHOW_PRICE_COUNT'])) {
             $showPriceCount = (int) $arFilter['SHOW_PRICE_COUNT'];
             if ($showPriceCount <= 0) {
                 $showPriceCount = false;
             }
         }
     } else {
         $IBLOCK_ID = $arFilter;
     }
     if (self::$needDiscountCache === null) {
         $pricesAllow = CIBlockPriceTools::GetAllowCatalogPrices($arPrices);
         if (empty($pricesAllow)) {
             self::$needDiscountCache = false;
         } else {
             $USER_ID = (int) $USER_ID;
             $userGroups = $USER_ID > 0 ? CUser::GetUserGroup($USER_ID) : $USER->GetUserGroupArray();
             self::$needDiscountCache = CIBlockPriceTools::SetCatalogDiscountCache($pricesAllow, $userGroups);
             unset($userGroups);
         }
         unset($pricesAllow);
     }
     $arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
     if ($arOffersIBlock) {
         $arDefaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);
         $limit = (int) $limit;
         if (0 > $limit) {
             $limit = 0;
         }
         if (!isset($arOrder["ID"])) {
             $arOrder["ID"] = "DESC";
         }
         $intOfferIBlockID = $arOffersIBlock["OFFERS_IBLOCK_ID"];
         $productProperty = 'PROPERTY_' . $arOffersIBlock['OFFERS_PROPERTY_ID'];
         $productPropertyValue = $productProperty . '_VALUE';
         $arFilter = array("IBLOCK_ID" => $intOfferIBlockID, $productProperty => $arElementID, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y");
         if ($boolHideNotAvailable) {
             $arFilter['CATALOG_AVAILABLE'] = 'Y';
         }
         if ($boolCheckPermissions) {
             $arFilter['CHECK_PERMISSIONS'] = "Y";
             $arFilter['MIN_PERMISSION'] = "R";
         }
         $arSelect = array("ID" => 1, "IBLOCK_ID" => 1, $productProperty => 1, "CATALOG_QUANTITY" => 1);
         foreach ($arPrices as $value) {
             if (!$value['CAN_VIEW'] && !$value['CAN_BUY']) {
                 continue;
             }
             $arSelect[$value["SELECT"]] = 1;
             if ($showPriceCount !== false) {
                 $arFilter['CATALOG_SHOP_QUANTITY_' . $value['ID']] = $showPriceCount;
             }
         }
         foreach ($arSelectFields as $code) {
             $arSelect[$code] = 1;
         }
         //mark to select
         if (!isset($arSelect['PREVIEW_PICTURE'])) {
             $arSelect['PREVIEW_PICTURE'] = 1;
         }
         if (!isset($arSelect['DETAIL_PICTURE'])) {
             $arSelect['DETAIL_PICTURE'] = 1;
         }
         $arOfferIDs = array();
         $arMeasureMap = array();
         $intKey = 0;
         $arOffersPerElement = array();
         $arOffersLink = array();
         $extPrices = array();
         $rsOffers = CIBlockElement::GetList($arOrder, $arFilter, false, false, array_keys($arSelect));
         while ($arOffer = $rsOffers->GetNext()) {
             $arOffer['ID'] = (int) $arOffer['ID'];
             $element_id = (int) $arOffer[$productPropertyValue];
             //No more than limit offers per element
             if ($limit > 0) {
                 $arOffersPerElement[$element_id]++;
                 if ($arOffersPerElement[$element_id] > $limit) {
                     continue;
                 }
             }
             if ($element_id > 0) {
                 $arOffer["LINK_ELEMENT_ID"] = $element_id;
                 $arOffer["PROPERTIES"] = array();
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:comp_pricetools.php

示例9: DoIBlockAfterSave

function DoIBlockAfterSave($arg1, $arg2 = false)
{
    $ELEMENT_ID = false;
    $IBLOCK_ID = false;
    $OFFERS_IBLOCK_ID = false;
    $OFFERS_PROPERTY_ID = false;
    if (CModule::IncludeModule('currency')) {
        $strDefaultCurrency = CCurrency::GetBaseCurrency();
    }
    //Check for catalog event
    if (is_array($arg2) && $arg2["PRODUCT_ID"] > 0) {
        //Get iblock element
        $rsPriceElement = CIBlockElement::GetList(array(), array("ID" => $arg2["PRODUCT_ID"]), false, false, array("ID", "IBLOCK_ID"));
        if ($arPriceElement = $rsPriceElement->Fetch()) {
            $arCatalog = CCatalog::GetByID($arPriceElement["IBLOCK_ID"]);
            if (is_array($arCatalog)) {
                //Check if it is offers iblock
                if ($arCatalog["OFFERS"] == "Y") {
                    //Find product element
                    $rsElement = CIBlockElement::GetProperty($arPriceElement["IBLOCK_ID"], $arPriceElement["ID"], "sort", "asc", array("ID" => $arCatalog["SKU_PROPERTY_ID"]));
                    $arElement = $rsElement->Fetch();
                    if ($arElement && $arElement["VALUE"] > 0) {
                        $ELEMENT_ID = $arElement["VALUE"];
                        $IBLOCK_ID = $arCatalog["PRODUCT_IBLOCK_ID"];
                        $OFFERS_IBLOCK_ID = $arCatalog["IBLOCK_ID"];
                        $OFFERS_PROPERTY_ID = $arCatalog["SKU_PROPERTY_ID"];
                    }
                } elseif ($arCatalog["OFFERS_IBLOCK_ID"] > 0) {
                    $ELEMENT_ID = $arPriceElement["ID"];
                    $IBLOCK_ID = $arPriceElement["IBLOCK_ID"];
                    $OFFERS_IBLOCK_ID = $arCatalog["OFFERS_IBLOCK_ID"];
                    $OFFERS_PROPERTY_ID = $arCatalog["OFFERS_PROPERTY_ID"];
                } else {
                    $ELEMENT_ID = $arPriceElement["ID"];
                    $IBLOCK_ID = $arPriceElement["IBLOCK_ID"];
                    $OFFERS_IBLOCK_ID = false;
                    $OFFERS_PROPERTY_ID = false;
                }
            }
        }
    } elseif (is_array($arg1) && $arg1["ID"] > 0 && $arg1["IBLOCK_ID"] > 0) {
        //Check if iblock has offers
        $arOffers = CIBlockPriceTools::GetOffersIBlock($arg1["IBLOCK_ID"]);
        if (is_array($arOffers)) {
            $ELEMENT_ID = $arg1["ID"];
            $IBLOCK_ID = $arg1["IBLOCK_ID"];
            $OFFERS_IBLOCK_ID = $arOffers["OFFERS_IBLOCK_ID"];
            $OFFERS_PROPERTY_ID = $arOffers["OFFERS_PROPERTY_ID"];
        }
    }
    if ($ELEMENT_ID) {
        static $arPropCache = array();
        if (!array_key_exists($IBLOCK_ID, $arPropCache)) {
            //Check for MINIMAL_PRICE property
            $rsProperty = CIBlockProperty::GetByID("MINIMUM_PRICE", $IBLOCK_ID);
            $arProperty = $rsProperty->Fetch();
            if ($arProperty) {
                $arPropCache[$IBLOCK_ID] = $arProperty["ID"];
            } else {
                $arPropCache[$IBLOCK_ID] = false;
            }
        }
        if ($arPropCache[$IBLOCK_ID]) {
            //Compose elements filter
            if ($OFFERS_IBLOCK_ID) {
                $rsOffers = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $OFFERS_IBLOCK_ID, "PROPERTY_" . $OFFERS_PROPERTY_ID => $ELEMENT_ID), false, false, array("ID"));
                while ($arOffer = $rsOffers->Fetch()) {
                    $arProductID[] = $arOffer["ID"];
                }
                if (!is_array($arProductID)) {
                    $arProductID = array($ELEMENT_ID);
                }
            } else {
                $arProductID = array($ELEMENT_ID);
            }
            $minPrice = false;
            $maxPrice = false;
            //Get prices
            $rsPrices = CPrice::GetList(array(), array("PRODUCT_ID" => $arProductID));
            while ($arPrice = $rsPrices->Fetch()) {
                if (CModule::IncludeModule('currency') && $strDefaultCurrency != $arPrice['CURRENCY']) {
                    $arPrice["PRICE"] = CCurrencyRates::ConvertCurrency($arPrice["PRICE"], $arPrice["CURRENCY"], $strDefaultCurrency);
                }
                $PRICE = $arPrice["PRICE"];
                if ($minPrice === false || $minPrice > $PRICE) {
                    $minPrice = $PRICE;
                }
                if ($maxPrice === false || $maxPrice < $PRICE) {
                    $maxPrice = $PRICE;
                }
            }
            //Save found minimal price into property
            if ($minPrice !== false) {
                CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, $IBLOCK_ID, array("MINIMUM_PRICE" => $minPrice, "MAXIMUM_PRICE" => $maxPrice));
            }
        }
    }
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:98,代码来源:sort_scu.php


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