R
R
run1822015-05-22 19:19:24
PHP
run182, 2015-05-22 19:19:24

Why doesn't CIBlockElement::SetPropertyValuesEx work?

I use the following code, but it does not work in any way, although it is written according to the manual:

$ELEMENT_ID = $_GET["id"];
$PROPERTY_CODE = "LIKES";
CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, false, array($PROPERTY_CODE =>  5));

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
pomidoroshev, 2015-05-23
@run182

Five options:
1. Wrong ELEMENT_ID in the GET parameter.
2. The property with the code "LIKES" exists in another infoblock, and you need to specify IBLOCK_ID in the method.
3. The "LIKES" property is plural and is assigned a single value.
4. Property "LIKES" does not exist.
5. The "iblock" module is not connected:CModule::IncludeModule('iblock');

E
Evgen, 2015-05-22
@EASemashko

Possibly incorrect $_GET["id"].
Better not make a direct request from $_GET, but handle $ELEMENT_ID = filter_input(INPUT_GET, 'id'); to avoid any surprises.

M
Mikhail Bazarov, 2018-12-22
@camouf

Maybe the "LIKES" property is not active.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question