Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • j0ck3r Friend
    #719195

    Hello,

    Please i have an installed JAHotel template and i want to apply feature of K2 Filter that can search in categories and show it’s location on map (Feature exists in JA JADirectory ), you can find it in Documentation in section:
    4. Create JA K2 Filter module
    also in All in one map section.

    I installed all needed extensions: k2 filter, google map, k2 but with JAHotel and i also add location as a custom extra field and i linked it with k2 multilevel feature but thats not work so please advise.

    I attached super admin account, feel free to use it when you need

    I think i should use this code but i don’t know the correct usage of it and if there are any additional steps:


    <?php $locations = (object) array(
    'location' => new stdClass(),
    'latitude' => new stdClass(),
    'longitude' => new stdClass(),
    'info' => new stdClass()
    );
    $i = 0;
    $baseURL = JUri::base();
    $sections = array('leading', 'primary', 'secondary', 'links');
    foreach($sections as $section) {
    if(isset($this->{$section}) && count($this->{$section})) {
    foreach($this->{$section} as $key=>$item) {
    $latitude = $longitude = '';
    if(count($item->extra_fields)) {
    foreach ($item->extra_fields as $extraField) {
    if($extraField->alias == 'latitude') $latitude = $extraField->value;
    if($extraField->alias == 'longitude') $longitude = $extraField->value;
    }
    }

    if($latitude && $longitude) {
    $catParams= new JRegistry($item->categoryparams);
    $icon = $catParams->get('category_marker', 'images/joomlart/directory-icons/default-marker.png');
    $icon = $baseURL.'/'.$icon;

    $locations->location->{$i} = '';
    $locations->latitude->{$i} = $latitude;
    $locations->longitude->{$i} = $longitude;
    $locations->info->{$i} = '<a class="marker-title" href="'.$item->link.'">'.$item->title.'</a>';
    foreach ($item->extra_fields as $key=>$extraField):
    if($extraField->value != ''):
    if(($extraField->type != 'header') && ($extraField->alias != 'latitude') && ($extraField->alias != 'longitude')):
    $locations->info->{$i} .= '<div class=""><span class="">'.$extraField->name.':</span>';
    $locations->info->{$i} .= '<span class=""> '.$extraField->value.'</span></div>';
    endif;
    endif;
    endforeach;
    $locations->info->{$i} .= '<img class="marker-img" src="'.$item->imageSmall.'" alt="" />';
    @$locations->icon->{$i} = $icon;
    $i++;
    }
    }
    }
    }
    if($i) {
    $jamap = "{jamap locations='".json_encode($locations)."' map_width='100%' map_height='455' zoom='4' disable_scrollwheelzoom='1' display_scale='1' display_overview='1'}{/jamap}";
    echo $jamap;
    }
    ?>

    Ninja Lead Moderator
    #719351

    Hi,

    That code above works with the configuration here: https://www.joomlart.com/documentation/joomla-templates/ja-directory-template/how-to#google-map

    Here is sample to define it from K2 item

    Regards

    Ninja Lead Moderator
    #753038

    Hi,

    That code above works with the configuration here: https://www.joomlart.com/documentation/joomla-templates/ja-directory-template/how-to#google-map

    Here is sample to define it from K2 item

    Regards

Viewing 3 posts - 1 through 3 (of 3 total)

This topic contains 3 replies, has 2 voices, and was last updated by  Ninja Lead 9 years ago.

We moved to new unified forum. Please post all new support queries in our New Forum