Ever wondered how to import regions/locations to DJ-Classifieds?
When you have many of them it can be hard to add them one by one this is why we created this tutorial on how to import all the locations at once directly to your database.
To do it you’ll need to be able to access your database via phpMyAdmin.
First, you need to prepare the .csv file with all the regions you want to add (You’ll find the exemplary .csv file at the end of the article).
The files you can use:
The structure of the .csv file you'll need is quite straight forward:
In the first row you see the labels of the columns:
- id - ID of the region
- name - name of the region
- parent_id - if the region is child item of other region you put the parent region ID there
- country - if the region is a country you need to use 1, otherwise use 0
- city - if the region is a city you need to use 1, otherwise use 0
- published - use 0 or 1 to determine if the region will be published after import
- latitude - latitude coordinates (you don’t need to use them but it’s needed to have that column in .csv)
- longitude - longitude coordinates (you don’t need to use them but it’s needed to have that column in .csv)
There’s no „other” column, right? That’s because it’s not needed. If you wont select the region as a city or country it’ll appear as „Other” in your DJ-Classifieds.
In following rows, you insert the values basing on the scheme.
Once you’re ready with your .csv file you can move to import it to the database.
First open your Cpanel account, open phpMyAdmin
When in phpMyAdmin open your database and find regions table and open it (the name of the table will be [yourdbprefix]_djcf_regions)
Now you’re ready to import the .csv file
- browse for the .csv file here
- make sure to skip the first row (insert „1”)
- insert „;” (semicolon) in Columns separated with:
- click „Go”
Woot woot! Imported regions/locations are now visible in your DJ-Classifieds installation :)
You can download exemplary .csv file with regions here: DJ-Classifieds regions / locations exemplary .csv (9.34 kB)
Download pre-made databases:
- Whole world regions divided for continents, countries, and cities (English naming) DJ-Classifieds World regions (1.34 MB)
- Europe regions divided countries and cities (English naming) DJ-Classifieds Europe regions (406.02 kB)
- Poland regions divided for voivodeship and cities (Polish naming) DJ-Classifieds regions / locations - Poland .csv (89.79 kB)