[Skip to main content](#vessel-content)

#   Implementing google opt-in reviews To checkout

##

- **[jasmine247](/forum/user/61515-jasmine247 "View jasmine247's Profile")**
- [![jasmine247's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/61515-jasmine247 "View jasmine247's Profile") Topic Author
- [ Offline](/forum/user/61515-jasmine247)

Less More

- Posts: 42
- Thank you received: 4
-
-

5 years 4 months ago [\#334165](#334165) by [jasmine247](/forum/user/61515-jasmine247 "View jasmine247's Profile")  *[Implementing google opt-in reviews To checkout](/forum/27-checkout/902912-implementing-google-opt-in-reviews-to-checkout#334165 "-- url of the page with the problem -- :   sewingmachinesuk.uk/  -- HikaShop version -- : 4.4.2 -- Joomla version -- : 3.9.27 -- PHP version -- : 7.2.34  Hi again,  I'm trying currently to implement the opt in reviews to the checkout and am having a bit on an issue.  I'm not a coder and therefore it could be anything.  I was going off of one of your previous forum topics on the same thing, however what was missing was how the code itself was placed into the view/checkout/end.php its self. I don't know anything about syntax and could use some help.  I have tried just doing it myself and have ended up breaking the end screen so that it displayed nothing. I have also tried searching a lot, but there's not a lot written on it surprisingly.  This is the snippit that I have pieced together with help from the google page explaining the whole thing, and also your old form topic. I just need to know where to paste it in basically.  I'm using the default checkout/end.php  The google help page also talks about DOCTYPE which I'm not sure if I need to worry about.  Here is the page for ref   support.google.com/merchants/answer/7106244  Any help would be amazing, cheers")* was created by *[jasmine247](/forum/user/61515-jasmine247 "View jasmine247's Profile")*

-- url of the page with the problem -- : [ sewingmachinesuk.uk/](https://sewingmachinesuk.uk/)
-- HikaShop version -- : 4.4.2
-- Joomla version -- : 3.9.27
-- PHP version -- : 7.2.34

Hi again,

I'm trying currently to implement the opt in reviews to the checkout and am having a bit on an issue.

I'm not a coder and therefore it could be anything.

I was going off of one of your previous forum topics on the same thing, however what was missing was how the code itself was placed into the view/checkout/end.php its self. I don't know anything about syntax and could use some help.

I have tried just doing it myself and have ended up breaking the end screen so that it displayed nothing. I have also tried searching a lot, but there's not a lot written on it surprisingly.
Code:

&lt;!-- BEGIN GCR Opt-in Module Code --&gt; &lt;script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer&gt; &lt;/script&gt; &lt;script&gt; window.renderOptIn = function() { window.gapi.load('surveyoptin', function() { window.gapi.surveyoptin.render( { "merchant_id": 428958528, "order_id": "&lt;?php echo $this-&gt;order-&gt;order_number; ?&gt;", "email": "&lt;?php echo $this-&gt;order-&gt;customer-&gt;user_email; ?&gt;", "delivery_country": "&lt;?php echo $this-&gt;order-&gt;shipping_address-&gt;address_country_code_2; ?&gt;", "estimated_delivery_date": "&lt;?php echo hikashop_getDate($this-&gt;order-&gt;order_created,'Y-m-d'); ?&gt;", "opt_in_style": "CENTER_DIALOG" }); }); } &lt;/script&gt; &lt;!-- END GCR Opt-in Module Code --&gt; &lt;!-- BEGIN GCR Language Code --&gt; &lt;script&gt; window.___gcfg = { lang: 'en-US' }; &lt;/script&gt; &lt;!-- END GCR Language Code --&gt;

This is the snippit that I have pieced together with help from the google page explaining the whole thing, and also your old form topic.
I just need to know where to paste it in basically.

I'm using the default checkout/end.php
Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 4.4.2 * @author hikashop.com * @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;?php if(empty($this-&gt;html)) { echo JText::_('THANK_YOU_FOR_PURCHASE'); if(!empty($this-&gt;url)) echo '&lt;br/&gt;'.JText::sprintf('YOU_CAN_NOW_ACCESS_YOUR_ORDER_HERE', $this-&gt;url); } else { echo $this-&gt;html; } $this-&gt;nextButton = false;

The google help page also talks about DOCTYPE which I'm not sure if I need to worry about.

Here is the page for ref
[ support.google.com/merchants/answer/7106244](https://support.google.com/merchants/answer/7106244)

Any help would be amazing,
cheers

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkwMjkxMi1pbXBsZW1lbnRpbmctZ29vZ2xlLW9wdC1pbi1yZXZpZXdzLXRvLWNoZWNrb3V0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14327
-
-

5 years 4 months ago [\#334173](#334173) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Implementing google opt-in reviews To checkout](/forum/27-checkout/902912-implementing-google-opt-in-reviews-to-checkout#334173 "-- url of the page with the problem -- :   sewingmachinesuk.uk/  -- HikaShop version -- : 4.4.2 -- Joomla version -- : 3.9.27 -- PHP version -- : 7.2.34  Hi again,  I'm trying currently to implement the opt in reviews to the checkout and am having a bit on an issue.  I'm not a coder and therefore it could be anything.  I was going off of one of your previous forum topics on the same thing, however what was missing was how the code itself was placed into the view/checkout/end.php its self. I don't know anything about syntax and could use some help.  I have tried just doing it myself and have ended up breaking the end screen so that it displayed nothing. I have also tried searching a lot, but there's not a lot written on it surprisingly.  This is the snippit that I have pieced together with help from the google page explaining the whole thing, and also your old form topic. I just need to know where to paste it in basically.  I'm using the default checkout/end.php  The google help page also talks about DOCTYPE which I'm not sure if I need to worry about.  Here is the page for ref   support.google.com/merchants/answer/7106244  Any help would be amazing, cheers")*

Hi,

I don't see a problem with your snippet of code. It looks great !

From what I can read on your link, your code needs to be placed after the payment.
It depends on which payment method you're using. In most cases though, you'll want to place it in the "after_end"file of the checkout view, not the "end" one which is displaying the hidden redirection form to the payment gateway, before the payment is done.

Regarding where to place it:
PHP code always starts with &lt;?php and ends with ?&gt;
So either you could add your code right at the beginning of the view file, before the first &lt;?php
Or if you want to add it at the end, you first need to add ?&gt; to end the PHP code already in the view.

Also, if you have a blank page because you made a mistake in the view file, you can:
- activate the "error reporting" and "debug" settings of the Joomla configuration and access the page with the error again. You should see an error message, telling you what is wrong where.
- you can remove the customization with the corresponding button on the view files listing to go back to the default display , and possibly try again to add your code differently.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkwMjkxMi1pbXBsZW1lbnRpbmctZ29vZ2xlLW9wdC1pbi1yZXZpZXdzLXRvLWNoZWNrb3V0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jasmine247](/forum/user/61515-jasmine247 "View jasmine247's Profile")**
- [![jasmine247's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/61515-jasmine247 "View jasmine247's Profile") Topic Author
- [ Offline](/forum/user/61515-jasmine247)

Less More

- Posts: 42
- Thank you received: 4
-
-

5 years 4 months ago [\#334281](#334281) by [jasmine247](/forum/user/61515-jasmine247 "View jasmine247's Profile")  Replied by *[jasmine247](/forum/user/61515-jasmine247 "View jasmine247's Profile")* on topic *[Implementing google opt-in reviews To checkout](/forum/27-checkout/902912-implementing-google-opt-in-reviews-to-checkout#334281 "-- url of the page with the problem -- :   sewingmachinesuk.uk/  -- HikaShop version -- : 4.4.2 -- Joomla version -- : 3.9.27 -- PHP version -- : 7.2.34  Hi again,  I'm trying currently to implement the opt in reviews to the checkout and am having a bit on an issue.  I'm not a coder and therefore it could be anything.  I was going off of one of your previous forum topics on the same thing, however what was missing was how the code itself was placed into the view/checkout/end.php its self. I don't know anything about syntax and could use some help.  I have tried just doing it myself and have ended up breaking the end screen so that it displayed nothing. I have also tried searching a lot, but there's not a lot written on it surprisingly.  This is the snippit that I have pieced together with help from the google page explaining the whole thing, and also your old form topic. I just need to know where to paste it in basically.  I'm using the default checkout/end.php  The google help page also talks about DOCTYPE which I'm not sure if I need to worry about.  Here is the page for ref   support.google.com/merchants/answer/7106244  Any help would be amazing, cheers")*

Thank you!

I'll give this a go soon and let you know how it goes!

Thanks for the pointers.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkwMjkxMi1pbXBsZW1lbnRpbmctZ29vZ2xlLW9wdC1pbi1yZXZpZXdzLXRvLWNoZWNrb3V0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jasmine247](/forum/user/61515-jasmine247 "View jasmine247's Profile")**
- [![jasmine247's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/61515-jasmine247 "View jasmine247's Profile") Topic Author
- [ Offline](/forum/user/61515-jasmine247)

Less More

- Posts: 42
- Thank you received: 4
-
-

5 years 4 months ago [\#334553](#334553) by [jasmine247](/forum/user/61515-jasmine247 "View jasmine247's Profile")  Replied by *[jasmine247](/forum/user/61515-jasmine247 "View jasmine247's Profile")* on topic *[Implementing google opt-in reviews To checkout](/forum/27-checkout/902912-implementing-google-opt-in-reviews-to-checkout#334553 "-- url of the page with the problem -- :   sewingmachinesuk.uk/  -- HikaShop version -- : 4.4.2 -- Joomla version -- : 3.9.27 -- PHP version -- : 7.2.34  Hi again,  I'm trying currently to implement the opt in reviews to the checkout and am having a bit on an issue.  I'm not a coder and therefore it could be anything.  I was going off of one of your previous forum topics on the same thing, however what was missing was how the code itself was placed into the view/checkout/end.php its self. I don't know anything about syntax and could use some help.  I have tried just doing it myself and have ended up breaking the end screen so that it displayed nothing. I have also tried searching a lot, but there's not a lot written on it surprisingly.  This is the snippit that I have pieced together with help from the google page explaining the whole thing, and also your old form topic. I just need to know where to paste it in basically.  I'm using the default checkout/end.php  The google help page also talks about DOCTYPE which I'm not sure if I need to worry about.  Here is the page for ref   support.google.com/merchants/answer/7106244  Any help would be amazing, cheers")*

Hey! I Finally got around to implementing this code and am having just one error occur on the page, it just states:

"Error: delivery_country cannot be empty!"

As you an see in this screenshot.

[ ![deliverycountry.JPG](/forum/attachment/53268) ](/forum/attachment/53268 "...erycountry.JPG")

This is the line I'm using to draw the country
Code:

"delivery_country": "&lt;?php echo $this-&gt;order-&gt;shipping_address-&gt;address_country_code_2; ?&gt;",

I'm just wondering if it's wrong in some way. This is just a line that I saw someone else using years ago, so it may not be relevant to my site.

- [ ![deliverycountry.JPG](/forum/attachment/53268) ](/forum/attachment/53268 "...erycountry.JPG") [ ](/forum/attachment/53268?download=1 "...erycountry.JPG")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkwMjkxMi1pbXBsZW1lbnRpbmctZ29vZ2xlLW9wdC1pbi1yZXZpZXdzLXRvLWNoZWNrb3V0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14327
-
-

5 years 4 months ago [\#334557](#334557) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Implementing google opt-in reviews To checkout](/forum/27-checkout/902912-implementing-google-opt-in-reviews-to-checkout#334557 "-- url of the page with the problem -- :   sewingmachinesuk.uk/  -- HikaShop version -- : 4.4.2 -- Joomla version -- : 3.9.27 -- PHP version -- : 7.2.34  Hi again,  I'm trying currently to implement the opt in reviews to the checkout and am having a bit on an issue.  I'm not a coder and therefore it could be anything.  I was going off of one of your previous forum topics on the same thing, however what was missing was how the code itself was placed into the view/checkout/end.php its self. I don't know anything about syntax and could use some help.  I have tried just doing it myself and have ended up breaking the end screen so that it displayed nothing. I have also tried searching a lot, but there's not a lot written on it surprisingly.  This is the snippit that I have pieced together with help from the google page explaining the whole thing, and also your old form topic. I just need to know where to paste it in basically.  I'm using the default checkout/end.php  The google help page also talks about DOCTYPE which I'm not sure if I need to worry about.  Here is the page for ref   support.google.com/merchants/answer/7106244  Any help would be amazing, cheers")*

Hi,

This would happen if you disabled the "address_country" custom field in the menu Display&gt;Custom fields.
A sure way to get the country code would be: Code:

&lt;?php $country_code = 'UK'; if(!empty($this-&gt;order-&gt;order_shipping_address_id)) { $addressClass = hikashop_get('class.address'); $address = $addressClass-&gt;get($this-&gt;order-&gt;order_shipping_address_id); if(!empty($address-&gt;address_country)) { $zoneClass = hikashop_get('class.zone'); $zone = $zoneClass-&gt;get($address-&gt;address_country); if(!empty($zone-&gt;zone_code_2)) $country_code = $zone-&gt;zone_code_2; } } echo $country_code; ?&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkwMjkxMi1pbXBsZW1lbnRpbmctZ29vZ2xlLW9wdC1pbi1yZXZpZXdzLXRvLWNoZWNrb3V0P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.060 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
