
Originally Posted by
lat9
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
Bookmarks