Answer the question
In order to leave comments, you need to log in
How to get the price of a trade offer in Bitrix?
I got the price of trade offers separately via $price = GetCatalogProductPrice($tpred["ID"], 1);, but how can I get it via CIBlockElement::GetList?
/* поменял сосотояние в торговых предложения взависимоти от цены*/
$productID = $arResult["ITEM"]["ID"];
$res = CCatalogSKU::getOffersList($productID, 0, array('ACTIVE' => 'Y'), array(""), array(""));
foreach ($res["$productID"] as $key => $tpred){
$rsOffers = CIBlockElement::GetList(
array("sort" => "ASC"), // Свойства, по которым идет сортировка
array('ID' => $tpred["ID"]), // Фильтрация
false,
false,
array("ID", "IBLOCK_ID", "NAME","ACTIVE","PROPERTY_SIZE_IMG_SIGN","PROPERTY_MINIMUM_PRICE") // Свойства, которые нужно получить.
);
$price = GetCatalogProductPrice($tpred["ID"], 1);
while ( $arElement = $rsOffers->Fetch () ) {
$el = new CIBlockElement;
$arLoadProductArray = Array(
"ACTIVE" => "N"
);
if(round($price["PRICE"]) == 1){
echo round($price["PRICE"])."!";
$res = $el->Update($tpred["ID"], $arLoadProductArray);
}
}
}
Answer the question
In order to leave comments, you need to log in
add the price request CATALOG_PRICE_1
https://dev.1c-bitrix.ru/api_help/iblock/classes/c... to the select
$rsOffers = CIBlockElement::GetList(
array("sort" => "ASC"), array('ID' => $tpred["ID"]),false,false,
array("ID", "IBLOCK_ID", "CATALOG_PRICE_1", "NAME","ACTIVE","PROPERTY_SIZE_IMG_SIGN","PROPERTY_MINIMUM_PRICE"));
.........
while($arElement = $rsOffers->GetNextElement()){
$arFields = $arElement->GetFields();
.........
echo $price = round($arFields['CATALOG_PRICE_1']);
.........
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question