protected function modifyDisplayProperties($iblock, &$iblockElements)
{
if (!empty($iblockElements))
{
reset($iblockElements);
$elementKey = key($iblockElements);
$element =& $iblockElements[$elementKey];
$iblockParams = $this->storage['IBLOCK_PARAMS'][$iblock];
$propFilter = array(
'ID' => array_keys($iblockElements),
'IBLOCK_ID' => $iblock
);
CIBlockElement::GetPropertyValuesArray($iblockElements, $iblock, $propFilter);
if (!empty($iblockParams['PROPERTY_CODE']))
{
$propertyList = $this->getPropertyList($iblock, $iblockParams['PROPERTY_CODE']);
}
if ($this->useCatalog && $this->useDiscountCache)
{
if ($this->storage['USE_SALE_DISCOUNTS'])
CatalogDiscountDiscountManager::setProductPropertiesCache($element['ID'], $element["PROPERTIES"]);
else
CCatalogDiscount::SetProductPropertiesCache($element['ID'], $element['PROPERTIES']);
}
if (!empty($propertyList))
{
foreach ($propertyList as $pid)
{
if (!isset($element['PROPERTIES'][$pid]))
continue;
$prop =& $element['PROPERTIES'][$pid];
$isArr = is_array($prop['VALUE']);
if (
($isArr && !empty($prop['VALUE']))
|| (!$isArr && (string)$prop['VALUE'] !== '')
|| Tools::isCheckboxProperty($prop)
)
{
$element['DISPLAY_PROPERTIES'][$pid] = CIBlockFormatProperties::GetDisplayValue($element, $prop);
}
unset($prop);
}
unset($pid);
CIBlockFormatProperties::clearCache();
Tools::clearCache();
}
if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] === 'Y' && !empty($iblockParams['CART_PROPERTIES']))
{
$element['PRODUCT_PROPERTIES'] = CIBlockPriceTools::GetProductProperties(
$iblock,
$element['ID'],
$iblockParams['CART_PROPERTIES'],
$element['PROPERTIES']
);
if (!empty($element['PRODUCT_PROPERTIES']))
{
$element['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($element['PRODUCT_PROPERTIES']);
}
}
$element['BACKGROUND_IMAGE'] = false;
if ($this->arParams['BACKGROUND_IMAGE'] != '' && isset($element['PROPERTIES'][$this->arParams['BACKGROUND_IMAGE']]))
{
if (!empty($element['PROPERTIES'][$this->arParams['BACKGROUND_IMAGE']]['VALUE']))
{
$element['BACKGROUND_IMAGE'] = CFile::GetFileArray($element['PROPERTIES'][$this->arParams['BACKGROUND_IMAGE']]['VALUE']);
}
}
$element['MORE_PHOTO'] = array();
if (!empty($element['PROPERTIES']['MORE_PHOTO']['VALUE']) && is_array($element['PROPERTIES']['MORE_PHOTO']['VALUE']))
{
foreach ($element['PROPERTIES']['MORE_PHOTO']['VALUE'] as $file)
{
$file = CFile::GetFileArray($file);
if (is_array($file))
{
$element['MORE_PHOTO'][] = $file;
}
}
}
$element['LINKED_ELEMENTS'] = array();
if (
$this->arParams['LINK_PROPERTY_SID'] <> ''
&& $this->arParams['LINK_IBLOCK_TYPE'] <> ''
&& $this->arParams['LINK_IBLOCK_ID'] > 0
)
{
$linkElementIterator = CIBlockElement::GetList(
array('SORT' => 'ASC'),
array(
'IBLOCK_ID' => $this->arParams['LINK_IBLOCK_ID'],
'IBLOCK_ACTIVE' => 'Y',
'ACTIVE_DATE' => 'Y',
'ACTIVE' => 'Y',
'CHECK_PERMISSIONS' => 'Y',
'IBLOCK_TYPE' => $this->arParams['LINK_IBLOCK_TYPE'],
'PROPERTY_'.$this->arParams['LINK_PROPERTY_SID'] => $element['ID'],
),
false,
false,
array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL', 'IBLOCK_NAME')
);
while ($linkElement = $linkElementIterator->GetNext())
{
$element['LINKED_ELEMENTS'][] = $linkElement;
}
}
if (!$this->storage['SECTION'] && $element['IBLOCK_SECTION_ID'] > 0)
{
$sectionFilter = array(
'ID' => $element['IBLOCK_SECTION_ID'],
'IBLOCK_ID' => $element['IBLOCK_ID'],
'ACTIVE' => 'Y',
);
$rsSection = CIBlockSection::GetList(array(), $sectionFilter);
$rsSection->SetUrlTemplates('', $this->arParams['SECTION_URL']);
$this->storage['SECTION'] = $rsSection->GetNext();
}
if (!empty($this->storage['SECTION']))
{
$blackList = array(
'SEARCHABLE_CONTENT', '~SEARCHABLE_CONTENT',
'TIMESTAMP_X', '~TIMESTAMP_X',
'DATE_CREATE', '~DATE_CREATE',
);
foreach ($blackList as $fieldName)
{
if (array_key_exists($fieldName, $this->storage['SECTION']))
{
unset($this->storage['SECTION'][$fieldName]);
}
}
unset($fieldName, $blackList);
$this->storage['SECTION']['PATH'] = array();
$rsPath = CIBlockSection::GetNavChain(
$element['IBLOCK_ID'],
$this->storage['SECTION']['ID'],
array(
'ID', 'CODE', 'XML_ID', 'EXTERNAL_ID', 'IBLOCK_ID',
'IBLOCK_SECTION_ID', 'SORT', 'NAME', 'ACTIVE',
'DEPTH_LEVEL', 'SECTION_PAGE_URL'
)
);
$rsPath->SetUrlTemplates('', $this->arParams['SECTION_URL']);
while ($path = $rsPath->GetNext())
{
if ($this->arParams["ADD_SECTIONS_CHAIN"])
{
$ipropValues = new IblockInheritedPropertySectionValues($element['IBLOCK_ID'], $path['ID']);
$path['IPROPERTY_VALUES'] = $ipropValues->getValues();
}
$this->storage['SECTION']['PATH'][] = $path;
}
if ($this->arParams['SECTIONS_CHAIN_START_FROM'] > 0)
{
$this->storage['SECTION']['PATH'] = array_slice($this->storage['SECTION']['PATH'], $this->arParams['SECTIONS_CHAIN_START_FROM']);
}
$element['SECTION'] = $this->storage['SECTION'];
}
unset($element);
}
}