我在Google地图的magento中遇到问题。 我有控制器,如下所示:Google地图控件未在magento中显示
class MapSoftware_Map_Adminhtml_MapbackendController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$this->loadLayout();
$this->_title($this->__("MapSales"));
$block = $this->getLayout()->createBlock('core/text', 'example-block')->setTemplate('map/mapbackend.phtml')->toHtml();
$this->_addContent($block);
$this->renderLayout();
}
}
我将使用mapbackend.phtml文件及以下
<style>
#map-canvas {
height: 100%;
margin: 0px;
padding: 0px;
}
#map-canvas img {
max-width: none;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=weather,places,drawing"></script>
<script>
var map;
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(0.1768697,37.9083264),
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DEFAULT,
mapTypeIds: [
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.TERRAIN
]
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL
}
};
map = new
google.maps.Map(document.getElementById('mapcanvas'),mapOptions);
var image = 'https://cdn0.iconfinder.com/data/icons/small-n-
flat/24/678111-map-marker-32.png';
var myLatLng = new google.maps.LatLng(0.1768697,37.9083264);
var beachMarker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="map-canvas" style="width: 96%; height: 500px; position: absolute;"></div>
所以现在我的问题是,当我通过它显示的页面代码,它给出了只有地图而不是控制器。此代码在本地机器上运行,但它不适用于magento。
请帮助我,我坚持这部分,我也是新的magento。
[Google Maps和Richfaces 3.3.3(prototype.js 1.6.0.3)可能的不兼容问题](http://stackoverflow.com/questions/25505754/google-maps-and-richfaces-3-3- 3-prototype-js-1-6-0-3-possible-incompatibility) – 2015-01-26 22:52:29