Post by vic_ki » Mon Jan 17, 2022 9:10 pm

Hello
Site on Opencart v.3.0.3.7
The Contact page displays a map, but it doesn't work.
It looks like there is a common key for everyone.
I generated a key for my domain, but when I change it in the file /catalog/view/theme/site/template/information/contact.twig , the page stops working altogether.
Line:
<script
src="https://maps.googleapis.com/maps/api/js ... ck=initMap">
</script>

Tell me, what is the problem and how to change the key?
Thank you

Newbie

Posts

Joined
Wed May 16, 2018 11:40 pm

Post by xxvirusxx » Tue Jan 18, 2022 4:37 am

vic_ki wrote:
Mon Jan 17, 2022 9:10 pm
The Contact page displays a map, but it doesn't work.
Refresh ocmod, clear theme cache, sass cache.

My Converted Modules | Opencart Upgrade Service | Free Dashboard Maps | Buy me a beer | My Custom OC 3.0.3.8


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by moshair » Tue Jan 18, 2022 7:31 am

To make oc built in google map button works you need to enter the geolocation coordinates like in this snapshot (get your store location value from google maps)

Image

The result will be:

Image

If you didn't able to display google map for you store using google maps API, You can embed google map for free using iframe:

Image

Paste the HTML code in contact.twig

***

Regarding your code in your post; you need to replace the word KEY with your key value.

Code: Select all

<script 
src="https://maps.googleapis.com/maps/api/js?key=KEY&callback=initMap">
</script>

Attachments

gmaps_embed.jpg

gmaps_embed.jpg (153.37 KiB) Viewed 196 times

contact_us.png

contact_us.png (14.14 KiB) Viewed 196 times

geocode.png

geocode.png (48.95 KiB) Viewed 196 times


New member

Posts

Joined
Sun Jul 21, 2019 3:27 pm

Post by vic_ki » Tue Jan 18, 2022 7:57 pm

thanks for answers
You helped solve the problem.
The error was in the cache and on the side of Google.
The API did not want to work with the IP address of the server. You need to specify a domain.

Thanks again

Newbie

Posts

Joined
Wed May 16, 2018 11:40 pm

Post by paulfeakins » Tue Jan 18, 2022 10:22 pm

vic_ki wrote:
Tue Jan 18, 2022 7:57 pm
You helped solve the problem.
Please add [SOLVED] to the start of the post title.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom
Who is online

Users browsing this forum: No registered users and 4 guests