Answer the question
In order to leave comments, you need to log in
How to display the price (by id or price type code) in the element template in 1s-Bitrix?
Please tell me how you can display the price (of a certain type of prices id: "18", type code: "MIN") in the template, as an additional one, I will display it only for a certain group of users using:
<?php global $USER;
$dop_price = "доп цена";
$groupID = 11;
if (in_array($groupID,$USER->GetUserGroupArray())){
echo "$dop_price";
}?>
$db_res = CPrice::GetList(
array(),
array(
"PRODUCT_ID" => $PRODUCT_ID,
"CATALOG_GROUP_ID" => "MIN"
)
);
if ($ar_res = $db_res->Fetch())
{
echo CurrencyFormat($ar_res["PRICE"], $ar_res["CURRENCY"]);
}
else
{
echo "Цена не найдена!";
}
?>
Answer the question
In order to leave comments, you need to log in
Figured it out myself:
// Выведем цену типа $PRICE_TYPE_ID товара с кодом $PRODUCT_ID
$PRICE_TYPE_ID = '18'; // ID Типа цен
$db_res = CPrice::GetList(
array(),
array(
"PRODUCT_ID" => $arResult['ID'], // Получаем ID Товара
"CATALOG_GROUP_ID" => $PRICE_TYPE_ID // Получаем ID типа цен из переменной
)
);
if ($ar_res = $db_res->Fetch())
{
echo CurrencyFormat($ar_res["PRICE"], $ar_res["CURRENCY"]); // Выводим цену
}
else
{
echo "Цена не найдена!"; // Выводим (если нет цены)
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question