将Google信任徽章添加到Magento


圈圈红
2024-12-31 07:44:14 (2月前)
  1. “> CUSTOMER_EMAILLT; /跨度>

< span id =“gts-o-country”> CUSTOMER_COUNTRY< / span>
< span id =“gts-o-

货币
</跨度>
“&GT;

货币
</跨度>
&LT; /跨度&GT;
&lt; span id =“gts-o-total”&gt; ORDER_TOTAL&lt; / span&gt;
&lt; span id =“gts-o-discounts”-preorder“&gt; HAS_BACKORDER_PREORDER&lt; / span&gt;
&lt; span id =“gts-o-has-

数字
</跨度>
“&GT; HAS_DIGITAL_GOODS&LT; /跨度&GT;
&lt;! - 结束订单和商家信息 - &gt;

&lt;! - 开始重复项目特定信息“

5 条回复
  1. 0# 冷月如霜·胡狼 | 2019-08-31 10-32




    实施Google受信任商店



    #3将JavaScript添加到您的站点




    谷歌实际上希望你把第一部分放在上面

    一切

    您网站的页面。而不是在模板文件中执行此操作,您可以将其添加到页脚&gt;系统中的杂项HTML&gt;配置&gt;一般&gt;设计。我删除了

    ITEM_PRODUCT_SEARCH_ID



    ITEM_PRODUCT_SEARCH_ACCOUNT_ID

    ,但随时编辑您的产品页面以添加此数据。这是代码:





    1. </code>





    其余的代码只需要在

    结帐成功
    </强>
    页面(app / design / frontend / {your} / {theme} /template/checkout/success.phtml)。我们需要加载订单以获取客户的电子邮件,国家/地区和订单数据。您需要实施逻辑以确定是否有任何商品延期交货,是否有任何商品是下载商品,以及商品何时发货。在该文件中的任何位置添加:




    1. <?php
      $orderId = $this->getOrderId();
      $order = Mage::getModel(‘sales/order’)->loadByIncrementId($orderId);
      $customer = Mage::getModel(‘customer/customer’)->load($order->getCustomerId());
      $address = $order->getShippingAddress();
      $backorder = false; // some backorder logic
      $download = false; // some download logic
      $shipDate = new Zend_Date(); // some logic to determine ship date
      ?>


    2. </code>

  2. 1# 一瓶泡沫 | 2019-08-31 10-32



    代码肯定需要在app文件夹中的checkout成功页面上(app / design / frontend /

    yourtheme

    /template/checkout/success.phtml)。我在这里找到了答案

    magento徽章实施

    ,但正如几个答案所示,它是LOGIC,它很重要,并且每个商店通常都有所不同,具体取决于您运行的扩展和自定义开发。




    1. <!鈥� START Google Trusted Stores Order 鈥�>

    2. <!鈥� start order and merchant information 鈥�>
      <?php echo $orderId; ?>
      [INSERT URL (www.example.com)]
      <?php echo htmlentities($customer->getEmail()); ?>
      <?php echo htmlentities($address->getCountryId()); ?>
      [USD]
      <?php echo round_and_kep($order->getGrandTotal()); ?>
      [CALL IT OUT WITH CODE 鈥� use 0 if no discounts]
      <?php echo round_and_kep($order->getShippingAmount()); ?>
      <?php echo round_and_kep($order->getTaxAmount()); ?>
      <?php echo $shipDate->toString(鈥榶yyy-MM-dd鈥�); ?>
      <?php echo $shipDate->toString(鈥榶yyy-MM-dd鈥�); ?>
      <?php echo $backorder ? 鈥榊鈥� : 鈥楴’; ?>
      <?php echo $download ? 鈥榊鈥� : 鈥楴’; ?>
      <!鈥� end order and merchant information 鈥�>

    3. <!鈥� start repeated item specific information 鈥�>
      <!鈥� item example: this area repeated for each item in the order 鈥�>

      <?php echo htmlentities($item->getName()); ?>
      <?php echo round_and_kep($item->getBasePrice()); ?>
      <?php echo (int)$item->getQtyOrdered(); ?>
      [ITEM_GOOGLE_SHOPPING_ID]
      [YOUR STORE ID GIVEN TO YOU BY GOOGLE]
      US
      en

      <!鈥� end item 1 example 鈥�>
      <!鈥� end repeated item specific information 鈥�>


    4. <!鈥� END Google Trusted Stores Order 鈥�>

    5. </code>

  3. 2# 至此 | 2019-08-31 10-32



    您可以在底部插入该代码

    app/design/frontend/default/USED_TEMPLATE/template/checkout/onepage.phtml

    让它出现在最后的结帐页面上。



    您需要使用Magento函数填充变量并输出它们。例如:




    1. // Magento .phtml-style
      <?php $cart = Mage::getSingleton( checkout/cart ); ?>
      <?php echo $cart->getItemsCount(); ?>`

    2. </code>


    或者您可以走很长的路,在自己的扩展中使用Magento挂钩在任何地方展示Google-snippet,而无需在模板中实现它。


  4. 3# trpnest | 2019-08-31 10-32
登录 后才能参与评论