Answer the question
In order to leave comments, you need to log in
How to output a custom property "binding to elements"?
Good day to all!
I want related products to be displayed for each section on the product detail page.
For example, the footwear section, on det.str. any product must have related products (socks, laces).
And in the pants section there should be (a belt and something else).
I found something like this on the Internet, but it does not display goods.
<?
$db_list = CIBlockElement::GetList(Array(), $arFilter = Array("IBLOCK_ID"=>8, "ID"=>$arResult["ID"]), true, Array("UF_RECOMMEND"));
$props_array = $db_list->GetNext();
if (!empty($props_array["UF_RECOMMEND"])) {
$rsSections = CIBlockElement::GetList(
array("SORT" => "ASC"),
array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "ID" => $props_array["UF_RECOMMEND"]),
false,
array("NAME", "DETAIL_PICTURE", "PICTURE", "SECTION_PAGE_URL"),
false
);
?>
<section class="recomend">
<h2 class="recomend-title">Сопутствующие товары:</h2>
<div class="recomend-wrap">
<?
while ($arSections = $rsSections->GetNext()) {
?>
<div class="recomend-item" oncl ick="location.href='<?= $arSections['SECTION_PAGE_URL'] ?>';">
<div class="recomend-img">
<img src="<?= CFile::GetPath($arSections['PICTURE'])?>" class="recomend-img-art" alt="<?= $arSections['NAME'] ?>" title="<?= $arSections['NAME'] ?>">
</div>
<div class="recomend-name">
<h3><?= $arSections['NAME'] ?></h3>
</div>
</div>
<?
}
?>
</div>
</section>
<?
}
?>
Answer the question
In order to leave comments, you need to log in
$db_list = CIBlockElement::GetList(Array(), $arFilter = Array("IBLOCK_ID"=>8, "ID"=>$arResult["ID"]), true, Array("UF_RECOMMEND"));
$props_array = CIBlockElement::GetList(Array(), $arFilter = Array("IBLOCK_ID"=>8, "ID"=>$arResult["ID"]), false, false Array('ID', 'IBLOCK_ID',"UF_RECOMMEND"))->Fetch();
$rsSections = CIBlockElement::GetList(array("SORT" => "ASC"),
array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "ID" => $props_array["UF_RECOMMEND"]),
false,
array("NAME", "DETAIL_PICTURE", "PICTURE", "SECTION_PAGE_URL"),
false
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question