Map doesnt load

More
9 years 6 months ago #24845 by farukkm
Replied by farukkm on topic Map doesnt load
Strange. When I view page on mobile it works perfectly but not on browser. I tried both firefox and chrome

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #24877 by farukkm
Replied by farukkm on topic Map doesnt load
I have understood the problem has to do with https so i tried to replace all instances of http to https in vm2geolocator.php with no luck please advise

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #24878 by nordmograph
Replied by nordmograph on topic Map doesnt load
You still need to add an s to https for
maps.googleapis.com/maps/api/js?sensor=true&libraries=places

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #24879 by farukkm
Replied by farukkm on topic Map doesnt load
Im confused. this is how I replaced it maps.google.com

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #24880 by farukkm

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #24881 by farukkm
Replied by farukkm on topic Map doesnt load
Sorry here is the code after replaced instances. do it look ok?
Code:
<?php defined('_JEXEC') or die( 'Direct Access to ' . basename( __FILE__ ) . ' is not allowed.' ) ; /** * plg_vmcustom_vm2geolocator $ Product / stock locator for Virtuemart 2.x products * @copyright Copyright (C) Adrien Roussel www.nordmograph.com * @license http://www.nordmograph.com/en/licence.html GNU GENERAL PUBLIC LICENSE Version 3 */ if (!class_exists('vmCustomPlugin')) require(JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php'); class plgVmCustomVm2geolocator extends vmCustomPlugin { function __construct(& $subject, $config) { parent::__construct($subject, $config); $this->_tablepkey = 'id'; $this->tableFields = array_keys($this->getTableSQLFields()); $varsToPush = array( 'mode'=>array('','int'), 'fe_map_width'=>array('','char'), 'fe_map_height'=>array('','char'), 'default_lat'=>array('','char'), 'default_lng'=>array('','char'), 'default_zoom'=>array('','char'), 'default_maptype'=>array('','char'), 'stylez'=>array('','char'), 'scrollwheel'=>array('','int'), 'showstreetview'=>array('','int'), 'msize'=>array('','char'), 'mcolor'=>array('','char') ); $this->setConfigParameterable('custom_params',$varsToPush); } protected function getVmPluginCreateTableSQL() { return $this->createTableSQL('Product VM2Geolocator Table'); } function getTableSQLFields() { $SQLfields = array( 'id' => 'int(11) unsigned NOT NULL AUTO_INCREMENT', 'virtuemart_product_id' => 'int(11) UNSIGNED DEFAULT NULL', 'virtuemart_custom_id' => 'int(11) UNSIGNED DEFAULT NULL' ); return $SQLfields; } function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) { if ($field->custom_element != $this->_name) return ''; // $this->tableFields = array ( 'id', 'virtuemart_custom_id', 'custom_specification_default1', 'custom_specification_default2' ); $this->parseCustomParams($field); $this->getPluginProductDataCustom($field, $product_id); $html =''; //$plgParam = $this->getVmCustomParams($field->virtuemart_custom_id); /*if (empty($param['latitude'])) $param['latitude'] = $plgParam->get('default_lat'); if (empty($param['longitude'])) $param['longitude'] = $plgParam->get('default_lng'); if (empty($param['zoom'])) $param['zoom'] = $plgParam->get('default_zoom'); if (empty($param['maptype'])) $param['maptype'] = $plgParam->get('default_maptype');*/ $doc = & JFactory::getDocument(); $doc->addScript( "https://maps.googleapis.com/maps/api/js?sensor=true&libraries=places"); //$default_lat = $plgParam->get('default_lat'); //$default_lng = $plgParam->get('default_lng'); //$default_zoom = $plgParam->get('default_zoom'); //$default_maptype = $plgParam->get('default_maptype'); //$stylez = $plgParam->get('stylez'); $stylez =''; if (empty($field->latitude) ) $default_lat = '0'; else $default_lat = $field->latitude; if (empty($field->longitude)) $default_lng = '0'; else $default_lng = $field->longitude; if (empty($field->zoom)) $default_zoom = '5'; else $default_zoom = $field->zoom; if (empty($field->maptype)) $default_maptype = 'ROADMAP'; else $default_maptype = strtoupper($field->maptype); $mapscript ="function add_Event(obj_, evType_, fn_){ if (obj_.addEventListener) obj_.addEventListener(evType_, fn_, false); else obj_.attachEvent('on'+evType_, fn_); }; function initializemap".$row."(){ directionsDisplay = new google.maps.DirectionsRenderer(); var latlng = new google.maps.LatLng(".$default_lat.",".$default_lng."); var myOptions = { zoom: ".$default_zoom.", center: latlng, mapTypeId: google.maps.MapTypeId.".$default_maptype.", scrollwheel: false, navigationControl: true, scaleControl: true, mapTypeControl: true, overviewMapControl:true, streetViewControl: true } var map = new google.maps.Map(document.getElementById('map".$row."'), myOptions);"; if(1==1){ $mapscript .= "var input".$row." = document.getElementById('searchTextField".$row."'); var autocomplete".$row." = new google.maps.places.Autocomplete(input".$row."); autocomplete".$row.".bindTo('bounds', map); var place_infowindow".$row." = new google.maps.InfoWindow(); var place_marker".$row." = new google.maps.Marker({ map: map }); google.maps.event.addListener(autocomplete".$row.", 'place_changed', function() { place_infowindow".$row.".close(); var place".$row." = autocomplete".$row.".getPlace(); if (place".$row.".geometry.viewport) { map.fitBounds(place".$row.".geometry.viewport); } else { map.setCenter(place".$row.".geometry.location); map.setZoom(17); // Why 17? Because it looks good. } var image".$row." = new google.maps.MarkerImage( place".$row.".icon, new google.maps.Size(71, 71), new google.maps.Point(0, 0), new google.maps.Point(17, 34), new google.maps.Size(35, 35)); place_marker".$row.".setIcon(image".$row."); place_marker".$row.".setPosition(place".$row.".geometry.location); var address".$row." = ''; if (place".$row.".address_components) { address".$row." = [(place".$row.".address_components[0] && place".$row.".address_components[0].short_name || ''), (place".$row.".address_components[1] && place".$row.".address_components[1].short_name || ''), (place".$row.".address_components[2] && place".$row.".address_components[2].short_name || '') ].join(' '); } place_infowindow".$row.".setContent('<div><img src=\"' + place".$row.".icon + '\" width=\"24\" height=\"24\"/> <strong>' + place".$row.".name + '</strong><br>' + address".$row." ); place_infowindow".$row.".open(map, place_marker".$row."); });"; } $mapscript .="var product = new google.maps.LatLng(".$default_lat.",".$default_lng."); var marker = new google.maps.Marker({ position: product, map: map, clickable: false, title:'".JText::_('VMCUSTOM_VM2GEOLOCATOR_PRODUCTLOCATION')."' }); google.maps.event.addListener(map, 'click', function(event) { var PointTmp2 = event.latLng; marker.setPosition(PointTmp2); document.getElementById('custom_param[".$row."][latitude]').value = PointTmp2.lat(); document.getElementById('custom_param[".$row."][longitude]').value = PointTmp2.lng(); }); google.maps.event.addListener(map, 'zoom_changed', function(event) { document.getElementById('custom_param[".$row."][zoom]').value = map.getZoom(); }); google.maps.event.addListener(map, 'maptypeid_changed', function(event) { var mapTypeID = map.getMapTypeId(); document.getElementById('custom_param[".$row."][maptype]').value = mapTypeID.toUpperCase(); });"; if($stylez!=''){ $mapscript .="var stylez = ".$stylez."; var styledMapOptions = { name: \"CUSTOM\" } var GeoLocatorMapType = new google.maps.StyledMapType( stylez, styledMapOptions); map.mapTypes.set(\"CUSTOM\", GeoLocatorMapType); map.setMapTypeId(\"CUSTOM\");"; } $mapscript .="} function initgmap".$row."() { //if (arguments.callee.done) GUnload(); arguments.callee.done = true; initializemap".$row."(); }; add_Event(window, 'load', initgmap".$row.");"; $doc->addScriptDeclaration($mapscript); $html .='<div id="map'.$row.'" style="width:100%; height:400px">'.JText::_('VMCUSTOM_VM2GEOLOCATOR_SAVEONCEWARNING').'</div>'; $html .='<div>'; $html .='<input title="'.JText::_('VMCUSTOM_VM2GEOLOCATOR_LATITUDE').'" type="text" value="'.$default_lat.'" size="10" name="custom_param['.$row.'][latitude]" id="custom_param['.$row.'][latitude]" readonly> '; $html .='<input title="'.JText::_('VMCUSTOM_VM2GEOLOCATOR_LONGITUDE').'" type="text" value="'.$default_lng.'" size="10" name="custom_param['.$row.'][longitude]" id="custom_param['.$row.'][longitude]" readonly> '; $html .='<input title="'.JText::_('VMCUSTOM_VM2GEOLOCATOR_ZOOM').'" type="text" value="'.$default_zoom.'" size="2" name="custom_param['.$row.'][zoom]" id="custom_param['.$row.'][zoom]" readonly> '; $html .='<input title="'.JText::_('VMCUSTOM_VM2GEOLOCATOR_MAPTYPE').'" type="text" value="'.$default_maptype.'" size="10" name="custom_param['.$row.'][maptype]" id="custom_param['.$row.'][maptype]" readonly> '; $html .='<a href="javascript:initgmap'.$row.'();">'.JText::_('VMCUSTOM_VM2GEOLOCATOR_RESET').'</a>'; $html .='<div style="float:right;width:300px"><input id="searchTextField'.$row.'" type="text" size="50" placeholder="'.JText::_('VMCUSTOM_VM2GEOLOCATOR_PLACE_SEARCH').'" ></div>'; $html .='</div>'; //'.VmHTML::row('input','','custom_param['.$row.'][sound_url]',$field->sound_url).' $retValue .= $html ; $row++; return true ; } // get product param for this plugin on edit /** * @ idx plugin index * @see components/com_virtuemart/helpers/vmCustomPlugin::onDisplayProductFE() * @author Patrick Kohl * eg. name="customPlugin['.$idx.'][comment] save the comment in the cart & order */ //function onDisplayProductFE($field, $param,$product,$idx) { function plgVmOnDisplayProductFE( $product, &$idx,&$group){ $this->parseCustomParams($group); $this->getPluginProductDataCustom($group, $product->virtuemart_product_id); //if ($field->custom_value != $this->_pname) return ''; //$plgParam = $this->getVmCustomParams($field->virtuemart_custom_id); $db =& JFactory::getDBO(); $doc =& JFactory::getDocument(); $juri = JURI::base(); $q=" SELECT `virtuemart_customfield_id`, `custom_param` FROM `#__virtuemart_product_customfields` WHERE `custom_value`='vm2geolocator' AND `virtuemart_product_id`='".$product->virtuemart_product_id."' ORDER BY `virtuemart_customfield_id` ASC"; $db->setQuery($q); $product_places = $db->loadObjectList(); $countmarkers = count($product_places); //if($countmarkers>1 && $array = array(); foreach($product_places as $product_place){ $array[] = $product_place->virtuemart_customfield_id; //if( min($array)!= $field->virtuemart_customfield_id) if( min($array)!=$group->virtuemart_customfield_id) return ''; $start_lat = 13; $end_lat = strpos($product_place->custom_param,'","longitude":"'); $lat = substr($product_place->custom_param , $start_lat , $end_lat - $start_lat ); $start_lng = strpos($product_place->custom_param,'","longitude":"') + 15; $end_lng = strpos($product_place->custom_param,'","zoom') ; $lng = substr($product_place->custom_param , $start_lng , $end_lng - $start_lng ); $start_zoom = strpos($product_place->custom_param,'","zoom":"') + 10; $end_zoom = strpos($product_place->custom_param,'","maptype') ; $zoom = substr($product_place->custom_param , $start_zoom , $end_zoom - $start_zoom ); $start_maptype = strpos($product_place->custom_param,'","maptype":"') + 13; $end_maptype = strpos($product_place->custom_param,'"}') ; $maptype = substr($product_place->custom_param , $start_maptype , $end_maptype - $start_maptype ); } /*$latitude = $this->latitude; $longitude = $group->longitude; $zoom = $group->zoom; $maptype = $group->maptype;*/ $msize = $group->msize; $mode = $group->mode; $fe_map_width = $group->fe_map_width; $fe_map_height = $group->fe_map_height; $stylez = $group->stylez; $mcolor = $group->mcolor; $html = ''; // $countmarkers = 1; if($mode==1){ //javascript map $doc->addScript( "https://maps.google.com/maps/api/js?sensor=false"); $mapscript ="function add_Event(obj_, evType_, fn_){ if (obj_.addEventListener) obj_.addEventListener(evType_, fn_, false); else obj_.attachEvent('on'+evType_, fn_); }; function initializemap(){ directionsDisplay = new google.maps.DirectionsRenderer(); var latlng = new google.maps.LatLng(".$lat.",".$lng."); var myOptions = { zoom: ".$zoom.", center: latlng, mapTypeId: google.maps.MapTypeId.".strtoupper($maptype).", scrollwheel: false, navigationControl: true, scaleControl: true, mapTypeControl: true, overviewMapControl:true, streetViewControl: true } var map = new google.maps.Map(document.getElementById('map'), myOptions);"; $mapscript .="var Icon = new google.maps.MarkerImage('".$juri."plugins/vmcustom/vm2geolocator/markers/marker-".$msize.'-'.$mcolor.".png', "; if($msize =="normal") $mapscript .=" new google.maps.Size(20,34),new google.maps.Point(0,0),new google.maps.Point(10,34) ); var Shadow = new google.maps.MarkerImage('".$juri."plugins/vmcustom/vm2geolocator/markers/marker-normal-shadow.png', new google.maps.Size(37, 34), new google.maps.Point(0,0), new google.maps.Point(11, 34));"; elseif($msize =="tiny") $mapscript .=" new google.maps.Size(12,20),new google.maps.Point(0,0),new google.maps.Point(6,20) ); var Shadow = new google.maps.MarkerImage('".$juri."plugins/vmcustom/vm2geolocator/markers/marker-tiny-shadow.png', new google.maps.Size(22, 20), new google.maps.Point(0,0), new google.maps.Point(6, 20));"; if($countmarkers>1){ foreach($product_places as $product_place){ $start_lat = 13; $end_lat = strpos($product_place->custom_param,'","longitude":"'); $lat = substr($product_place->custom_param , $start_lat , $end_lat - $start_lat ); $start_lng = strpos($product_place->custom_param,'","longitude":"') + 15; $end_lng = strpos($product_place->custom_param,'","zoom') ; $lng = substr($product_place->custom_param , $start_lng , $end_lng - $start_lng ); $mapscript .="var product".$product_place->virtuemart_customfield_id." = new google.maps.LatLng(".$lat.",".$lng."); var marker".$product_place->virtuemart_customfield_id." = new google.maps.Marker({ position: product".$product_place->virtuemart_customfield_id.", map: map, clickable: true, icon: Icon, shadow: Shadow, title:'".JText::_('VMCUSTOM_VM2GEOLOCATOR_PRODUCTLOCATION')."' }); "; } } else{ $mapscript .="var product = new google.maps.LatLng(".$lat.",".$lng."); var marker = new google.maps.Marker({ position: product, map: map, clickable: true, icon: Icon, shadow: Shadow, title:'".JText::_('VMCUSTOM_VM2GEOLOCATOR_PRODUCTLOCATION')."' }); "; } if($stylez!=''){ $mapscript .="var stylez = ".$stylez."; var styledMapOptions = { name: \"CUSTOM\" } var GeoLocatorMapType = new google.maps.StyledMapType( stylez, styledMapOptions); map.mapTypes.set(\"CUSTOM\", GeoLocatorMapType); map.setMapTypeId(\"CUSTOM\");"; } $mapscript .="} function initgmap() { //if (arguments.callee.done) GUnload(); arguments.callee.done = true; initializemap(); }; add_Event(window, 'load', initgmap);"; $doc->addScriptDeclaration($mapscript); $html .='<div id="map" style="width:'.$fe_map_width.';height:'.$fe_map_height.';border:1px solid #cccccc;">'; //$html .= '<div style="text-align:center;padding-top:60px"><a href="http://geommunity.nordmograph.com"><img src="'.$juri.'plugins/vmcustom/vm2geolocator/img/loader.gif" title="Geommunity" alt="Geommunity" width="42" height="42" /></a></div>'; $html .='</div>'; } elseif($mode==2){//static map $tostrip = array("%", "px"); $static_width = str_replace($tostrip,"",$fe_map_width); $static_height = str_replace($tostrip,"",$fe_map_height); $src = 'https://maps.googleapis.com/maps/api/staticmap?size='.$static_width.'x'.$static_height; $src2 = ''; foreach($product_places as $product_place){ $start_lat = 13; $end_lat = strpos($product_place->custom_param,'","longitude":"'); $lat = substr($product_place->custom_param , $start_lat , $end_lat - $start_lat ); $start_lng = strpos($product_place->custom_param,'","longitude":"') + 15; $end_lng = strpos($product_place->custom_param,'","zoom') ; $lng = substr($product_place->custom_param , $start_lng , $end_lng - $start_lng ); $start_zoom = strpos($product_place->custom_param,'","zoom":"') + 10; $end_zoom = strpos($product_place->custom_param,'","maptype') ; $zoom = substr($product_place->custom_param , $start_zoom , $end_zoom - $start_zoom ); $start_maptype = strpos($product_place->custom_param,'","maptype":"') + 13; $end_maptype = strpos($product_place->custom_param,'"}') ; $maptype = substr($product_place->custom_param , $start_maptype , $end_maptype - $start_maptype ); if($countmarkers>1) $src2 .= '|'.$lat.','.$lng; //else } if($countmarkers==1) $src .='&center='.$lat.','.$lng.'&zoom='.$zoom; if(!$stylez && $countmarkers>1) $src .= '&maptype='.strtolower($group->maptype).''; elseif(!$stylez) $src .= '&maptype='.strtolower($maptype).''; else{ $json = $stylez; $json = json_decode($json, true); //&style=feature:water|hue:0x0800ff&style=feature:road|hue:0xff001a //$src .='&style='; } $src .= '&markers=size:'.$msize; $src .= '%7Ccolor:'.$mcolor; $title = JText::_('VMCUSTOM_VM2GEOLOCATOR_PRODUCTLOCATION'); if($countmarkers>1){ $title = JText::_('VMCUSTOM_VM2GEOLOCATOR_PRODUCTLOCATIONS'); } else $src .= '|'.$lat.",".$lng; if($countmarkers>1) $src .= $src2; $src .= '&sensor=false'; $html .='<div id="map" style="width:'.$fe_map_width.';height:'.$fe_map_height.';border:1px solid #cccccc;">'; $html .='<img src="'.$src.'" alt="'.$title.'" title="'.$title.'" class="hasTip" width="'.$fe_map_width.'" height="'.$fe_map_height.'" />'; $html .='</div>'; } $group->display .= $html; return ''; } function plgVmOnStoreProduct($data,$plugin_param){ $this->tableFields = array ( 'id', 'virtuemart_product_id', 'virtuemart_custom_id' ); return $this->OnStoreProduct($data,$plugin_param); } /** * We must reimplement this triggers for joomla 1.7 * vmplugin triggers note by Max Milbers */ protected function plgVmOnStoreInstallPluginTable($psType) { return $this->onStoreInstallPluginTable($psType); } function plgVmSetOnTablePluginParamsCustom($name, $id, &$table){ return $this->setOnTablePluginParams($name, $id, $table); } function plgVmDeclarePluginParamsCustom($psType,$name,$id, &$data){ return $this->declarePluginParams($psType, $name, $id, $data); } /** * Custom triggers note by Max Milbers */ function plgVmOnDisplayEdit($virtuemart_custom_id,&$customPlugin){ return $this->onDisplayEditBECustom($virtuemart_custom_id,$customPlugin); } } // No closing tag

Please Log in or Create an account to join the conversation.

Time to create page: 0.346 seconds
Powered by Kunena Forum
Disclaimer: Nordmograph is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.