Answer the question
In order to leave comments, you need to log in
How to make a custom property with multiple fields in Bitrix?
OnIBlockPropertyBuildList has
a GetPropertyFieldHtmlMulty method . But I don't quite understand how to save multiple fields. It turns out with only one:
AddEventHandler("iblock", "OnIBlockPropertyBuildList", array("CIBlockPropertyCustom", "GetUserTypeDescription"));
class CIBlockPropertyCustom
{
public function GetUserTypeDescription()
{
return array(
"PROPERTY_TYPE" => "F",
"USER_TYPE" => "SERVICE",
"DESCRIPTION" => "Фотогалерея",
"GetPropertyFieldHtml" => array("CIBlockPropertyCustom", "GetPropertyFieldHtml"),
);
}
public static function GetPropertyFieldHtml($arProperty, $value, $strHTMLControlName)
{
return '<input type="text" name="'.$strHTMLControlName["VALUE"].'" value="'.$value['VALUE'].'">';
}
}
Answer the question
In order to leave comments, you need to log in
File is a number. The second field is a string.
To store 2 separate values in one database field, you need to develop your own data serialization method.
To modify values before saving to the database and after reading from the database, additionally describe the ConvertToDB and ConvertFromDB methods, respectively.
PS
One more option: write the text part of the property value as DESCRIPTION to the saved file (when you execute the CFile::Save method).
I have not worked with this functionality for a long time, it should be the same as with one, only in the second parameter there will be not one value, but an array of values. js for the "Add" button also seems to need to be written by yourself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question