Originally posted by Bruce - PhosphorMedia
View Post
Announcement
Collapse
No announcement yet.
Estimated Delivery Date for Google Reviews
Collapse
X
-
Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
-
check g.Merchant_Local_Timezone? Or just set it '8' (I mean, its not like we are creating a 'real' time/date) :)Bruce Golub
Phosphor Media - "Your Success is our Business"
Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
phosphormedia.com
Comment
-
Final notes on this. I pulled an <mvt:doh> moment</mvt:doh>. The INVC page for the site I'm implementing this code for has a <mvt:else> right in the middle of all the code. Seems I was tweaking the code in one half but not updating it in the other half. Once I updated the second section (after the <mvt:else>) everything was firing as expected. Here's the final code used (edited to protect the innocent):
Code:<!-- Start of Google Reviews --> <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 FIELDS "merchant_id": XXXXXXX, "order_id": "&mvt:order:id;", "email": "&mvt:order:bill_email;", "delivery_country": "US", // DATE <!-- assign est_arrival_ts as date + 7 days--> <mvt:assign name="l.settings:order:est_arrival_ts" value="l.settings:order:orderdate + (60 * 60 * 24 * 7)" /> <!-- calculate the arrival year, month, day using est_arrival_date, here you were calculating based on original order date--> <mvt:assign name="l.settings:order:est_arrival_year" value="time_t_year( l.settings:order:est_arrival_ts ,g.Merchant_Local_Timezone)" /> <mvt:assign name="l.settings:order:est_arrival_month" value="padl(time_t_month( l.settings:order:est_arrival_ts ,g.Merchant_Local_Timezone), 2, 0)" /> <mvt:assign name="l.settings:order:est_arrival_day" value="padl(time_t_dayofmonth( l.settings:order:est_arrival_ts ,g.Merchant_Local_Timezone), 2, 0)" /> // PRINT DATE <!-- print new data, using new variables --> "estimated_delivery_date": "&mvt:order:est_arrival_year;-&mvt:order:est_arrival_month;-&mvt:order:est_arrival_day;", // OPTIONAL FIELDS "products": [ <mvt:foreach iterator="item" array="order:items"> {"gtin":"&mvte:item:code;"}, </mvt:foreach> ] }); }); } </script> <!-- End of Google Reviews -->
Everything is firing and the estimated delivery date is 7 days from the order date.
Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
Comment
-
One more follow up - the popup still wasn't display so I research the troubleshooting. Another critical tidbit was missing form the basic code provided by Google - the opt in style for the popup:
Code:"opt_in_style": "CENTER_DIALOG",
Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
Comment
-
Originally posted by lesliekirk View PostFinal notes on this. I pulled an <mvt:doh> moment</mvt:doh>. The INVC page for the site I'm implementing this code for has a <mvt:else> right in the middle of all the code. Seems I was tweaking the code in one half but not updating it in the other half. Once I updated the second section (after the <mvt:else>) everything was firing as expected. Here's the final code used (edited to protect the innocent):
Everything is firing and the estimated delivery date is 7 days from the order date.
Thank you Leslie, this was so helpful! I've struggled to get this to work and your code was 100% perfect.
Comment
Comment