Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question