Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2011
    Posts
    507
    Plugin Contributions
    0

    Default Google Seller Rating Integration to One Page Checkout

    Hello everyone,

    I am looking for into integrating Google Seller Rating to my site.

    It is using ZC 1.5.7 with latest OPC and Boostrap templates.

    As per google,i need to addthefollowing code to my order confirmation page:

    Code:
    <!-- BEGIN GCR Opt-in Module Code -->
    
    <script src="https://apis.google.com/js/platform.js?onload=renderOptIn"
    
    async defer>
    
    </script>
    
    <script>
    
    window.renderOptIn = function() {
    
    window.gapi.load('surveyoptin', function() {
    
    window.gapi.surveyoptin.render(
    
    {
    
    // REQUIRED
    
    "merchant_id": "MERCHANT_ID",
    
    "order_id": "ORDER_ID",
    
    "email": "CUSTOMER_EMAIL",
    
    "delivery_country": "COUNTRY_CODE",
    
    "estimated_delivery_date": "YYYY-MM-DD",
    
    // OPTIONAL
    
    "products":[{"gtin":"GTIN1"}, {"gtin":"GTIN2">}],
    
    "opt_in_style": "OPT_IN_STYLE"
    
    });
    
    });
    
    }
    
    </script>
    
    <!-- END GCR Opt-in Module Code -->
    However, I am not sure /confused at to which files I am supposed to add it and where in the file.

    Anyone ever successfully integrated Seller Rating to their site?

    Any help would be appreciated.

    Thank you

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,363
    Plugin Contributions
    94

    Default Re: Google Seller Rating Integration to One Page Checkout

    Your best approach is to create a file (say jscript_gsr_optin.php) in /includes/modules/pages/checkout_success. That newly-added file should look similar to

    Code:
    <?php
    if (empty($order_summary)) {
        return;
    }
    ?>
    <!-- BEGIN GCR Opt-in Module Code -->
    
    <script src="https://apis.google.com/js/platform.js?onload=renderOptIn"
    
    async defer>
    
    </script>
    
    <script>
    
    window.renderOptIn = function() {
    
    window.gapi.load('surveyoptin', function() {
    
    window.gapi.surveyoptin.render(
    
    {
    
    // REQUIRED
    
    "merchant_id": "MERCHANT_ID",  //- Your Merchant ID value
    
    "order_id": "<?php echo $order->info['order_id']; ?>",
    
    "email": "<?php echo $order->customer['email_address']; ?>",
    
    "delivery_country": "<?php echo (!empty($order->delivery['country']['iso_code_2']) ? $order->delivery['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; ?>",
    
    "estimated_delivery_date": "YYYY-MM-DD",  //- The purchase date/time is present in $order->info['date_purchased']

  3. #3
    Join Date
    Apr 2011
    Posts
    507
    Plugin Contributions
    0

    Default Re: Google Seller Rating Integration to One Page Checkout

    Quote Originally Posted by lat9 View Post
    Your best approach is to create a file (say jscript_gsr_optin.php) in /includes/modules/pages/checkout_success. That newly-added file should look similar to

    Code:
    <?php
    if (empty($order_summary)) {
        return;
    }
    ?>
    <!-- BEGIN GCR Opt-in Module Code -->
    
    <script src="https://apis.google.com/js/platform.js?onload=renderOptIn"
    
    async defer>
    
    </script>
    
    <script>
    
    window.renderOptIn = function() {
    
    window.gapi.load('surveyoptin', function() {
    
    window.gapi.surveyoptin.render(
    
    {
    
    // REQUIRED
    
    "merchant_id": "MERCHANT_ID",  //- Your Merchant ID value
    
    "order_id": "<?php echo $order->info['order_id']; ?>",
    
    "email": "<?php echo $order->customer['email_address']; ?>",
    
    "delivery_country": "<?php echo (!empty($order->delivery['country']['iso_code_2']) ? $order->delivery['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; ?>",
    
    "estimated_delivery_date": "YYYY-MM-DD",  //- The purchase date/time is present in $order->info['date_purchased']
    Thank you lat9 for the reply. I really appreciate the help and guidance on this.

    I created the file named jscript_gsr_optin.php in uploaded it to includes/modules/pages/checkout_success.

    i have the following code in the file:

    Code:
    <!-- BEGIN GCR Opt-in Module Code -->
    
    <script src="https://apis.google.com/js/platform.js?onload=renderOptIn"
    
    async defer>
    
    </script>
    
    <script>
    
    window.renderOptIn = function() {
    
    window.gapi.load('surveyoptin', function() {
    
    window.gapi.surveyoptin.render(
    
    {
    
    // REQUIRED
    
    "merchant_id": "9****3",  //- Your Merchant ID value
    
    "order_id": "<?php echo $order->info['order_id']; ?>",
    
    "email": "<?php echo $order->customer['email_address']; ?>",
    
    "delivery_country": "<?php echo (!empty($order->delivery['country']['iso_code_2']) ? $order->delivery['country']['iso_code_2'] : $order->billing['country']['iso_code_2']; ?>",
    
    "estimated_delivery_date": "YYYY-MM-DD",  //- The purchase date/time is present in $order->info['date_purchased']
    
    // OPTIONAL
    
    "products":[{"gtin":"GTIN1"}, {"gtin":"GTIN2">}],
    
    "opt_in_style": "OPT_IN_STYLE"
    
    });
    
    });
    
    }
    
    </script>
    
    <!-- END GCR Opt-in Module Code -->
    However, when i attempt to checkout , i am getting a blank page for /index.php?main_page=checkout_success and the following error is logged in:

    Code:
    [16-Jan-2023 19:10:35 America/Los_Angeles] PHP Parse error: syntax error, unexpected ';' in D:\xampp\htdocs\royal-fleur\includes\modules\pages\checkout_success\jscript_gsr_optin.php on line 27
    
    [16-Jan-2023 19:10:35 America/Los_Angeles] Request URI: /royal-fleur/index.php?main_page=checkout_success, IP address: ::1
    --> PHP Parse error: syntax error, unexpected ';' in D:\xampp\htdocs\royal-fleur\includes\modules\pages\checkout_success\jscript_gsr_optin.php on line 27.
    Any help on fixing this please?

    Thank you again for your assistance

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,291
    Plugin Contributions
    125

    Default Re: Google Seller Rating Integration to One Page Checkout

    Change line 27 to

    Code:
    "delivery_country": "<?php echo (!empty($order->delivery['country']['iso_code_2']) ? $order->delivery['country']['iso_code_2'] : $order->billing['country']['iso_code_2']); ?>",
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Apr 2011
    Posts
    507
    Plugin Contributions
    0

    Default Re: Google Seller Rating Integration to One Page Checkout

    Quote Originally Posted by swguy View Post
    Change line 27 to

    Code:
    "delivery_country": "<?php echo (!empty($order->delivery['country']['iso_code_2']) ? $order->delivery['country']['iso_code_2'] : $order->billing['country']['iso_code_2']); ?>",
    Thank you swguy,

    I made the changes to line 27 but i am still getting another error.

    The error is :

    Code:
    [17-Jan-2023 19:32:00 America/Los_Angeles] Request URI: /royal-fleur/index.php?main_page=checkout_success, IP address: ::1
    #1 require(D:\xampp\htdocs\royal-fleur\includes\modules\pages\checkout_success\jscript_gsr_optin.php) called at [D:\xampp\htdocs\royal-fleur\includes\templates\bootstrap\common\html_header.php:201]
    #2 require(D:\xampp\htdocs\royal-fleur\includes\templates\bootstrap\common\html_header.php) called at [D:\xampp\htdocs\royal-fleur\index.php:43]
    --> PHP Warning: Illegal string offset 'iso_code_2' in D:\xampp\htdocs\royal-fleur\includes\modules\pages\checkout_success\jscript_gsr_optin.php on line 27.
    The Checkout process goes thru and i am getting the order confirmation page.

    However, I am not getting any popup from Google regarding the opt-in survey or anything. Is this normal? Any experience with it?

    Thank you for your help

  6. #6
    Join Date
    Apr 2011
    Posts
    507
    Plugin Contributions
    0

    Default Re: Google Seller Rating Integration to One Page Checkout

    I got it to "work" somehow by doing this to fix my error since we only ship to the US anyway.

    Code:
    "delivery_country": "US",
    I am having issue with the delivery date though.

    I got the plugin to work specifying today date ( i.e. "estimated_delivery_date": "2023-01-18")

    what do i need to do so the date rendered is the purchase date?

    Thank you for your help

  7. #7
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,616
    Plugin Contributions
    19

    Default Re: Google Seller Rating Integration to One Page Checkout

    Quote Originally Posted by nicksab View Post
    I got the plugin to work specifying today date ( i.e. "estimated_delivery_date": "2023-01-18")

    what do i need to do so the date rendered is the purchase date?

    Thank you for your help
    Are you sure you want the delivery date to be the same as purchase date? Isn't there any lead time or shipping time?

    If you want it to be the same as purchase date:
    Code:
    "estimated_delivery_date": "<?php echo date('Y-m-d',strtotime($order->info['date_purchased'])); ?>",
    If you want to add some time:
    Code:
    "estimated_delivery_date": "<?php echo date('Y-m-d',strtotime("+1 day", $order->info['date_purchased'])); ?>",
    Change the number in red to whatever you need.

  8. #8
    Join Date
    Apr 2011
    Posts
    507
    Plugin Contributions
    0

    Default Re: Google Seller Rating Integration to One Page Checkout

    Quote Originally Posted by balihr View Post
    Are you sure you want the delivery date to be the same as purchase date? Isn't there any lead time or shipping time?

    If you want it to be the same as purchase date:
    Code:
    "estimated_delivery_date": "<?php echo date('Y-m-d',strtotime($order->info['date_purchased'])); ?>",
    If you want to add some time:
    Code:
    "estimated_delivery_date": "<?php echo date('Y-m-d',strtotime("+1 day", $order->info['date_purchased'])); ?>",
    Change the number in red to whatever you need.
    Thank you balihr.

    That s definitely a great point. We do offer same day delivery but obviously this date can vary greatly.

    Customer can pick the delivery date via a datepicker in product attribute. The site is at royal-fleurdotcom if needed.

    Looks like option #2 would be a perfect fit however I am getting an error in developer console.

    error is as follow "Error: Invalid estimated_delivery_date. Make sure the date format is YYYY-MM-DD" and no pop up from google survey.

    I tried option #1 as an alternative and it worked without any issue.

    I would prefer #2 if possible but it seems google api doesn't like the"+1 day" part.

    Any suggestions?

    Thank you for your help

  9. #9
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,616
    Plugin Contributions
    19

    Default Re: Google Seller Rating Integration to One Page Checkout

    Quote Originally Posted by nicksab View Post
    I would prefer #2 if possible but it seems google api doesn't like the"+1 day" part.

    Any suggestions?
    Sorry, blonde moment... The code should be:
    Code:
    "estimated_delivery_date": "<?php echo date('Y-m-d',strtotime("+1 day", strtotime($order->info['date_purchased']))); ?>",

  10. #10
    Join Date
    Apr 2011
    Posts
    507
    Plugin Contributions
    0

    Default Re: Google Seller Rating Integration to One Page Checkout

    Quote Originally Posted by balihr View Post
    Sorry, blonde moment... The code should be:
    Code:
    "estimated_delivery_date": "<?php echo date('Y-m-d',strtotime("+1 day", strtotime($order->info['date_purchased']))); ?>",
    Thank you very much balihr. It worked like charm

 

 

Similar Threads

  1. Google checkout integration, so near yet so far!!
    By tergwin in forum Addon Payment Modules
    Replies: 5
    Last Post: 7 Sep 2010, 12:41 AM
  2. Google Checkout Integration Error Message
    By jinglezdj in forum Addon Payment Modules
    Replies: 2
    Last Post: 30 Jun 2010, 03:37 PM
  3. Is there a Single Page Checkout option? and Ajax Rating feature?
    By dsdeiz in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 5 May 2009, 10:06 AM
  4. Google Checkout Level 1 Integration
    By FireCat in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 10 Feb 2007, 02:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR