You have no items in your shopping cart.

Product was successfully added to your shopping cart.

Google Trusted Stores on Magento

Google Trusted Stores on Magento

Before you embark on mission to get Google Trusted Seal and have it on your website, make sure you get approved first. Just like any other google approval guideline – it is not that simple and easy. We have clients that sell in millions and still yet to be approved to carry the badge.

What we can recommend is that if you really want to make this work correctly you can’t just use magento extension from the connect link. It will only get you as far as installation is concerned. If you need more out of google stores and measure it on google analytics and do everything google says and recommends – you will need to script the code within magento. Chances are if you are able to earn the badge you are doing fairly well and also have customized store that go you to that point.

So let’s get to details. First you need to create account on google and get all that setup.

Next thing you need to do is place the code within your success.html page. If you have separate theme, make sure you use your theme success page. Once you open success page, you will probably have other checkout success codes in there like affiliate marketing, google shopping etc. It is very important to make sure you don’t merge any of those codes.

open success.phtml page and add some reference variables at the top. This should help you guide what you need to do and also set parameters for the actual google trusted store code below.

    $orderId = $this->getOrderId();
    $order = Mage::getModel(‘sales/order’)->loadByIncrementId($orderId);
    $customer = Mage::getModel(‘customer/customer’)->load($order->getCustomerId());
    $address = $order->getShippingAddress();
    $discount = $order->getDiscountAmount();
    $subtotal = $order->getSubtotal();
    $total = $order->getGrandTotal();
    $backorder = false; // some backorder logic
    $download = false; // some download logic
    $shipDate = new Zend_Date(); // some logic to determine ship date

The trusted store code has 2 parts. First is Merchant and Order information and second is Item information.

Next you will insert both items and we will explain what you need to change in each (set your values for everything that is within parentheses [ ]):

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

    <!– start order and merchant information –>
    <span id=”gts-o-id”><?php echo $orderId; ?></span>
    <span id=”gts-o-domain”>[INSERT URL (www.example.com)]</span>
    <span id=”gts-o-email”><?php echo htmlentities($customer->getEmail()); ?></span>
    <span id=”gts-o-country”><?php echo htmlentities($address->getCountryId()); ?></span>
    <span id=”gts-o-currency”>[USD]</span>
    <span id=”gts-o-total”><?php echo round_and_kep($order->getGrandTotal()); ?></span>
    <span id=”gts-o-discounts”>[CALL IT OUT WITH CODE – use 0 if no discounts]</span>
    <span id=”gts-o-shipping-total”><?php echo round_and_kep($order->getShippingAmount()); ?></span>
    <span id=”gts-o-tax-total”><?php echo round_and_kep($order->getTaxAmount()); ?></span>
    <span id=”gts-o-est-ship-date”><?php echo $shipDate->toString(‘yyyy-MM-dd’); ?></span>
    <span id=”gts-o-est-delivery-date”><?php echo $shipDate->toString(‘yyyy-MM-dd’); ?></span>
    <span id=”gts-o-has-preorder”><?php echo $backorder ? ‘Y’ : ‘N’; ?></span>
    <span id=”gts-o-has-digital”><?php echo $download ? ‘Y’ : ‘N’; ?></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”><?php echo htmlentities($item->getName()); ?></span>
    <span class=”gts-i-price”><?php echo round_and_kep($item->getBasePrice()); ?></span>
    <span class=”gts-i-quantity”><?php echo (int)$item->getQtyOrdered(); ?></span>
    <span class=”gts-i-prodsearch-id”>[ITEM_GOOGLE_SHOPPING_ID]</span>
    <span class=”gts-i-prodsearch-store-id”>[YOUR STORE ID GIVEN TO YOU BY GOOGLE]</span>
    <span class=”gts-i-prodsearch-country”>US</span>
    <span class=”gts-i-prodsearch-language”>en</span>
    <!– end item 1 example –>
    <!– end repeated item specific information –>

    <!– END Google Trusted Stores Order –>

Make sure you set yourself with a guide on top of what you need to call out and how. It makes a huge difference after you go forward and need it for other checkout codes besides google trusted store badge. Different versions of magento require different code approach and if you have major re-development done on checkout or database, these codes may not work as well.

Upon completion you should be able to test the validity of your code via google badge testing area. It will determine if you can display the badge correctly on several browsers. The usccesful outcome should look like this:
Google Trusted Stores Magento Validation

If you would like Lifetime Media Group to look at your your store and configure it correctly, please contact us.

Topic: Magento 1

Category: Magento 1 Help