foreach ($arResult["GRID"]["ROWS"] as $id )
{
$mxResult = CCatalogSku::GetProductInfo($id['data']['PRODUCT_ID']);
$productId = $mxResult ? $mxResult['ID'] : $id['data']['PRODUCT_ID'];
$articul = [];
$dbRes = CIBlockElement::GetByID($productId);
if($ob = $dbRes->GetNextElement()) {
$articul = $ob->GetProperties();
}
if($articul) {
$arFilter = Array("IBLOCK_ID"=>26, "NAME"=>$articul['ARTNUMBER']['VALUE']);
$arSelect = Array("ID", "IBLOCK_ID", "NAME", "code");
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array(), $arSelect);
//..............
}
echo 'First product id = '.current($arResult["GRID"]["ROWS"])['data']['PRODUCT_ID'].'<br>';
foreach ($arResult["GRID"]["ROWS"] as $id )
{
echo '<pre> product id';
print_r($id['data']['PRODUCT_ID']);
echo '</pre>';
$mxResult = CCatalogSku::GetProductInfo($id['data']['PRODUCT_ID']);
echo '<pre> product info';
print_r($mxResult);
echo '</pre>';
//..............
$mxResult = CCatalogSku::GetProductInfo($id['data']['PRODUCT_ID']);
$mxResult['ID'] = isset($mxResult['ID']) ? $mxResult['ID'] : $id['data']['PRODUCT_ID'];
если в товар добавить торговое предложение
$productsId = $products = [];
foreach($basketItems as $basketItem) {
$productId = $basketItem->getField('PRODUCT_ID');
$productsId[] = $productId;
}
if($productsId) {
$iterator = CIBlockElement::GetList([], ['ID' => $productsId], false, false, ['IBLOCK_ID', 'ID', 'NAME', 'PROPERTY_*']);
while($ob = $iterator->GetNextElement()) {
$product = $ob->GetFields();
$product['PROPERTIES'] = $ob->GetProperties();
$products[$product['ID']] = $product;
}
foreach($basketItems as $basketItem) {
$productId = $basketItem->getField('PRODUCT_ID');
$productProperties = $products[$productId]['PROPERTIES'];
AddMessage2Log($productProperties);
}
}
define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/log.txt");
$propertyValues = $basketPropertyCollection->getPropertyValues();
AddMessage2Log($propertyValues);
$mxResult = CCatalogSku::GetProductInfo($id['data']['PRODUCT_ID']);
CIBlockElement::GetByID($mxResult['ID'])->GetNextElement()
возвращает boolean false, потому что нет у тебя $mxResult['ID'], а затем на этом false ты вызываешь метод GetProperties(). Улавливаешь? Call to a member function GetProperties() on boolean $articul= CIBlockElement::GetByID($mxResult['ID'])->GetNextElement()->GetProperties();
разные вещи. На каком сайте ты такой говнокод увидел?$articul = [];
$dbRes = CIBlockElement::GetByID($mxResult['ID']);
if($ob = $dbRes->GetNextElement()) {
$articul = $ob->GetProperties();
}