You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wrong site is being suggested when we visit a new site. Its suggesting the previous site I was on, not the site where my IP is.
So for example, I am in the UK and I visit the US site, it pops up at first asking if I want to visit the US site or the UK site, all OK.
Lets say I go to the USA, not my country site which is UK.
If I then use the site switcher, which is your code, to go to say Italy, and I manage to get the popup again, it would ask if I want to go to the USA site or the Italy site. If I go to Italy and then a new country site and then get the switcher it asks me if I want to go to the Italy site or the new site.
So the site info in craft.geomate.redirectInformation() is remembering the last site I was on, NOT the site for my IP address.
Full code:
{% set redirectInfo = craft.geomate.redirectInformation() %}
{% if redirectInfo %}
{% set targetSiteSettings = craft.app.globals.getSetByHandle('siteSettings', redirectInfo.site.id) %}
{% set currentSiteSettings = craft.app.globals.getSetByHandle('siteSettings', currentSite.id) %}
{% set currentCountryFlag = currentSiteSettings.countryFlag.first() %}
{% set targetCountryFlag = targetSiteSettings.countryFlag.first() %}
<div class="reveal" id="countryRedirectPopup" data-reveal>
<p>{{ strings('Please select the country version of the website you would like to view')}}</p>
<br/>
<a href="{{ redirectInfo.url | addOverrideParam }}"><img src="{{ targetCountryFlag.url }}" width="30" height="20"> {{ redirectInfo.site.name }}</a>
<br/>
<br/>
<a href="{{ currentSite.baseUrl | addOverrideParam }}"><img src="{{ currentCountryFlag.url }}" width="30" height="20">{{ currentSite.name }}</a>
<br/>
<br/>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>
{% endif %}
Yes, that is the intended behavior. If the user has selected a site as their preferred site, GeoMate assumes that that's the site that the user prefers. You can check redirectInfo.isOverridden to see if that's the case.
You can also use craft.geomate.isOverridden to check if the user has manually selected a site. If he has, you probably shouldn't show the popup at all.
Hi
The wrong site is being suggested when we visit a new site. Its suggesting the previous site I was on, not the site where my IP is.
So for example, I am in the UK and I visit the US site, it pops up at first asking if I want to visit the US site or the UK site, all OK.
Lets say I go to the USA, not my country site which is UK.
If I then use the site switcher, which is your code, to go to say Italy, and I manage to get the popup again, it would ask if I want to go to the USA site or the Italy site. If I go to Italy and then a new country site and then get the switcher it asks me if I want to go to the Italy site or the new site.
So the site info in craft.geomate.redirectInformation() is remembering the last site I was on, NOT the site for my IP address.
Full code:
Config:
Thanks
The text was updated successfully, but these errors were encountered: