Answer the question
In order to leave comments, you need to log in
How to overcome the error Call to a member function GetProperties() on boolean (0)?
Hello!
I tried to create a product without sections with a price of 0 and made an entry in the cart template:
$Cart = Sale\Basket::loadItemsForFUser(Sale\Fuser::getId(), Bitrix\Main\Context::getCurrent()->getSite());
$item = $Cart->createItem('catalog', 666);
$item->setFields(array(
'PRODUCT_PRICE_ID' => 0,
'PRICE' => -(int)$Price,
'CURRENCY' => 'RUB',
'QUANTITY' => 1,
'LID' => Bitrix\Main\Context::getCurrent()->getSite(),
'CUSTOM_PRICE' => 'Y',
'NAME' => 'Скидон - '.$Price,
));
$Cart->save();
[Error]
Call to a member function GetProperties() on boolean (0)
/var/www/....php:17
17 строка: $articul= CIBlockElement::GetByID($mxResult['ID'])->GetNextElement()->GetProperties();
Answer the question
In order to leave comments, you need to log in
In line
$articul= CIBlockElement::GetByID($mxResult['ID'])->GetNextElement()->GetProperties();
$articul = [];
$dbRes = CIBlockElement::GetByID($mxResult['ID']);
if($ob = $dbRes->GetNextElement()) {
$articul = $ob->GetProperties();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question