Answer the question
In order to leave comments, you need to log in
How to change Activity value using API?
Can't change property with Update
<?
CModule::IncludeModule("iblock");
$el = new CIBlockElement;
if($enum_fields['XML_ID']=='true'){
$res= $el->Update($id, array("ACTIVE"=> "Y"));
} else
$res= $el->Update($id, array("ACTIVE"=> "N"));
?>
Answer the question
In order to leave comments, you need to log in
There are only two options:
1 The condition is invalid and $enum_fields['XML_ID'] is never equal to 'true' (it would be strange if it was).
2 The condition is true and there is a product with XML_ID== 'true', but on the AfterUpdate event, there is a handler that changes the value to N, deactivating the product.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question