【问题标题】:Google Trusted Stores - confirm order without refresh pageGoogle Trusted Stores - 无需刷新页面即可确认订单
【发布时间】:2015-07-24 22:53:44
【问题描述】:

是否可以在不刷新页面的情况下在 Google Trusted Stores 上确认订单?

转换代码如下所示:

<!-- START Google Trusted Stores Order -->
<div id="gts-order" style="display:none;" translate="no">

<!-- start order and merchant information -->
<span id="gts-o-id">MERCHANT_ORDER_ID</span>
<span id="gts-o-domain">MERCHANT_ORDER_DOMAIN</span>
<span id="gts-o-email">CUSTOMER_EMAIL</span>
<span id="gts-o-country">CUSTOMER_COUNTRY</span>
<span id="gts-o-currency">CURRENCY</span>
<span id="gts-o-total">ORDER_TOTAL</span>
<span id="gts-o-discounts">ORDER_DISCOUNTS</span>
<span id="gts-o-shipping-total">ORDER_SHIPPING</span>
<span id="gts-o-tax-total">ORDER_TAX</span>
<span id="gts-o-est-ship-date">ORDER_EST_SHIP_DATE</span>
<span id="gts-o-est-delivery-date">ORDER_EST_DELIVERY_DATE</span>
<span id="gts-o-has-preorder">HAS_BACKORDER_PREORDER</span>
<span id="gts-o-has-digital">HAS_DIGITAL_GOODS</span>
<!-- end order and merchant information -->

<!-- start repeated item specific information -->
<!-- item example: this area repeated for each item in the order -->
<span class="gts-item">
<span class="gts-i-name">ITEM_NAME</span>
<span class="gts-i-price">ITEM_PRICE</span>
<span class="gts-i-quantity">ITEM_QUANTITY</span>
<span class="gts-i-prodsearch-id">ITEM_GOOGLE_SHOPPING_ID</span>
<span class="gts-i-prodsearch-store-id">ITEM_GOOGLE_SHOPPING_ACCOUNT_ID</span>
<span class="gts-i-prodsearch-country">ITEM_GOOGLE_SHOPPING_COUNTRY</span>
<span class="gts-i-prodsearch-language">ITEM_GOOGLE_SHOPPING_LANGUAGE</span>
</span>
<!-- end item 1 example -->
<!-- end repeated item specific information -->

</div>
<!-- END Google Trusted Stores Order -->

我有 reactjs 应用程序。所以如果我把这段代码放到 DOM 我需要调用 api 调用谷歌。但我找不到任何 API。

可能会触发 window.onload 但它可能会产生非常意想不到的行为:(

有什么想法吗?

谢谢!

【问题讨论】:

  • 我也有同样的问题。你找到解决办法了吗?

标签: javascript html google-api google-trusted-stores


【解决方案1】:

不如创建一个弹出窗口,在弹出窗口中使用 iframe?该 iframe 将包含 Google Trusted Store 代码的内容。

【讨论】:

    【解决方案2】:

    非 iframe 解决方案:如果您动态重新注入 google 信任商店 html 脚本标签,该脚本将搜索 gts id 并调用弹出窗口。为了清洁,最好在执行此操作之前删除当前脚本标记。该脚本不是为 SPA 设计的。

    【讨论】:

      猜你喜欢
      • 2015-12-08
      • 1970-01-01
      • 1970-01-01
      • 2016-01-08
      • 2012-04-09
      • 2013-12-15
      • 1970-01-01
      • 1970-01-01
      • 2013-03-10
      相关资源
      最近更新 更多