Jump to content

Recommended Posts

I was hoping to already see a module for Google Trusted Stores but no luck. There has to be someone here who has added this to their shop already?

If anyone has already accomplished the feed creation and code placement on a 2.2rc2a or 2.3 shop, it would be great if you could share!


All about Google Trusted Stores


If not, would anyone here be able to work on developing this? It should not be too difficult. Creating the feeds seems to be the tricky part beyond my ability. Integrating the final google code should be simpler and I can probably do that part; but without the feed part sorted first I am stuck. Anyone willing or able to knock this out?




Share this post

Link to post
Share on other sites

:thought_balloon:  Hi Roaddoctor,


Have you found a solution for the problem yet? I am most interested in learning about it.


Kindest regards,



Share this post

Link to post
Share on other sites

All -


Google has greatly simplified the requirements for Trusted Stores... order feeds and shipment feeds are no longer required! I worked on this to the extent of my abilities. If someone with actual coding skills would like to take it from here please do. Here is what I have so far. Note I was working on this for a 2.2rc2a shop. For 2.3.4+ this would be best as a content module (at least the checkout success portion). I am not a coder so below is just a starting point


New Trusted Stores integration details


For a 2.2 shop...

First the easy part: create new file at


  $Id: google_trusted_store.php,v 1.0 2015/01/24 BFD

  osCommerce, Open Source E-Commerce Solutions

  Copyright (c) 2015 osCommerce

  Released under the GNU General Public License

    if (isset($_GET['products_id']) && (tep_not_null($product_info['products_model'])) ) {
      $googlepid = $product_info['products_model'];
    } else {
      $googlepid = '';

<!-- BEGIN: Google Trusted Stores -->
<script type="text/javascript">
  var gts = gts || [];

  gts.push(["id", "xxxxxx"]);
  gts.push(["badge_position", "BOTTOM_LEFT"]);
  gts.push(["locale", "en_US"]);
<?php if (isset($_GET['products_id']) ) { ?>  
  gts.push(["google_base_offer_id", "<?php echo $googlepid; ?>"]);
<?php } ?>
  gts.push(["google_base_subaccount_id", "xxxxxxx"]);
  gts.push(["google_base_country", "US"]);
  gts.push(["google_base_language", "en"]);

  (function() {
    var gts = document.createElement("script");
    gts.type = "text/javascript";
    gts.async = true;
    gts.src = "https://www.googlecommerce.com/trustedstores/api/js";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(gts, s);
<!-- END: Google Trusted Stores -->

Then in /catalog/includes/footer.php (and mobile/includes/footer.php if exists), place at end of file

<?php include_once('includes/google_trusted_store.php'); ?>

That takes care of the code for every page in the shop.

Now for checkout_success.php, so far I have this (very rough) starting point... 

<!--Begin Google Trusted Stores -->

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

  <!-- start order and merchant information -->
  <span id="gts-o-id"><?php echo $order_id; ?></span>
  <span id="gts-o-domain">www.yourdomain.com</span>
  <span id="gts-o-email"><?php echo $email; ?></span>
  <span id="gts-o-country"><?php echo $iso_code_2; ?></span>
  <span id="gts-o-currency">USD</span>
  <span id="gts-o-total"><?php echo $order_total; ?></span>
  <span id="gts-o-discounts"><?php echo $discounts; ?></span>
  <span id="gts-o-shipping-total"><?php echo $shipping; ?></span>
  <span id="gts-o-tax-total"><?php echo $tax; ?></span>
  <span id="gts-o-est-ship-date"><?php echo $order_date+1 //('YYYY-MM-DD'); ?></span>
  <span id="gts-o-est-delivery-date"><?php echo $order_date+7 //('YYYY-MM-DD'); ?></span>
  <span id="gts-o-has-preorder"><?php echo $isBackordered; ?></span>
  <span id="gts-o-has-digital"><?php echo $isDownloadable; ?></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 $product_name; ?></span>
    <span class="gts-i-price"><?php echo $price; ?>]</span>
    <span class="gts-i-quantity"><?php echo $quantity; ?></span>
    <span class="gts-i-prodsearch-id"><?php echo $model; ?></span>
    <span class="gts-i-prodsearch-store-id">xxxxxxx</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 Certified Shops Order -->

<!--End Google Trusted Stores-->

What is needed from here, and beyond my ability, is the remaining code necessary for the checkout_success code above to work, including the looping thru the item specifics for each item. that's all I got so far. Good luck - Dave


Share this post

Link to post
Share on other sites

  <span id="gts-o-email"><?php echo $order->customer['email_address']; ?></span>

  <span id="gts-o-currency"><?php echo $order->info['currency']; ?></span>
  <span id="gts-o-total"><?php  echo $order->info['subtotal']; ?></span>

<span id="gts-o-shipping-total"><?php echo $order->info['shipping_cost']; ?></span>

Edited by cubifil

Share this post

Link to post
Share on other sites
<span id="gts-o-email"><?php echo $order->customer['email_address']; ?></span>

<span id="gts-o-country"><?php echo $order->customer['country']['iso_code_2']; ?></span>

  <span id="gts-o-currency"><?php echo $order->info['currency']; ?></span>

  <span id="gts-o-total"><?php  echo $order->info['subtotal']; ?></span>

<span id="gts-o-shipping-total"><?php echo $order->info['shipping_cost']; ?></span>

<span id="gts-o-tax-total"><?php echo $order->info['tax'] ?></span>

Edited by cubifil

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now