R
R
redesupar2022-02-02 17:52:55
PHP
redesupar, 2022-02-02 17:52:55

How to change the available quantity of a product based on a property in the WAN?

I'm trying to change the available quantity of goods in the infoblock, based on the property. BUT nothing comes out. Please tell me how to do it

CModule::IncludeModule('iblock');
Cmodule::IncludeModule('catalog');
$addProps = CIBlockElement::GetList(
        Array("ID" => "ASC"),
        Array("IBLOCK_ID" => 18),
        false,
        false,
        Array(
            'ID',
            'QUANTITY',
      'PROPERTY_MIN_UPAKOVKA'
                    )
);

$upakovka = $ar_fields['PROPERTY_MIN_UPAKOVKA'];
$vupakovke = $ar_fields['QUANTITY'];
$kolvo = (int)($vupakovke / $upakovka );
 
while ($ar_fields = $addProps->Fetch()) {
        $arFields = Array(
            "PRODUCT_ID" => $ar_fields['ID'],
            "QUANTITY" => $kolvo,
        );
        CCatalogProduct::Update($PRODUCT_ID, $arFields);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zzpro, 2022-02-02
@Zzpro

Isn't that how it should be?
"QUANTITY" => $kolvo,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question