What code(method, function) automatically activate item property in Bitrix? Code to place in result_modifier?

How in Bitrix you can automatically activate item property? The product has a property "action". It is necessary that all items on the website, subject to the condition that activated this feature.
I tried to automatically enable this property by methods CIBlockProperty::Update and CIBlockElement::SetPropertyValues. The property value has changed, but the checkbox for "Action" was not displayed on the product, as and the checkbox was not active. How can you solve this problem?
July 2nd 19 at 17:05
1 answer
July 2nd 19 at 17:07
Solution
method CIBlockElement::SetPropertyValues should have worked.
What do you mean
I tried to automatically enable this property

Try to start on the same goods to protest the code as in the example(change to your property)
https://dev.1c-bitrix.ru/api_help/iblock/classes/c...

When you want to activate the checkbox "Share"?
Check "Action" I would like to activate, provided that the product is gold. Property METAL == GOLD.

"I tried to automatically enable this property" - have written nonsense, meant to this property were put down by itself, not manually through the admin panel. - nikita.Stracke commented on July 2nd 19 at 17:10
A little incorrectly expressed the thought - nikita.Stracke commented on July 2nd 19 at 17:13
:I understand you have the goods is a property of ACTION? can the event OnAfterIBlockElementUpdate (https://dev.1c-bitrix.ru/api_help/iblock/events/on...that fires after you change the element of the information block, to check a property of the item. If the Property is METAL == GOLD then set the active property of the ACTION. This is for new items. And you have already created, you can on a separate page to write the code that passes all the item information block and does the same thing: "check the property of the item. If the Property is METAL == GOLD then set the active property of the ACTION." After write the script, run it once. In the end, all Golden goods will be checked share. - Emery46 commented on July 2nd 19 at 17:16
Thank you very much! If I understand you correctly, then using the method CIBlockElement::SetPropertyValues to write a script that will run the Toolbox and set the activity properties of "ACTION". Tell me only, why not to write in result_modifier.php - the script does not fire every time when entering a directory? - nikita.Stracke commented on July 2nd 19 at 17:19
In result_modifier.php it would be possible to make so: to check a property of a product METAL == the GOLD if the condition is met, then $arResult to add a note that the goods on stock(no modification of the properties of the SHARE). But it is not necessary to result_modifier.php perform methods to change CIBlockElement::SetPropertyValues. Do you need the extra DB queries on each page load, and if the page will come in 1000 people what will happen to the base? =) - Emery46 commented on July 2nd 19 at 17:22

Find more questions by tags 1C-BitrixProgramming