D
D
Darkhan Kamaliev2019-04-24 10:14:49
1C-Bitrix
Darkhan Kamaliev, 2019-04-24 10:14:49

How to massively change the value of the product property "new" and "hit" in 1s-Bitrix?

Good afternoon.
Initially (for some reason) the "default" value for new products and bestsellers was Y, since all products now have this value, the default value will be changed, but how can I bypass all products and change Y to N?
Where is this in mysql? Or maybe there is a built-in API for such things?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
unsweet, 2019-04-24
@unsweet

Kind.
Loop through all the elements from the directory and rearrange the value of the property. More or less like this:

CModule::IncludeModule('iblock');
$PROPERTY_VALUES = [
  "NEW" => "N",
  "HIT" => "N"
];
$arFilter = ["IBLOCK_ID" => id_каталога];
$res = CIBlockElement::GetList(false, $arFilter, ['IBLOCK_ID','ID']);
while($el = $res->GetNext())
{
  CIBlockElement::SetPropertyValuesEx($el['ID'], id_каталога, $PROPERTY_VALUES);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question