【问题标题】:Getting one product information from category page in Magento从 Magento 的类别页面获取一个产品信息
【发布时间】:2013-05-03 02:36:49
【问题描述】:

¡你好,

我正在尝试在我的 Magento 网站上设置这个该死的 Google 信任商店脚本。我似乎谷歌希望我将以下 javascript 添加到每个页面并从每个页面调用一个产品。这对于产品页面没问题,但我在其他页面(如类别页面)上遇到了一些问题。我想我可以以某种方式将脚本添加到 template/catalog/product/list.phtml 所以无论如何,我想知道我是否可以使用 PHP 将每个类别页面上的第一个产品列表添加到 Google javascript?

有没有人想出如何像 Google 一样将脚本添加到 Magento,或者在某个地方有关于它的教程?

这是 Google javascript:

<!-- BEGIN: Google Trusted Stores -->
<script type="text/javascript">
  var gts = gts || [];
  gts.push(["id", "xxxxxx"]);
  gts.push(["google_base_offer_id", "<?php echo $this->htmlEscape($_product->getSku()) ?>"]);
  gts.push(["google_base_subaccount_id", "xxxxxxxx"]);
  gts.push(["google_base_country", "US"]);
  gts.push(["google_base_language", "EN"]);
  (function() {
    var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
    var gts = document.createElement("script");
    gts.type = "text/javascript";
    gts.async = true;
    gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(gts, s);
  })();
</script>
<!-- END: Google Trusted Stores -->

谢谢

【问题讨论】:

    标签: magento-1.7 google-trusted-stores


    【解决方案1】:

    我太笨了,代码已经在 Google 可信商店模块中了。 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-20
      相关资源
      最近更新 更多