1 Apr 11, 2016 05:40
Convenient for Chinese webmasters to batch import regional information. The way as follows:
- Unzip the file
- Import the file
tm_location.sqlinto b2 database;
- Put the file
import_china_regional.phpinto the web root dir of b2, then access to the url as like : http://your-b2-web-url/import_china_regional.php
- [Importment!]: Delete the file
NOTE: This code is not optimized and only for users who know a bit of PHP and MYSQL (understand the code by the comments, it's really simple and easy). Please see the comments of the file 'import_china_regional' to get more info .
3 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?
4 Apr 11, 2016 07:41
5 Apr 11, 2016 11:00
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!