Пользовательское свойство с множеством полей

Данное решение не мое, нашел на просторах интернета.

Если нужно больше полей – добавляйте

$html .= '<td><input type="text" size="25" placeholder="Количество" name="'.$strHTMLControlName['VALUE'].'[]" value="'.$value['VALUE'][КОЛИЧЕСТВО].'" /></td>';

 

и ниже в GetAdminListViewHTML

." - ".$value['VALUE'][N]

 

 

Исходный код:

AddEventHandler("iblock","OnIBlockPropertyBuildList",array("Property_Service_List_Class","GetUserTypeDescription"));

if(!class_exists("Property_Service_List_Class"))
{
class Property_Service_List_Class
{
function GetUserTypeDescription()
{
return array(
"PROPERTY_TYPE" => "S",
"USER_TYPE" => "EServiceList",
"DESCRIPTION" => "Выбор",
"GetPropertyFieldHtml" => array("Property_Service_List_Class","GetPropertyFieldHtml"),
"GetPublicEditHTML" => array("Property_Service_List_Class","GetPropertyFieldHtml"),
"ConvertToDB" => array("Property_Service_List_Class","ConvertToDB"),
"ConvertFromDB" => array("Property_Service_List_Class","ConvertFromDB"),
"GetAdminListViewHTML" => array("Property_Service_List_Class","GetAdminListViewHTML"),
);
}

function GetPropertyFieldHtml($arProperty, $value, $strHTMLControlName)
{

$arResult = array();

$cache[$IBLOCK_ID] = array();

$html = '';
$html = "<table>";
$html .= "<tr>";
$html .= '<td><input type="text" size="2" placeholder="Уровень (1 - первый, 2 - второй)" name="'.$strHTMLControlName['VALUE'].'[]" value="'.$value['VALUE'][0].'" /></td>';
$html .= '<td><input type="text" size="25" placeholder="Название" name="'.$strHTMLControlName['VALUE'].'[]" value="'.$value['VALUE'][1].'" /></td>';
$html .= '<td><input type="text" size="25" placeholder="Количество" name="'.$strHTMLControlName['VALUE'].'[]" value="'.$value['VALUE'][2].'" /></td>';
$html .= '</tr>';
$html .= "</table>";

return $html;
}

function ConvertToDB($arProperty, $value)
{
if($value['VALUE'][0]!='') {
$value['VALUE'] = serialize($value['VALUE']);
} else {
$value['VALUE'] = null;
}
return $value;
}

function ConvertFromDB($arProperty, $value){
if(strlen($value["VALUE"])>0) {
$tmpArr = unserialize($value["VALUE"]);
if(is_array($tmpArr) && count($tmpArr))
$value["VALUE"] = $tmpArr;
} else {
$value["VALUE"] = null;
}
return $value;
}

function GetAdminListViewHTML($arProperty, $value, $strHTMLControlName) {
if(is_array($value["VALUE"]) && count($value["VALUE"])) {
$tmpArr = array();
$tmpArr[] = "[".$value['VALUE'][0]."] - ".$value['VALUE'][1]." - ".$value['VALUE'][2];

return implode(" /\n",$tmpArr);
}
else
{
return htmlspecialcharsex($value["VALUE"]);
}
}

}
}