Jump to content

Setting up Google Trusted Site


Recommended Posts

OK. I made a test payment all the way to completion and see that the page it comes back to is really the account lookiup page for that order ID number.

There are a BUNCH of things I don't know how to do on templates/content.order.php.

Here's the Google code that needs the proper data plugged in. I've fixed some that I did understand.


<!-- START Trusted Stores Order -->

<div id="gts-order" style="display:none;">

<!-- start order and merchant information -->

<span id="gts-o-id">MERCHANT_ORDER_ID</span>

<span id="gts-o-domain">store domain goes here</span>

<span id="gts-o-email">CUSTOMER_EMAIL</span> ------- has to be formatted as a regular email address

<span id="gts-o-country">US</span>

<span id="gts-o-currency">USD</span>

<span id="gts-o-total">ORDER_TOTAL</span> ------- dollar sign needs to be stripped off

<span id="gts-o-discounts">ORDER_DISCOUNTS</span> ----- without dollar sign

<span id="gts-o-shipping-total">ORDER_SHIPPING</span> ----- without dollar sign

<span id="gts-o-tax-total">ORDER_TAX</span> ----- without dollar sign

<span id="gts-o-est-ship-date">ORDER_EST_SHIP_DATE</span> ----- how can I use the order create date and add 4 days to it?? Has to be in YYYY-MM-DD format

<span id="gts-o-has-preorder">N</span>

<span id="gts-o-has-digital">N</span>

<!-- end order and merchant information -->

<!-- start repeated item specific information -->

<!-- item example: this area repeated for each item in the order --> ----- do I use the {foreach} {/foreach} code here??

<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">US</span>

<span class="gts-i-prodsearch-language">EN</span>

</span>

<!-- end item 1 example -->

<!-- end repeated item specific information -->

Has anyone successfully set this up? It's only available for US merchants.

Link to comment
Share on other sites

Some of this I've managed to search and figure out for myself. Adding -unformatted to the money amounts worked, such as {$order.shipping-unformatted}.

And evidently I do not use the {foreach}{/foreach} code, but I'm still not sure, because this seems so logical.

I've been trying to figure out how to change the {$order.order_date} to yyyyMMdd format so it will show up as an actual date. NO luck so far.

Link to comment
Share on other sites

The column order_date is a unix epoch timestamp (number of seconds since midnight, the morning of Jan1, 1970).

As best as I recollect, Smarty (as installed in Cubecart) does not have the necessary code to figure this out. Any manipulation has to be done in PHP.

If we are working off of content.orders.php, what calls that template to populate it? It is cubecart.class.php, at about line 1924.

At about line 2018, there is this:

$order['time'] = formatTime($order['order_date']);

The formatTime() function is in the functions.inc.php file and is necessary because we at least need to add the time offset specified in the store's general settings from UTC. Then I guess Cubecart gets cute and adds 'today', 'yesterday', and 'tomorrow' if appropriate.

I bring this function to your attention because we will use it in cubecart.class.php (and anywhere else we need to).

So, the statement we can insert in the PHP where we need it is:

$order['time_yyyymmdd'] = formatTime($order['order_date'],'%Y%m%d',true);

where $order is the array that will be fed to Smarty, and true so that we don't get any of the cute stuff.

Link to comment
Share on other sites

Smarty does have a date_format modifier - http://www.smarty.net/docsv2/en/language.modifier.date.format.tpl

So in theory it should be possible to do

{$order.time|date_format:"%Y-%m-%d"}

but I'm not sure if it's possible to add 4 days to it from the template.

Link to comment
Share on other sites

@Bsmither - I don't know how to make use of your information. Do I put this code

$order['time_yyyymmdd'] = formatTime($order['order_date'],'%Y%m%d',true);
BEFORE I start the Trusted Site Code and then call it from within their code?@Viola - I did find this in searching as a way to add 7 days to a date
{$smarty.now + (60*60*24*7)|date_format:"%d-%m-%Y"}

Is there some way to use that?

Is this site of any use??

http://www.smarty.net/forums/viewtopic.php?p=64367

UGH!! I had to move the whole Trusted Site Code to get it out of a foreach loop. Now I can't get the UNIX time back to showing. I've tried $order.time and $order.order_date, but neither one is being recognized.

Link to comment
Share on other sites

I think one possible reason why I'm having so much trouble with this is that I don't know how to tell PayPal to send the information back to the actual order information page, rather than the list of orders page. PayPal stopped some time ago showing ANY of the CC order information on their site, which I've never been able to correct.

I made a dummy order and can see everything here when logged in as [email protected] pw test.

http://dirtybutter.c...903-093525-5055

But when I'm logged in as [email protected], and I treat it the way PayPal returns to CC, I get

http://dirtybutter.c...hp?_a=vieworder

So maybe I'm working on the wrong part of the problem. IS there any way to get PP to use MY order number information, so it will return to http://dirtybutter.c...903-093525-5055?? I use the standard PP plugin on CC.

Link to comment
Share on other sites

I finally figured it all out, as far as I can tell at this point.

I ended up making several changes to the content.receipt.php file to get all the required Google information captured on the page, so I could tell when I was using the correct code.

I also added this to comply with PayPal's direction that the returning page should make it clear that the payment had been received.


<!--Added to give status appropriate information on Lookup Order page-->

{if $SUM.status == 2}

<fieldset id="order_summary">

<h1>Thank You for Your Payment!</h1>

<div class="wrapper">

<table class="shopping-cart">

If at all possible we will ship within 2 business days. We'll email you the day we ship with the Delivery Confirmation number or Customs number for your package.

</table>

</div>

</fieldset>

{/if}

{if $SUM.status == 3}

<fieldset id="order_summary">

<h1>Your Order Has Been Shipped</h1>

<div class="wrapper">

<table class="shopping-cart">

We have shipped your order. Please allow approximately a week for Domestic and up to 30 days for International packages to arrive.

If there is a problem with the condition of your delivered package, please keep all packaging and notify us within 3 days of receipt.

</table>

</div>

</fieldset>

{/if}

<!--end of Status Info on Lookup Order page-->





I also modified the Tracking number information on the Lookup Order page to include an actual link to tracking. This worked because we use Endicia.



<td>{$LANG.orders.shipping_tracking}</td>

		 <td><a href="https://www.endicia.com/Status/?PIC={$DELIVERY.tracking}" target="_blank">{$DELIVERY.tracking}</td>





But what I'm most pleased about is that I figured out how to set a future shipping date in the yyyy-mm-dd format that Google required. The *4 adds 4 days worth of seconds to the UNIX order date, which is then formatted to yyyy-mm-dd. We normally ship within 2 business days, but 4 should keep me out of trouble with weekend and holiday times when we can't ship.





{($SUM.order_date + (60*60*24*4))|date_format:"%Y-%m-%d"}

Link to comment
Share on other sites

Here's the Trusted Site code with all the data entries that worked for me:


<!-- START Trusted Stores Order plugins came from print.receipt.php -->

<div id="gts-order" style="display:none;">

  <!-- start order and merchant information -->

  <span id="gts-o-id"> {$SUM.cart_order_id} </span>

  <span id="gts-o-domain">MYDOMAIN</span>

  <span id="gts-o-email"> {$SUM.email} </span>

  <span id="gts-o-country">US</span>

  <span id="gts-o-currency">USD</span>

  <span id="gts-o-total"> {$order.total-unformatted} </span>

  <span id="gts-o-discounts"> -{$order.discount-unformatted} </span>

  <span id="gts-o-shipping-total"> {$order.shipping-unformatted} </span>

  <span id="gts-o-tax-total"> {$tax.value-unformatted} </span>

  <span id="gts-o-est-ship-date"> {($SUM.order_date  + (60*60*24*4))|date_format:"%Y-%m-%d"} </span>

  <span id="gts-o-has-preorder">N</span>

  <span id="gts-o-has-digital">N</span>

    <!-- end order and merchant information -->



<!-- start repeated item specific information -->

{foreach from=$ITEMS item=item}

    <span class="gts-item">

    <span class="gts-i-name"> {$item.name} </span>

    <span class="gts-i-price"> {$item.price_total-unformatted} </span>

    <span class="gts-i-quantity"> {$item.quantity} </span>

    <span class="gts-i-prodsearch-id"> {$item.product_id} </span>

    <span class="gts-i-prodsearch-store-id">MYGOOGLEMERCHANTID</span>

    <span class="gts-i-prodsearch-country">US</span>

    <span class="gts-i-prodsearch-language">EN</span>

  </span>

   <!-- end repeated item specific information -->

{/foreach}

</div>

<!-- END Trusted Stores -->

I also had to create a shipment and a cancelled order feed to upload on Google Merchant, so I've added ship_tracking to the array in sources/reports.index.inc.php, so I could use the Sales Report section to export orders each day.

That's when I discovered that the 5.1.4 Sales Report module Filter does not work properly. Date works, but no matter what Status I choose, I get completed orders. I need to be able to list Cancelled orders for Google Trusted Site cancelled order feed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...