How to switch the Aimeos locale sites according to the User's country.

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
usernew
Posts: 1
Joined: 25 Feb 2021, 05:10

How to switch the Aimeos locale sites according to the User's country.

Post by usernew » 25 Feb 2021, 05:17

Hi,
I have a shop with 2 Aimeos locale sites: default and default1. both have a different set of products.
I want to display the items from default1 if the user is from country A . and if they are from country B , I need to show the products from default.

How can I switch the sites according to the IP of user.(to get the country).

I hope you can help me.

Thank you.

User avatar
aimeos
Administrator
Posts: 7871
Joined: 01 Jan 1970, 00:00

Re: How to switch the Aimeos locale sites according to the User's country.

Post by aimeos » 26 Feb 2021, 09:32

You may use the TYPO3 locate extension to map the IP to the country. Then, you can extend the Aimeos Locale class and use the country to set the site code you want:
https://github.com/aimeos/aimeos-typo3/ ... hp#L32-L47

To use your new Locale class, add a configuration in your own TYPO3 extension (use the Aimeos extension generator to create one) like described here:
https://aimeos.org/docs/latest/typo3/ex ... strap-code
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply