D
D
Darklt2021-12-18 17:59:55
1C-Bitrix
Darklt, 2021-12-18 17:59:55

How to add an item quantity change event from a property?

Previously, there was the following event, when the total value was substituted when adding a product.

AddEventHandler("sale", "OnProductAdd", "OnProductAdd");
function OnProductAdd(&$ID,$Fields)
{
    $res=Array("QUANTITY"=>"500");
    CCatalogProduct::Update($ID,$res);
}


Now we have done that the quantity comes in the field for example

<?=$arResult["DISPLAY_PROPERTIES"]["kol"]["VALUE"]?>


I understand that the event should be changed to OnProductUpdate, but how to specify that it takes the value not 500 but from the property?

At the same time, it worked only in arSection ID 400 and all its subsections.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
no_one_safe, 2021-12-19
@no_one_safe

Get the section ID and property value using the CIBlockElement::GetList method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question