Google Customer Reviews - Accessing Unset Variables on Success.php
Posted: Mon Oct 09, 2017 11:02 pm
Hello,
I'm trying to add Google Customer Reviews to our web shop.
It's quite simple in that you just add the following script to the end of your success.php page.
However, I'm having problems accessing the Order ID, Customer Email and Country ID variables as they're all unset at this point.
I've looked at a few other similar posts and they've suggested making changes to the base success.php code but I'm trying to make this a VQMOD that is added to the end of the success.php page. I know there are paid extensions out there, but I don't want to pay $49.99 just to capture 4 variables.
Any help would be gratefully received. I did consider setting these to session variables from the checkout.php page and then unsetting them on success.php but this seems a messy solution.
I'm trying to add Google Customer Reviews to our web shop.
It's quite simple in that you just add the following script to the end of your success.php page.
Code: Select all
<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": MERCHANT ID,
"order_id": "ORDER ID",
"email": "CUSTOMER EMAILS",
"delivery_country": "COUNTRY ID",
"estimated_delivery_date": "ESTIMATED DELIVERY DATE"
});
});
}
</script>
I've looked at a few other similar posts and they've suggested making changes to the base success.php code but I'm trying to make this a VQMOD that is added to the end of the success.php page. I know there are paid extensions out there, but I don't want to pay $49.99 just to capture 4 variables.
Any help would be gratefully received. I did consider setting these to session variables from the checkout.php page and then unsetting them on success.php but this seems a messy solution.