-
AuthorPosts
-
October 27, 2015 at 6:49 pm #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 ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
October 28, 2015 at 10:06 am #719351Hi,
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 ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
October 28, 2015 at 10:06 am #753038Hi,
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
-
AuthorPosts
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