P
P
pavelmosin2020-10-19 18:30:35
1C-Bitrix
pavelmosin, 2020-10-19 18:30:35

How to take a reserve from a product via API?

Good afternoon!
The item is placed into the reserve using standard Bitrix tools.
How can I remove it from the reserve through the API?
There is a link but it didn't work for me. I don't understand how to use \Bitrix\Catalog\Product\CatalogProvider

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
workFromHome2595, 2022-01-13
@pavelmosin

Wow what did it cost
me

//резервирование товара
$productId = 12;

$a = new \Bitrix\Catalog\Product\CatalogProvider;
$resReserve = $a->reserve(array(
    $productId => ["PRODUCT_ID" => $productId,  "QUANTITY" => 15]
));

//снятие резерва
//для снятия резерва ВАЖНО чтобы QUANTITY был ОТРИЦАТЕЛЬНЫЙ 

$a = new \Bitrix\Catalog\Product\CatalogProvider;
$resReserve = $a->reserve(array(
    $productId => ["PRODUCT_ID" => $productId,  "QUANTITY" => -15 ]
));

V
Vyacheslav Klimov, 2020-10-19
@KlVV

The method by reference is not about that, it simply returns information, but it must be changed. https://dev.1c-bitrix.ru/api_help/catalog/classes/... is more suitable here
instead
of CCatalogProductProvider::ReserveProduct($arParams);
Use
\Bitrix\Catalog\Product\CatalogProvider::ReserveProduct($arParams);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question