【问题标题】:How to add custom code to prestashop如何将自定义代码添加到 prestashop
【发布时间】:2014-12-16 06:44:46
【问题描述】:

我正在尝试将以下代码添加到我的 prestashop 网站,以便能够显示我的 google 信任网站徽章:

<!-- BEGIN: Google Trusted Stores -->
<script type="text/javascript">
  var gts = gts || [];

  gts.push(["id", "STORE_ID"]);
  gts.push(["badge_position", "BOTTOM_RIGHT"]);
  gts.push(["locale", "english_australia"]);
  gts.push(["google_base_offer_id", "ITEM_GOOGLE_SHOPPING_ID"]);
  gts.push(["google_base_subaccount_id", "ITEM_GOOGLE_SHOPPING_ACCOUNT_ID"]);
  gts.push(["google_base_country", "ITEM_GOOGLE_SHOPPING_COUNTRY"]);
  gts.push(["google_base_language", "ITEM_GOOGLE_SHOPPING_LANGUAGE"]);

  (function() {
    var gts = document.createElement("script");
    gts.type = "text/javascript";
    gts.async = true;
    gts.src = "https://www.googlecommerce.com/trustedstores/api/js";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(gts, s);
  })();
</script>
<!-- END: Google Trusted Stores -->

我需要它在每个页面上都可见,无论我做什么,我都无法让它显示徽章。

【问题讨论】:

    标签: javascript html prestashop google-trusted-stores


    【解决方案1】:

    您很可能需要安装一个模块来添加自定义 html。
    这是要添加到底部/页脚区域的一个。
    http://www.prestashop.com/forums/topic/165066-free-prestashop-module-easy-footer/
    您可以在页脚区域添加自定义 html 内容,它将对整个网站可见。

    【讨论】:

      【解决方案2】:

      有点晚了,但最简单的方法是创建一个 js 文件,并将其放在您的主题脚本文件夹中:/themes/yourtheme/js/autoload 这样它就会加载到每个页面上。

      【讨论】:

        【解决方案3】:

        最简单的方法是将代码插入 header.tpl。

        【讨论】:

        • 当然!但是,如果您编辑默认主题,请小心,因为它可能会在更新时被覆盖。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-05-21
        • 1970-01-01
        • 2016-05-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多