Bitrix\Sale\BasketItem Object
(
[bundleCollection:Bitrix\Sale\BasketItem:private] =>
[propertyCollection:protected] =>
[calculatedFields:protected] => Bitrix\Sale\Internals\Fields Object
(
[values:protected] => Array
(
)
[changedValues:protected] => Array
(
)
[originalValues:Bitrix\Sale\Internals\Fields:private] => Array
(
)
[customFields:Bitrix\Sale\Internals\Fields:private] => Array
(
)
[isClone:protected] =>
)
[provider:protected] => CCatalogProductProvider
[internalId:protected] => n1
[collection:protected] => Bitrix\Sale\Basket Object
(
[siteId:protected] => s1
[fUserId:protected] => 1
[order:protected] =>
[basketItemIndexMap:protected] => Array
(
[n1] => 0
)
[maxItemSort:protected] => 100
[isLoadForFUserId:Bitrix\Sale\BasketBase:private] => 1
[isSaveExecuting:protected] =>
[index:Bitrix\Sale\Internals\EntityCollection:private] => 0
[isClone:protected] =>
[anyItemDeleted:protected] =>
[collection:protected] => Array
(
[0] => Bitrix\Sale\BasketItem Object
*RECURSION*
)
)
[internalIndex:protected] => 0
[isClone:protected] =>
[fields:protected] => Bitrix\Sale\Internals\Fields Object
(
[values:protected] => Array
(
[MODULE] => catalog
[BASE_PRICE] => 0
[CAN_BUY] => Y
[CUSTOM_PRICE] => N
[PRODUCT_ID] => 317
[XML_ID] => bx_62d9b91c7e56d
[LID] => s1
[SORT] => 100
[CURRENCY] => RUB
[PRODUCT_PROVIDER_CLASS] => CCatalogProductProvider
[QUANTITY] =>
)
[changedValues:protected] => Array
(
[SORT] => 1
[CURRENCY] => 1
[PRODUCT_PROVIDER_CLASS] => 1
)
[originalValues:Bitrix\Sale\Internals\Fields:private] => Array
(
[SORT] =>
[CURRENCY] =>
[PRODUCT_PROVIDER_CLASS] =>
)
[customFields:Bitrix\Sale\Internals\Fields:private] => Array
(
)
[isClone:protected] =>
)
[eventName:protected] => SaleBasketItem
)
Array
(
[0] => Количество товара "" не может быть меньше или равным 0
)
if($_POST['action']=='otprv'){
$productId = $_POST['data'];
$basket = \Bitrix\Sale\Basket::loadItemsForFUser(
\Bitrix\Sale\Fuser::getId(),
\Bitrix\Main\Context::getCurrent()->getSite()
);
$item = $basket->createItem('catalog', $productId);
print_r($item);
$item->setFields(array(
'QUANTITY' => 1,
'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(),
'LID' => 's1',
'PRODUCT_PROVIDER_CLASS' => 'CCatalogProductProvider',
));
$item->setField("QUANTITY", 1);
$r = $basket->save();
print_r($r->getErrorMessages());
}
Bitrix\Sale\BasketItem Object
(
[bundleCollection:Bitrix\Sale\BasketItem:private] =>
[propertyCollection:protected] =>
[calculatedFields:protected] => Bitrix\Sale\Internals\Fields Object
(
[values:protected] => Array
(
)
[changedValues:protected] => Array
(
)
[originalValues:Bitrix\Sale\Internals\Fields:private] => Array
(
)
[customFields:Bitrix\Sale\Internals\Fields:private] => Array
(
)
[isClone:protected] =>
)
[provider:protected] =>
[internalId:protected] => n1
[collection:protected] => Bitrix\Sale\Basket Object
(
[siteId:protected] => s1
[fUserId:protected] => 1
[order:protected] =>
[basketItemIndexMap:protected] => Array
(
[n1] => 0
)
[maxItemSort:protected] => 100
[isLoadForFUserId:Bitrix\Sale\BasketBase:private] => 1
[isSaveExecuting:protected] =>
[index:Bitrix\Sale\Internals\EntityCollection:private] => 0
[isClone:protected] =>
[anyItemDeleted:protected] =>
[collection:protected] => Array
(
[0] => Bitrix\Sale\BasketItem Object
*RECURSION*
)
)
[internalIndex:protected] => 0
[isClone:protected] =>
[fields:protected] => Bitrix\Sale\Internals\Fields Object
(
[values:protected] => Array
(
[MODULE] => catalog
[BASE_PRICE] => 0
[CAN_BUY] => Y
[CUSTOM_PRICE] => N
[PRODUCT_ID] => 317
[XML_ID] => bx_62d9b2a5c3ea8
[LID] => s1
[SORT] => 100
)
[changedValues:protected] => Array
(
[SORT] => 1
)
[originalValues:Bitrix\Sale\Internals\Fields:private] => Array
(
[SORT] =>
)
[customFields:Bitrix\Sale\Internals\Fields:private] => Array
(
)
[isClone:protected] =>
)
[eventName:protected] =>
)
Array
(
[0] => Количество товара "" не может быть меньше или равным 0
)
товар вроде создается норм