News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Google Reviews Code

Started by Jack Stiles, December 10, 2018, 19:11:00 PM

Previous topic - Next topic

Jack Stiles

Hey guys!!! I have one more dumb question here  :D Bad thing is - I havent found pretty much anything on internet about this so I think it would be great for other users to have some final answer here.  :) So I am trying to add google opt-in code for reviews to order-done.php.

Here is my 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(
        {
          "merchant_id": 55555555,
          "order_id": "Webits Order",
          "email": "<?php echo $_POST["email"]; ?>",
          "delivery_country": "CZ",
          "estimated_delivery_date": "<?php echo date("Y-m-d"strtotime(date() . " + 1 day")); ?>",
          "opt_in_style": "OPT_IN_STYLE"
        });
     });
  }
</script>
<!-- END GCR Opt-in Module Code -->

<!-- BEGIN GCR Language Code -->
<script>
  window.___gcfg = {
    lang: 'cs_CZ'
  };
</script>
<!-- END GCR Language Code -->


Used the one from this thread:

https://forum.virtuemart.net/index.php?topic=138050.msg483961#msg483961

And when I try to order my console says: Error: email cannot be empty!

Do we have a solution here? I don't know the proper way to echo an email of completed order  :(

Please help with it guys I think it would be usefull for a whole lot of other guys here.

Have a great day!

Jack Stiles

Ehhh...not sure if I am in the right thread though :-(

Jack Stiles

I give up.... :-( Just tried pretty much everything and I simply cant get it to call shopper email on order-done page.. :-( Help please if you guys know...

GJC Web Design

you have to see what is returned by either the  $this->html object  - echo it out

or if your shop only allows registered users and you assume they are still logged in when u get back to orderdone then just use the standard

$cuser = JFactory::getUser();
$useremail = $cuser->get('email');
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Jack Stiles

Uff OK will try that :-) What I did so far was I looked at the devtools -> network and I discovered that on the page it is loading "bypv_billing_address_email" and there was my test email adress next to it. I realized then that I am using One Page Checkout extension from bypv.org... So it looks like the order-done page remembers the data passed by from the One Page Checkout... So I will try to call it and let you know how it went ;-)

GJC - you rock btw! Wondering if there is a way I could repay you somehow  :)