简体   繁体   English

Prestashop Google Maps API

[英]Prestashop google maps API

I'm using Prestashop Theme Pts Diana and in my contact page I want to use google maps. 我正在使用Prestashop Theme Pts Diana,并且在我的联系页面中我想使用Google地图。 There is a module named Pts Map Locator but I cant find where I should put my API key. 有一个名为Pts Map Locator的模块,但我找不到应该将API密钥放在哪里。 I tried to add it in StoresController.php file but it doesn't work. 我试图将其添加到StoresController.php文件中,但是它不起作用。

Best way to solve this seems to find where is loaded google maps JS and add key parameter like this : //maps.googleapis.com/maps/api/js?sensor=false&key=ENTER_KEY_HERE 解决此问题的最佳方法似乎是找到加载Google Maps JS的位置,然后添加关键参数,例如://maps.googleapis.com/maps/api/js?sensor=false&key=ENTER_KEY_HERE

Dirty solution could be to add to store.tpl the script a second time with the key. 肮脏的解决方案可能是第二次使用密钥将脚本添加到store.tpl。 It won't kill anyone but it's definitely not a good practice : 它不会杀死任何人,但这绝对不是一个好习惯:

<script defer async type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false&amp;key=ENTER_KEY_HERE"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM