Announcement

Collapse
No announcement yet.

Estimated Delivery Date for Google Reviews

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by Bruce - PhosphorMedia View Post
    Oh, and yea...if you need to test things against the various Order arrays, the easiest way is to use a Template Email as those are the same arrays used on the INVC screen and can just be rerun from an order in the Admin.
    Oh yea, I had already asked that question. I think that's going to be the way I need to test because it works fine on my test page, but doesn't even behave the same on the INVC. The comments can be seen in the HTML on the test page, but not all of the comments show up on the INVC screen.
    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


      #17
      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


        #18
        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


          #19
          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",
          LOL, I love troubleshoooting outloud.

          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


            #20
            My site does not have the value for estimated Delivery date. Can I use Order date as Estimated Delivery date?

            Comment


              #21
              Originally posted by lesliekirk View Post
              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):




              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.
              Dylan Buchfink
              The Mattress & Sleep Company
              http://www.tmasc.ca/

              Comment

              Working...
              X