Answer the question
In order to leave comments, you need to log in
How can I display a product review for this product?
There are two infoblocks "Reviews" and "Products", in the reviews there is a property "Product" that is linked to the product element.
I need to write down, as I understand it, two conditions both in the template for the component and in the place where the component itself is called, if you write just the id of the product, everything works.
if ($arResult["ID"] == 125) { // 125 это id товара
вывод компонента // тут используется инфоблок товаров
}
if ($arItem["PROPERTIES"]["ID_PRODUCT"]["VALUE"] == 125) { // 125 это id товара
тут шаблон // тут используется инфоблок отзывов
}
if(!CModule::IncludeModule("iblock"))
return;
$res = CIBlockElement::GetByID($_GET["PID"]);
if($ar_res = $res->GetNext())
echo $ar_res['NAME'];
Answer the question
In order to leave comments, you need to log in
In general, I found the answer myself, everything is much easier than writing conditions
global $arrFilter;
$arrFilter = array("property_ID_PRODUCT" => $arResult["ID"]); // свойство которое нужно и чему оно должно быть равно
$APPLICATION->IncludeComponent(
"bitrix:news.list",
"reviews",
Array(
// поля до
"FILTER_NAME" => "arrFilter",
// поля после
)
);
And what's the problem instead of 125 use this very "$arResult["ID"]", which already contains the ID of the product you are looking at?
Those. in fact, you write the following:
1) Develop a component that, based on the product ID, will display its reviews
2) In the component output template, add a call to your component.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question