Google has, somewhat famously, backed out of China due to restrictions on search and geographic data publishing. In order to display a functional locator to Chinese visitors, a few settings must be dynamically updated when the visitor's country is detected as China.
Directions links should use Baidu Maps in China. Google Maps functions in China for those outside of China, but not for those within its borders. This template includes conditional logic that displays Baidu for users from CN and the regular Google Maps directions for all others.
โ
2. The Map Vendor should be switched to MapTiler. If the Interface is set to use Google Maps, the Map Vendor should be set to MapTiler GL. This can be done using Dynamic Parameters.
First, enable Dynamic Parameters as shown below:
Then, configure the Map Vendor setting to use maptilergl
when geoip_country_code
is set to CN
by clicking the Dynamic Parameter option next to Map Vendor
Update the values in the Dynamic Parameter Editor as shown below:
Finally, save the Interface for the settings to take effect.
Testing
To test the effect of this change outside of China, an IP address can be "forced". To do this,
Preview the Interface to obtain the URL, it will look similar to this example:
https://admin.metalocator.com/index.php?option=com_locator&view=directory&layout=combined_bootstrap&preview=1&framed=1&tmpl=component&Itemid=xxxxxx&demofilter=&sample_data=0
Obtain a Chinese IP address by Googling for an example.
Append the preview URL with the following special parameter
&_ip=1.0.63.254
, where the IP address is any known Chinese IP Address. The final URL would be similar to this, but would use your preview link:
โhttps://admin.metalocator.com/index.php?option=com_locator&view=directory&layout=combined_bootstrap&preview=1&framed=1&tmpl=component&Itemid=xxxxxx&demofilter=&sample_data=0&_ip=1.0.63.254
You may need to hard-reload when switching back and forth.