1 haharen Apr 11, 2016 05:40
3 mgsolipa Apr 11, 2016 07:37
Excellent, thanks for this contribution @haharen ! I almost immediately thought on use it (as it) to import regions of other countries :D
Actually, there is an existing import tool but it's only for cities (http://b2evolution.net/man/cities-import), so extending that feature to let admins import the whole structure in a single action, would be great. Would you like to help us to convert this into a plugin?
Please see this repository: https://github.com/mgsolipa/b2evolution-import_regions_plugin (NOTE: I created it in my own GitHub account, but I think we can move it to the b2evolution's account when it's ready). It's just the plugin's skeleton, so a blank canvas to work on.
The main idea is to use the AdminToolPayload and AdminToolAction events to add a maintenance tool (maybe it should be an import tool) that let the user upload a CSV file to read the regions from it (instead of the database table as you initially implemented).
The second idea is to re-use your code in combination with the own b2evolution's API methods to control the regions, sub-regions and cities records. This way we can take advance of such features as user access control, duplicity control, etc.
I added a small TODO list to the README file, so we can develop this together. What do you think?
Thank you.
4 mgsolipa Apr 11, 2016 07:41
In addition to above, along with the plugin itself we can add single CSV files by country, so site admins may download what they want and import to their sites, as we currently do with localisation files.
I can think on China, Spain and Venezuela as a starting point.
@fplanque what do you think?
5 haharen Apr 11, 2016 11:00
@mgsolipa
Thank you for your affirmation, I am glad to do this indeed, it's my pleasure. However my ability of programming is relatively weak, so I have to need some time replenish programming knowledge. And if I make any mistake, please correct me.Thanks!
The executive program and regional database.
Attachments: