Яндекс.Карты

Добавление свойства тип карты в компонент iblock.element.add.form

04.08.2014 Bitrix ,

вставляется в шаблон

<?if($arResult["PROPERTY_LIST_FULL"][$propertyID]["USER_TYPE"] == "map_yandex"):?><?
         CModule::IncludeModule('iblock');
         include_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/iblock/admin_tools.php');
         $property_fields = $arResult["PROPERTY_LIST_FULL"][$propertyID];
         $arUserType = CIBlockProperty::GetUserType($property_fields["USER_TYPE"]);
         
         echo call_user_func_array($arUserType["GetPropertyFieldHtml"],
          array(
           $property_fields,
           array("VALUE"=>$value),
           array(
            "VALUE"=>'PROPERTY['.$property_fields["ID"].']['.$i.']',
            "DESCRIPTION"=>'PROPERTY['.$property_fields["ID"].']['.$i.'][DESCRIPTION]',
            "FORM_NAME"=>'iblock_add',
            "MODE"=>"FORM_FILL",
            "COPY"=>false,
           ),
          )
         );
          
          
        endif?>

Расчет центра Яндекс.Карты

14.12.2012 Bitrix, javascript ,

<?
 foreach($arResult["YANDEX_COORD"]["PLACEMARKS"] as $arItemKey=>$arItem)
 {
  $min_x = ($arItem["LAT"]<$min_x || !$min_x)? $arItem["LAT"] : $min_x;
  $max_x = ($arItem["LAT"]>$max_x || !$max_x)? $arItem["LAT"] : $max_x;
  $min_y = ($arItem["LON"]<$min_y || !$min_y)? $arItem["LON"] : $min_y;
  $max_y = ($arItem["LON"]>$max_y || !$max_y)? $arItem["LON"] : $max_y;
 }

 $x = round((($max_x - $min_x)/2 + $min_x), 6);
 $y = round((($max_y - $min_y)/2 + $min_y), 6);

 $arResult["YANDEX_COORD"]['yandex_lat'] = $x;
 $arResult["YANDEX_COORD"]['yandex_lon'] = $y;
 ?>