“&gt;&lt;?php echo $ email = $ customer-&gt; getData(‘email’); $ email_address2 = $ address-&gt; getEmail(); if($ email ==”“)$ email = $ email_address2; ?&GT;&LT; /跨度&GT; &lt; span id =“gts-o-country”&gt; US&lt; / span&gt; &lt; span id =“gts-o- 货币 </跨度> ’’’); ?&GT;&LT; /跨度&GT; &lt; span id =“gts-o-est-delivery-date”&gt; ORDER_EST_DELIVERY_DATE&lt; / span&gt; &lt; span id =“gts-o-has-preorder”&gt; N&lt; / span&gt; &lt; span id =“gts-o-has- 数字 </跨度> “将N&LT; /跨度&GT; &lt;! - 终止订单和商家信息“
不确定我是否可以提供帮助,但我也想尝试这项工作。 我联系了Google,他们专门为Magento发送了这个代码段:
<?php // Obtain order variables with Magento functions $orderId = $this->getOrderId(); $order = Mage::getModel('sales/order')->loadByIncrementId($orderId); $customer = Mage::getModel('customer/customer')->load($order->getCustomerId()); $address = $order->getShippingAddress(); ?> <!-- START Google Trusted Stores Order --> <div id="Google Trusted Stores-order" style="display:none;" translate=鈥漬o鈥�> <!-- start order and merchant information --> <span id="Google Trusted Stores-o-id"> <?php echo $orderId; ?> </span> <span id="Google Trusted Stores-o-domain"> MERCHANT_ORDER_DOMAIN </span> <span id="Google Trusted Stores-o-email"> <?php echo htmlentities($customer->getEmail()); ?> </span> <span id="Google Trusted Stores-o-country"> <?php echo htmlentities($address->getCountryId()); ?> </span> <span id="Google Trusted Stores-o-currency"> CURRENCY </span> <span id="Google Trusted Stores-o-total"> <?php echo $order->getGrandTotal(); ?> </span> <span id="Google Trusted Stores-o-discounts"> -<?php echo $order->getDiscountAmount(); ?> </span> <span id="Google Trusted Stores-o-shipping-total"> <?php echo $order->getShippingAmount(); ?> </span> <span id="Google Trusted Stores-o-tax-total"> <?php echo $order->getTaxAmount(); ?> </span> <span id="Google Trusted Stores-o-est-ship-date"> ORDER_EST_SHIP_DATE </span> <span id="Google Trusted Stores-o-est-delivery-date"> ORDER_EST_DELIVERY_DATE </span> <span id="Google Trusted Stores-o-has-preorder"> HAS_BACKORDER_PREORDER </span> <span id="Google Trusted Stores-o-has-digital"> HAS_DIGITAL_GOODS </span> <!-- end order and merchant information --> <!-- start repeated item specific information --> <?php foreach ($order->getAllItems() as $item): ?> <span class="Google Trusted Stores-item"> <span class="Google Trusted Stores-i-name"> <?php echo htmlentities($item->getName()); ?> </span> <span class="Google Trusted Stores-i-price"> <?php echo $item->getBasePrice(); ?> </span> <span class="Google Trusted Stores-i-quantity"> <?php echo (int)$item->getQtyOrdered(); ?> </span> </span> <?php endforeach; ?> <!-- end repeated item specific information --> </div> <!-- END Trusted Stores -->
他还说:
所有以下变量都是必需的,以便触发OCM代码。请参考 订单级变量在这里 。
<span id="Google Trusted Stores-o-est-ship-date">ORDER_EST_SHIP_DATE</span> <span id="Google Trusted Stores-o-est-delivery-date">ORDER_EST_DELIVERY_DATE</span> <span id="Google Trusted Stores-o-has-preorder"> HAS_BACKORDER_PREORDER </span> <span id="Google Trusted Stores-o-has-digital"> HAS_DIGITAL_GOODS </span>
我根据需要更改了变量但是对于我来说,我甚至没有像OCM那样得到错误消息,所以我不知道这些是否是正确的代码,但可能是其他人的。
我相信你已经遇到过所有这些信息,但我也需要一个答案。