Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow different Addresses per different Sites #11

Open
lindseydiloreto opened this issue Feb 27, 2021 · 10 comments
Open

Allow different Addresses per different Sites #11

lindseydiloreto opened this issue Feb 27, 2021 · 10 comments
Labels
Feature Request New feature or request

Comments

@lindseydiloreto
Copy link
Collaborator

lindseydiloreto commented Feb 27, 2021

The Address field should be aware of which Site is being edited. Currently, all Sites share the same Address data.

I believe it's mostly a matter of adding a siteId column to the Address table in the database. We'll find out how true that is once I dive into the task.

This feature is expected to be released as early as v4.1, or as late as v4.3. If anything changes, I'll post back to this thread!


Migrated from Smart Map: doublesecretagency/craft-smartmap#22

@AndrewMac
Copy link

Hi Lindsey, good to see you've still got this on the roadmap! I remember we discussed this a while back, when the plugin was still SmartMap. We really need this feature as our sites are mainly English/Thai, and Thai has its own script. The same issue would, of course, come up with China, Japan, the Middle East nations and a host of others.

For example, with the location "Chiang Mai, Thailand"
The Thai is เชียงใหม่ ประเทศไทย

Although the location data can be looked up in English, we use the Google Maps address fields (along with some custom fields) to populate the marker popup and the entry page. So we really need the Thai version if possible :-)

Thanks so much for considering this, Andrew

@lindseydiloreto
Copy link
Collaborator Author

Certainly, no problem! I still regard it as one of the more important issues. 🙂

Once some of the 4.1 issues are resolved, I look forward to knocking this out in 4.2.

@idawgik
Copy link

idawgik commented Jun 2, 2022

I have a project I'm currently working on that could really use this feature. In our case, it's a multi-site where we have location data for each site in a global. Since I can't set the address field as translateable, the location info is shared between both sites (even though they have separate addresses). I would need to look at setting things up differently to make it work as things are now, so getting this support would be a huge plus.

@lindseydiloreto lindseydiloreto removed this from the 4.3.0 milestone Feb 2, 2023
@MoritzLost
Copy link

@lindseydiloreto Hey Lindsey, any updates on supporting translation methods / multi-site support? This might become very relevant to an upcoming project. Is this still planned, and if so, is there any kind of ETA you can share?

@svondervoort
Copy link

Any update on this? Currently running into the same issue with a multisite and an address field in globals.

@lindseydiloreto
Copy link
Collaborator Author

I believe I finally have this done... Would anyone on this thread care to pull the latest dev version and test it?

"doublesecretagency/craft-googlemaps": "dev-v4-dev"

This is currently only available on Craft 4. Once it is deemed stable, it will be ported to Craft 5.

⚠️ Please make sure to backup your database first, as this update will run a significant migration!


Multisite Support

This update formally introduces multisite support. In other words, an Address can now contain different values for each site in your project.

All standard translation methods are supported.


Once this feature is confirmed to be working and stable on Craft 4, I will tag and release a Google Maps update.

Additionally, I will also port this feature to:

  • Google Maps for Craft 5
  • Mapbox for Craft 4
  • Mapbox for Craft 5

For anyone willing to take it for spin, please let me know once you've run some tests. I'm eager to hear how it goes! 🙏

@AndrewMac
Copy link

Hi @lindseydiloreto, that’s great news! Sadly, though, I'm not currently running any Craft 4 sites, and I'm not sure when I might have time to spin one up for testing. I'll try to do that, but with any luck, some of the others will be in a better position than I am.

@svondervoort
Copy link

That's great, I have some development research time Friday next week where I can give it a test.

@MoritzLost
Copy link

@lindseydiloreto Just gave this a try, looks good to me 👍

Added a small cosmetic comment here, but everything seems to be working: c0db643#r142853593

One thing to note is that this will multiply the number of rows in the database with the number of sites. As I mentioned on Discord, I think this is the best way, just something to note. Probably useful to mention this in the docs or changelog. Might have performance and storage space implications for sites with tons of addresses and sites.

In theory, it might be possible to leave the site ID empty if the field is set to not be translatable and only save the address once in this case. However, I'm not sure if this will work with the way the address table is joined in modifyElementsQuery. Probably safest not to touch this and just always set the site ID, even if it means duplicating some rows unnecessarily.

@lindseydiloreto
Copy link
Collaborator Author

@MoritzLost Ok great, thanks for testing everything! 🙏

I agree that this table structure (a row for each site) is probably the best approach. It seems to work well with how Craft handles things internally, and is hopefully somewhat future-proof.

Per your advice, I just added a migration warning to both the CHANGELOG and the docs.

Thanks for looking over everything, it's greatly appreciated! 🍺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants