【问题标题】:Google Maps API MissingKeyMapError via Magento Plugin通过 Magento 插件的 Google Maps API MissingKeyMapError
【发布时间】:2016-08-30 05:05:14
【问题描述】:

我已经浏览了论坛,但似乎无法为我的具体问题找到答案。

所以,我在我的 Magento 商店中安装了第三方“商店定位器”插件,但我不断收到有关 MissingKeyMapError 的 js 错误消息。我已经申请了一个 API 密钥 - 但我的问题是我不确定我应该将这个密钥放在代码中的哪个位置。

API Key

我在这个特定插件的 app 文件夹中的 Googlemap.php 中,我认为它应该放在这里的某个地方,但不完全确定。

这是 Googlemap.php 中包含的内容:

class Clarion_Storelocator_Block_Adminhtml_Storelocator_Edit_Tab_Googlemap       extends Mage_Adminhtml_Block_Widget_Form
{
    protected function _prepareForm()
    {
        $model = Mage::registry('storelocator_data');

    $form = new Varien_Data_Form();
    $this->setForm($form);
    $fieldset = $form->addFieldset('form_General_Googlemap', array('legend'=>Mage::helper('clarion_storelocator')->__('Google Map')));

    $radiusConfigValue = Mage::getStoreConfig('clarion_storelocator_general_setting/clarion_storelocator_display_setting/default_radius');
    $fieldset->addField('radius', 'text', array(
      'label'     => Mage::helper('clarion_storelocator')->__('Radius'),
      'note'  => Mage::helper('clarion_storelocator')->__('Radius is in miles. If kept blank then default configured radius will be used (System > Configuration > Store Locator)'),
      'name'      => 'radius',
      'value'      => $radiusConfigValue,
    ));

    $fieldset->addField('latitude', 'text', array(
      'label'     => Mage::helper('clarion_storelocator')->__('Latitude'),
      'class'     => 'validate-number',
      'required'  => true,
      'name'      => 'latitude',
    ));

    $fieldset->addField('longitude', 'text', array(
      'label'     => Mage::helper('clarion_storelocator')->__('Longitude'),
      'class'     => 'validate-number',
      'required'  => true,
      'name'      => 'longitude',
    ));

    $zoomLevelConfigValue = Mage::getStoreConfig('clarion_storelocator_general_setting/clarion_storelocator_display_setting/zoom_level');
    $fieldset->addField('zoom_level', 'text', array(
      'label'     => Mage::helper('clarion_storelocator')->__('Zoom Level '),
      'note'  => Mage::helper('clarion_storelocator')->__('If kept blank then default configured zoom level will be used (System > Configuration > Store Locator)'),
      'name'      => 'zoom_level',
      'value'      => $zoomLevelConfigValue,
    ));

    $data = $model->getData();
    if(!empty($data)) {
        $form->setValues($data);
    }
   return parent::_prepareForm();
}
}**

任何帮助/建议将不胜感激!

提前致谢, 莱蒂西亚

【问题讨论】:

    标签: javascript php magento


    【解决方案1】:

    这个扩展我也有同样的问题,只是在你的主题布局下找到主要以 clarion_storelocator.xml 命名的 xml 文件,在这个 find google api path under script tag in line no #32 replace with src="//maps.googleapis .com/maps/api/js?v=3.exp&sensor=false&key=YOUR_API_KEY" async="" defer="defer" type="text/javascript"> 在脚本标签下

    记得放上你的 api 密钥。 享受编码:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-24
      • 1970-01-01
      • 2018-09-02
      • 1970-01-01
      • 2011-12-20
      • 2017-09-12
      • 2012-10-15
      • 1970-01-01
      相关资源
      最近更新 更多