Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: [BOUNTY: $50] Google Trusted Stores XML Package - Can you help?

  1. #1
    Join Date
    Jan 2010
    Posts
    62

    Default [BOUNTY: $50] Google Trusted Stores XML Package - Can you help?

    Hi guys, I originally posted this item here (Link) and figured this was a better location for an XML Package.

    Fist the concept code to implement Google Trusted Stores, it is a modification of don.irwin's code he posted here (Link).. and my concept code dosn't work, but I am offering a bounty of $50 to your paypal account to help make this work. The problem (other than errors galore because I am no XML expert) is finding the productid when landing on a product page:

    Yesterday, I installed this package and realized the same type of XML package could be used for "Google trusted stores" implementation.

    So here is the Idea:
    (bare with me as I pulled the concept from a couple of posts here on the forum):

    We need to create an Xml Package (like don.irwin) and register it with the template.master in the skin template directory, so that the template can do all the heavy lifting on all the pages of your store.

    The key features of the XML Package:

    1- The main code of the don.irwin's analytics package is modified is below with the Google trusted store info. The code is a concept that I have been kicking around, and will not work at this time. The following would require two account codes provided by Google. First the Trusted Store id represented by 4 X's in the code (XXXX) and the Google merchant account ID, represented by 7 X's in the code (XXXXXXX). Also, you need to put in your domain, instead of mine in the code. The question marks in the code (???????) should contain the ProductId when landing on a product page, but are blank when not on a product page:

    PLEASE DO NOT USE CONCEPT CODE, IT WILL PRODUCE ERRORS AT THIS TIME:

    Code:
    <?xml version="1.0" standalone="yes" ?>
    <package version="2.1" displayname="TrustedStore" debug="false" includeentityhelper="false">
      <query name="Order" rowElementName="OrderInfo">
        <sql>
          <![CDATA[
          select o.*, (case when o.AffiliateID = 0
    then 'None' else (select a.Name from dbo.Affiliate a  with (NOLOCK) where a.AffiliateID = o.AffiliateID) end) as AffiliateName From dbo.orders o with (NOLOCK)
    where o.ordernumber = @ordernum
           ]]>
        </sql>
        <queryparam paramname="@ordernum" paramtype="request" requestparamname="ordernumber" defvalue="0" sqlDataType="int" validationpattern="^\d{1,9}$"/>
      </query>
      <query name="OrderItems" rowElementName="Item">
        <sql>
          <![CDATA[
              SELECT  s.ShoppingCartRecID, 
                      s.OrderNumber, 
                      s.ProductID, 
                      s.VariantID, 
                      s.Quantity, 
                      s.ChosenColor, 
                      s.ChosenSize, 
                      s.OrderedProductName, 
                      s.OrderedProductVariantName, 
                      s.OrderedProductSKU, 
                      s.OrderedProductPrice, 
                      s.OrderedProductRegularPrice, 
                      s.OrderedProductSalePrice, 
                      s.OrderedProductExtendedPrice, 
                      s.OrderedProductQuantityDiscountName, 
                      s.OrderedProductQuantityDiscountID, 
                      s.OrderedProductQuantityDiscountPercent, 
                      s.IsShipSeparately, 
                      s.IsDownload, 
                      s.FreeShipping, 
                      s.TextOption, 
                      s.ShippingMethod, 
                      s.Notes, 
                      s.ExtensionData, 
                      s.CustomerEntersPrice, 
                      s.GiftRegistryForCustomerID, 
                      s.ShippingAddressID, 
                      s.ShippingDetail, 
                      s.SizeOptionPrompt, 
                      s.ColorOptionPrompt, 
                      s.TextOptionPrompt, 
                      s.IsTaxable, 
                      s.TaxClassID, 
                      s.TaxRate,
                      ISNULL(s.IsAKit, 0) AS IsAKit, 
                      ISNULL(s.IsAPack, 0) AS IsAPack, 
                      ISNULL(s.IsSystem, 0) AS IsSystem
              FROM dbo.Orders_ShoppingCart s WITH (NOLOCK) 
              WHERE s.ordernumber = @ordernum
              ORDER by s.ShippingAddressID
                ]]>
        </sql>
        <queryparam paramname="@ordernum" paramtype="request" requestparamname="ordernumber" defvalue="0" sqlDataType="int" validationpattern="^\d{1,9}$"/>
      </query>
    
      <PackageTransform>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
          <xsl:output method="html" omit-xml-declaration="yes"/>
          <xsl:variable name="OrderNumber" select="/root/Order/OrderInfo/OrderNumber" />
          <xsl:template match="/">
            <!-- BEGIN: Google Trusted Store -->
            <!-- the code below needs to be run on all pages -->
    		<script type="text/javascript">
    		  var gts = gts || [];
    		  gts.push(["id", "XXXX"]);
    		  gts.push(["google_base_offer_id", "???????"]);
      		  gts.push(["google_base_subaccount_id", "XXXXXXX"]);
      		  gts.push(["google_base_country", "US"]);
      		  gts.push(["google_base_language", "en"]);
      		  
      		    (function() {
    		    var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
    		    var gts = document.createElement("script");
    		    gts.type = "text/javascript";
    		    gts.async = true;
    		    gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
    		    var s = document.getElementsByTagName("script")[0];
    		    s.parentNode.insertBefore(gts, s);
    		  })();
            </script>
    		<!-- END: Google Trusted Store -->
      
      		<!-- START Trusted Stores Order -->
      		<!-- the code below needs to be run only when on the order confirmation page -->
      		
      		<xsl:if test="/root/Runtime/PageName = 'orderconfirmation.aspx'">
    		<div id="gts-order" style="display:none;">
    		
    		  <!-- start order and merchant information -->
    		  <span id="gts-o-id"><xsl:value-of select="$OrderNumber" /></span>
    		  <span id="gts-o-domain">www.revgenetics.com</span>
    		  <span id="gts-o-email"><xsl:value-of select="/root/Order/OrderInfo/Email" /></span>
    		  <span id="gts-o-country"><xsl:value-of select="/root/Order/OrderInfo/BillingCountry" /></span>
    		  <span id="gts-o-currency">USD</span>
    		  <span id="gts-o-total"><xsl:value-of select="format-number(/root/Order/OrderInfo/OrderTotal, '0.00')" /></span>
    		  <span id="gts-o-discounts">0.00</span>
    		  <span id="gts-o-shipping-total"><xsl:value-of select="format-number(/root/Order/OrderInfo/OrderShippingCosts, '0.00')" /></span>
    		  <span id="gts-o-tax-total"><xsl:value-of select="format-number(/root/Order/OrderInfo/OrderTax, '0.00')" /></span>
    		  <script type="text/javascript">
    		  	var d1=new Date();
    		  	dl.setDate(dl.getDate() + 7);
    		  	document.write("<span id="gts-o-est-ship-date">"+d1.toString('yyyy-MM-dd')+"</span>");
    		  //<span id="gts-o-est-ship-date">d1.toString('yyyy-MM-dd');</span>
              </script>
    		  <span id="gts-o-has-preorder">N</span>
    		  <span id="gts-o-has-digital">N</span>
    		  <!-- end order and merchant information -->
    		  
                <xsl:apply-templates select="/root/OrderItems/Item" />
              </xsl:if>
          </xsl:template>
    
     		 <!-- start repeated item specific information -->
          <xsl:template match="Item">
     		<xsl:if test="/root/Runtime/PageName = 'orderconfirmation.aspx'">
     		
     	    <!-- the code below needs to be run only when on the order confirmation page -->
     
    		  <span class="gts-item">
    		    <span class="gts-i-name"><xsl:value-of select="OrderedProductName" /></span>
    		    <span class="gts-i-price"><xsl:value-of select="OrderedProductPrice" /></span>
    		    <span class="gts-i-quantity"><xsl:value-of select="Quantity" /></span>
    		    <span class="gts-i-prodsearch-id"><xsl:value-of select="ProductID" /></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>
    		  </span>
    		 
            
              </xsl:if>
                <!-- end repeated item specific information -->
          </xsl:template>
        </xsl:stylesheet>
      </PackageTransform>
    </package>
    2- The key posts to create the template are don.irwin's post () that can do most of the work by modifiing the output. The code above represents my chicken scratch of the modifications. As for the ProductID represented in the code by my questions marks (??????), I am not sure how to query the product page for the product id to help complete the code.

    At this point, I would like to ask for help to complete this Xml Package. Don.Irwin and others, can you take a look to see if some of the concept code can be used?

    MUCH appreciated guys! Oh, and I will put a BOUNTY of $50, if you can modify this and make it work like don.irwin's code. So if you post a solution, and it works... send me your paypal email, and you get $50. Maybe others can add to the bounty, if they find the solution saves them hours and headaches.

    Thanks
    A

    The solution need to be posted on this thread, to receive the bounty, this helps everyone else benefit from it.
    Last edited by usascholar; 06-13-2012 at 07:17 AM.

  2. #2
    Join Date
    Jan 2010
    Posts
    62

    Default

    No takers yet?

    I surely don't want to pay myself $50... and have a clean XML Package instead of a Frankenstein one.

    Ok, so far I am putting this piece of code into my simple product xml package, but I really want something cleaner, and done everywhere through the template.master:

    Code:
              <div>
    	          <!-- BEGIN: Google Trusted Store -->
    	  	  <script type="text/javascript">
    	  	  var gts = gts || [];
    	  	  
    	  	  gts.push(["id", "XXXX"]);
    	  	  gts.push(["google_base_offer_id", "<xsl:value-of select="aspdnsf:GetMLValue(ProductID)" disable-output-escaping="yes"/>"]);
    	  	  gts.push(["google_base_subaccount_id", "XXXXXXX"]);
    	  	  gts.push(["google_base_country", "US"]);
    	  	  gts.push(["google_base_language", "en"]);
    	  	  
    	  	  (function() {
    	  	  var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
    	  	  var gts = document.createElement("script");
    	  	  gts.type = "text/javascript";
    	  	  gts.async = true;
    	  	  gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
    	  	  var s = document.getElementsByTagName("script")[0];
    	  	  s.parentNode.insertBefore(gts, s);
    	  	  })();
    	  	  </script>
    	  	  <!-- END: Google Trusted Store -->
              </div>
    Now... trying to make the other code work.... hmmm..

    A

  3. #3
    Join Date
    Jan 2010
    Posts
    62

    Default

    Well....

    I tried the following code and it says
    Error in XmlPackage(.Load), Package=[rev.trustedstore.xml.config], Msg=[Exception='<', hexadecimal value 0x3C, is an invalid attribute character. Line 66, position 44.<br/>]

    Code:
    <?xml version="1.0" standalone="yes" ?>
    <package version="2.1" displayname="TrustedStore" debug="false" includeentityhelper="false">
      <query name="Order" rowElementName="OrderInfo">
        <sql>
          <![CDATA[
          select o.*, (case when o.AffiliateID = 0
    then 'None' else (select a.Name from dbo.Affiliate a  with (NOLOCK) where a.AffiliateID = o.AffiliateID) end) as AffiliateName From dbo.orders o with (NOLOCK)
    where o.ordernumber = @ordernum
           ]]>
        </sql>
        <queryparam paramname="@ordernum" paramtype="request" requestparamname="ordernumber" defvalue="0" sqlDataType="int" validationpattern="^\d{1,9}$"/>
      </query>
      <query name="OrderItems" rowElementName="Item">
        <sql>
          <![CDATA[
              SELECT  s.ShoppingCartRecID, 
                      s.OrderNumber, 
                      s.ProductID, 
                      s.VariantID, 
                      s.Quantity, 
                      s.ChosenColor, 
                      s.ChosenSize, 
                      s.OrderedProductName, 
                      s.OrderedProductVariantName, 
                      s.OrderedProductSKU, 
                      s.OrderedProductPrice, 
                      s.OrderedProductRegularPrice, 
                      s.OrderedProductSalePrice, 
                      s.OrderedProductExtendedPrice, 
                      s.OrderedProductQuantityDiscountName, 
                      s.OrderedProductQuantityDiscountID, 
                      s.OrderedProductQuantityDiscountPercent, 
                      s.IsShipSeparately, 
                      s.IsDownload, 
                      s.FreeShipping, 
                      s.TextOption, 
                      s.ShippingMethod, 
                      s.Notes, 
                      s.ExtensionData, 
                      s.CustomerEntersPrice, 
                      s.GiftRegistryForCustomerID, 
                      s.ShippingAddressID, 
                      s.ShippingDetail, 
                      s.SizeOptionPrompt, 
                      s.ColorOptionPrompt, 
                      s.TextOptionPrompt, 
                      s.IsTaxable, 
                      s.TaxClassID, 
                      s.TaxRate,
                      ISNULL(s.IsAKit, 0) AS IsAKit, 
                      ISNULL(s.IsAPack, 0) AS IsAPack, 
                      ISNULL(s.IsSystem, 0) AS IsSystem
              FROM dbo.Orders_ShoppingCart s WITH (NOLOCK) 
              WHERE s.ordernumber = @ordernum
              ORDER by s.ShippingAddressID
                ]]>
        </sql>
        <queryparam paramname="@ordernum" paramtype="request" requestparamname="ordernumber" defvalue="0" sqlDataType="int" validationpattern="^\d{1,9}$"/>
      </query>
    
      <PackageTransform>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
          <xsl:output method="html" omit-xml-declaration="yes"/>
          <xsl:variable name="OrderNumber" select="/root/Order/OrderInfo/OrderNumber" />
          <xsl:template match="/">
          <xsl:if test="/root/Runtime/PageName <> 'orderconfirmation.aspx'">
            <!-- BEGIN: Google Trusted Store -->
    		<script type="text/javascript">
    		  var gts = gts || [];
    		  gts.push(["id", "XXXX"]);
    		  gts.push(["google_base_offer_id", "<xsl:value-of select="aspdnsf:GetMLValue(ProductID)" disable-output-escaping="yes"/>"]);
      		  gts.push(["google_base_subaccount_id", "XXXXXXX"]);
      		  gts.push(["google_base_country", "US"]);
      		  gts.push(["google_base_language", "en"]);
      		  
      		    (function() {
    		    var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
    		    var gts = document.createElement("script");
    		    gts.type = "text/javascript";
    		    gts.async = true;
    		    gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
    		    var s = document.getElementsByTagName("script")[0];
    		    s.parentNode.insertBefore(gts, s);
    		  })();
            </script>
    		<!-- END: Google Trusted Store -->
         </xsl:if>
         <xsl:if test="/root/Runtime/PageName = 'orderconfirmation.aspx'">
            <!-- BEGIN: Google Trusted Store -->
    		<script type="text/javascript">
    		  var gts = gts || [];
    		  gts.push(["id", "9810"]);
    		  gts.push(["google_base_offer_id", "<xsl:value-of select="aspdnsf:GetMLValue(ProductID)" disable-output-escaping="yes"/>"]);
      		  gts.push(["google_base_subaccount_id", "1565646"]);
      		  gts.push(["google_base_country", "US"]);
      		  gts.push(["google_base_language", "en"]);
      		  
      		    (function() {
    		    var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
    		    var gts = document.createElement("script");
    		    gts.type = "text/javascript";
    		    gts.async = true;
    		    gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
    		    var s = document.getElementsByTagName("script")[0];
    		    s.parentNode.insertBefore(gts, s);
    		  })();
            </script>
    		<!-- END: Google Trusted Store -->
      		<!-- START Trusted Stores Order -->
    		<div id="gts-order" style="display:none;">
    		
    		  <!-- start order and merchant information -->
    		  <span id="gts-o-id"><xsl:value-of select="$OrderNumber" /></span>
    		  <span id="gts-o-domain">www.revgenetics.com</span>
    		  <span id="gts-o-email"><xsl:value-of select="/root/Order/OrderInfo/Email" /></span>
    		  <span id="gts-o-country"><xsl:value-of select="/root/Order/OrderInfo/BillingCountry" /></span>
    		  <span id="gts-o-currency">USD</span>
    		  <span id="gts-o-total"><xsl:value-of select="format-number(/root/Order/OrderInfo/OrderTotal, '0.00')" /></span>
    		  <span id="gts-o-discounts">0.00</span>
    		  <span id="gts-o-shipping-total"><xsl:value-of select="format-number(/root/Order/OrderInfo/OrderShippingCosts, '0.00')" /></span>
    		  <span id="gts-o-tax-total"><xsl:value-of select="format-number(/root/Order/OrderInfo/OrderTax, '0.00')" /></span>
    		  <script type="text/javascript">
    		  	var d1=new Date();
    		  	dl.setDate(dl.getDate() + 7);
    		  	document.write("<span id="gts-o-est-ship-date">"+d1.toString('yyyy-MM-dd')+"</span>");
    		  //<span id="gts-o-est-ship-date">d1.toString('yyyy-MM-dd');</span>
              </script>
    		  <span id="gts-o-has-preorder">N</span>
    		  <span id="gts-o-has-digital">N</span>
    		  <!-- end order and merchant information -->
    		  
                <xsl:apply-templates select="/root/OrderItems/Item" />
              </xsl:if>
          </xsl:template>
    
          <xsl:template match="Item">
     		<xsl:if test="/root/Runtime/PageName = 'orderconfirmation.aspx'">
     		
     		<span class="gts-item">
    		    <span class="gts-i-name"><xsl:value-of select="OrderedProductName" /></span>
    		    <span class="gts-i-price"><xsl:value-of select="OrderedProductPrice" /></span>
    		    <span class="gts-i-quantity"><xsl:value-of select="Quantity" /></span>
    		    <span class="gts-i-prodsearch-id"><xsl:value-of select="ProductID" /></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>
    		 </span>
    		          
              </xsl:if>
          </xsl:template>
        </xsl:stylesheet>
      </PackageTransform>
    </package>

    Any hints?

    A

  4. #4
    Join Date
    Dec 2008
    Location
    Phoenix, AZ
    Posts
    367

    Default

    Hmm, it sounds like you are outputting some invalid character into the XML somewhere. What is line 66 referring to?
    Jan Simacek - Compunix, LLC
    AspDotNetStorefront Platinum Devnet Partner since 2005

    AspDotNetStorefront Mods and Add-Ons at http://www.ecommercecartmods.com/
    - Searching, Filtering and Sorting (like cSearch, Dealer Locator, Price Ranges, Blog)
    - Reports (like Cart Abandonment and Net Sales)
    - Customer Experience (like Question/Answers)
    - Site and Data Management (like Entity Product Mapper, Bulk Updaters, Make/Model/Year filters)

  5. #5
    Join Date
    Mar 2009
    Posts
    78

    Default another plausible method

    less on xsl and more on registered dll. I got this working on MultiStore 9.2.0.0 and it allows for logic to be embedded in an external dll with little hooks in ADNSF.

    http://forums.aspdotnetstorefront.co...9130#post29130

    Just another way to potentially get to the finish line...

    Still, I know AspDotNetStorefront is working on a solution to this issue. They will help us on this soon, I am sure.

    - Charlie

  6. #6
    Join Date
    Jan 2010
    Posts
    62

    Default

    Well,

    it appears no one really tried to help, I am a bit disappointed since the XDA forums (Google Android Forums) are teaming with folks trying to help each other out for free and for bountys.

    At this time I am retracting my $50 bounty, as my implementation is working.

    I have fixed and reworked my concept code, and have named my XML Package: rev.trustedstore.xml.config package

    It seems to work fine. Except on the product pages, where I have the other code above. I personally don't like it in two places at once... but it is working, and I learned a little XSLT in the process.

    My order confirmation page shows the "google trusted store" code nicely, and now I just need to wait for my 1000 transactions...and confirmation from google that the code has been implemented correctly on the ADNSF site.

    After Google get's back to me (and says it ok) I may release it here.

    Cheers
    A

  7. #7
    Join Date
    Jan 2010
    Posts
    62

    Default

    Looks like Google checked the store...and I need to make some changes to my SSIS code on my SQL Server for the Cancel and shipping feeds.
    (I love rackspace hosting, they have all the SQL toys)

    They now seem to be working just fine, and are scheduled nightly.

    Let's see what Google says after the latest change.

    Cheers

  8. #8
    Join Date
    Jan 2010
    Posts
    62

    Default


    Wow I finally got to this point with Google. They just emailed me nice email below... wish me luck with my XMLPackage!:


    "Your account is now in the monitoring and data validation phase of the application process. We'll review your business's eligibility for the program for a minimum of 28 days and at least 250 trackable orders. The Google Trusted Store badge will not be visible on your site while we verify your store's qualifications for the program. During this time, we may offer customers who purchase from your site the option to opt in to a survey about their order experience with your store.

    If your store qualifies to become a Google Trusted Store, we will contact you to confirm when the badge will show up on your site.

    If you believe you have an incorrect or incomplete integration with the program, please correct this as soon as possible, as any integration errors will lead to a delay in our ability to qualify your store."

  9. #9
    Join Date
    Feb 2009
    Posts
    683

    Default

    usascholar,

    From someone who has went through this and can see the light at the end of the tunnel, can I get a summary overview.

    1. The JS needs implemented on all pages?
    2. The confirmation pages gets the JS, but also gets a bunch of html with all the products the customer ordered?
    3. A daily feed needs uploaded to google with shipping and cancellation info?

    Once those three are done, you are then in a review phase?

    For the JS on product pages, what product id are you using? Product detail pages would be easy, but on a page with multiple products which one is "prominent"?

    Does that about sum it up?

  10. #10
    Join Date
    Jan 2010
    Posts
    62

    Default

    Hi,

    For Google Trust Stores:

    1- The code they provide is supposed to be on all pages, even on non product pages, kind of like analytics code. My solution was to use an XMLPackage, and some code I added to product pages XMLPackage. The confirmation page would have the total of items purchased, much like Irwin's code for analytics.

    2- Two daily feeds need to be uploaded to google. (you can schedule an FTP upload in googles "Merchant Center" or provide them a link to a file that is updated daily). The easiest is probably a delimited file you generate daily on your server, and then give google access to. Shipping and Cancellation feeds. In my case I have a SQL query that is exported to a text file by an SSIS package nightly. I have given Google access to these, and they pick them up a couple hours after my files get generated. I am sure you can do an XML webservice and provide Google a url, but I prefer my SSIS tools. (although you can probably schedule and use SQL Scripter if you dont have SSIS "http://www.sqlscripter.com/", this is a ridiculous simple and powerful tool if you have ever done any SQL). I know of multi-billion dollar companies who use it on a daily basis. (I know, I used to work at one of them)

    3- Product ID: is the same one you use when providing a feed to google base. I usually provide the "Default" variant product id on a product page. This code is separate code I entered in my "simpleproduct" xmlpackage that displays products.

    4- After it looks good, tell google that you are ready to be reviewed.

    It takes 1-3 weeks before you get an email back. I think they are overloaded with requests.

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •