V
V
Vladimir2017-01-30 15:58:03
1C-Bitrix
Vladimir, 2017-01-30 15:58:03

Why is the Yandex map not displayed, only its coordinates?

Hello. I'm trying to extract an element from the infoblock with the property of binding to the Yandex map.

<?
$selected_min_id = empty($_SESSION["city"]) ? 25 : $_SESSION["city"];
$rsMin = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 10, "ACTIVE" => "Y", 
"ID" => $selected_city_id), false, false, array("ID", "PROPERTY_MAP"));
        if ($arMin = $rsMin->GetNext()) {
        } else {
            $rsMin = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 10, "ACTIVE" => "Y", 
"ID" => 25), false, false, array("ID", "PROPERTY_MAP"));        
            $arMin= $rsMin->GetNext();
        }
        
        $map = $arCity["PROPERTY_MAP_VALUE"];
    
?>
<?=$map?>

Displays only coordinates.
2289147beb5148afa30cedb5217ce676.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Burlaka, 2017-01-30
Bolotov @VladimirBolotov

You coordinates and read. They still need to be fed to the map, initialized via javascript.
There is an example here:
web-finder.ru/otobrazhenie-yandeks-kart-v-bitriks
You have a code that in some situations will make two queries to the database.
I would pass an array to the selection filter in the "ID" key:

"ID" => array(
  25, $selected_min_id
)

...and after GetNext look at the result - if there is a map by the code from the session, display its coordinates. If not, the coordinates of the 25th map.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question