минимальная / максимальная цена торговых предложений в карточке

	function gete_offer_min_price($item_id){
    $ret = 0;
    
    CModule::IncludeModule("iblock");
    CModule::IncludeModule("catalog");
    // ID инфоблока товаров
    $IBLOCK_ID = 1; 
    $ID = $item_id; 
    $arInfo = CCatalogSKU::GetInfoByProductIBlock($IBLOCK_ID);
    
    if (is_array($arInfo)) {
        $res = CIBlockElement::GetList(Array("CATALOG_PRICE_1"=>"ASC"), 
                                       array('IBLOCK_ID'=>$arInfo['IBLOCK_ID'], 'ACTIVE'=>'Y', 'PROPERTY_'.$arInfo['SKU_PROPERTY_ID'] => $ID), 
                                       false, 
                                       false, 
                                       array('ID', 'NAME'))->GetNext();
        if ($res){
            $ret = GetCatalogProductPrice($res["ID"], 1);
            if ($ret['PRICE']){
                $ret = $ret['PRICE'];
            }
        }
    }
    return $ret = number_format($ret, 0, '', ' ' );
	
	
	
}

function get_offer_max_price($item_id){
   $ret = 0;
    
    CModule::IncludeModule("iblock");
    CModule::IncludeModule("catalog");
    // ID инфоблока товаров
    $IBLOCK_ID = 1; 
  //  $ID = $item_id; 
    $arInfo = CCatalogSKU::GetInfoByProductIBlock($IBLOCK_ID); 
    if (is_array($arInfo)) {
        $res = CIBlockElement::GetList(Array("CATALOG_PRICE_1"=>"DESC"), 
                                       array('IBLOCK_ID'=>$arInfo['IBLOCK_ID'], 'ACTIVE'=>'Y', 'PROPERTY_'.$arInfo['SKU_PROPERTY_ID'] => $item_id), 
                                       false, 
                                       false, 
                                       array('ID', 'NAME'))->GetNext();
        if ($res){
            $ret = GetCatalogProductPrice($res["ID"], 1);
            if ($ret['PRICE']){
                $ret = $ret['PRICE'];
            }
        }
    }
    return $ret = number_format($ret, 0, '', ' ' );
	
}

		<? if (gete_offer_min_price($arItem['ID']) != get_offer_max_price($arItem['ID'])): ?>
							<span class="value"><? echo gete_offer_min_price($arItem['ID']).' - '.get_offer_max_price($arItem['ID']);?></span>
							<?else:?>
							<span class="value"><? echo gete_offer_min_price($arItem['ID']);?></span>
							<?endif?>

Tags :