CIBlockElement::SetPropertyValues( int ELEMENT_ID, int IBLOCK_ID, array PROPERTY_VALUES, string PROPERTY_CODE = false );The method sets values of one or all properties of an information block element.
Parameter | Description |
---|---|
ELEMENT_ID | Element ID whose properties are to be set. |
IBLOCK_ID | Information block ID. |
PROPERTY_VALUES |
Array of property values. If PROPERTY_CODE is other than false, the PROPERTY_VALUES array must contain a single value or an array of values for multiple-value properties. If PROPERTY_CODE is false, the PROPERTY_VALUES array contains pairs "property code"=>"value". In this pair, the property code is the numeric or mnemonic property identifier, and the value is a single value or an array of values for multiple-value properties. Please note that the PROPERTY_VALUES array must contain a full set of properties and values; in case any currently existing property is missing from this array, all its values are removed from the element property set. |
PROPERTY_CODE |
Code of a property to modify. If this parameter is other than false,
a property with this name or code is only modified. This parameter is optional and is set to false by default. |
<? $ELEMENT_ID = 18; // element ID $PROPERTY_CODE = "PROP1"; // property ID $PROPERTY_VALUE = "blue"; // property value // Set a new value to this property $strSql = "SELECT BE.IBLOCK_ID ". "FROM b_iblock_element BE ". "WHERE BE.ID = ".IntVal($ELEMENT_ID); $dbr = $DB->Query($strSql); if ($dbr_arr = $dbr->Fetch()) { $IBLOCK_ID = $dbr_arr["IBLOCK_ID"]; CIBlockElement::SetPropertyValues($ELEMENT_ID, $IBLOCK_ID, $PROPERTY_VALUE, $PROPERTY_CODE); } ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |