Import locations/regions manually

Import locations/regions manually

Learn how to import regions/locations to DJ-Classifieds

When you need to have many locations/regions in your classifieds website 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. 

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)

Please note that the locations should be imported into an empty table of DJ-Classifieds regions.

The structure of the .csv file you'll need is quite straight forward: 

   
"id";"name";"parent_id";"country";"city";"published";"latitude";"longitude" 
"1";"Africa";"0";"0";"0";"1";

01-db-structure

in Microsoft Excel it will look like this:
02-db-structure 

The first row has this 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) 

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

03-phpmyadmin

When in phpMyAdmin open your database and find regions table and open it (the name of the table will be [yourdbprefix]_djcf_regions )

04-phpmyadmin

Next ( when in regions table ) click „Import” in the top bar

 Now you’re ready to import the .csv file


  1. browse for the .csv file
  2. make sure to skip the first row (insert „1”)
  3. insert „;” (semicolon) in Columns separated with:
  4. Enter Column names: id,name,parent_id,country,city,published,latitude,longitude,country_iso
  5. click „Go”

Imported regions/locations are now visible in your DJ-Classifieds 

07-dj-classifieds-backend

You can download exemplary .csv file with regions here:  DJ-Classifieds regions / locations exemplary .csv ( 9.34 kB )

Download pre-made databases:

Please check Important notes below when using these files.

Important notes

If you're seeing "Invalid column count" error when importing the .csv file via phpMyAdmin, add the following text in the "Column names:" in case the Regions table have more columns than the imported .csv file (this can happen when we update DJ-Classifieds):
id,name,parent_id,country,city,published,latitude,longitude,country_iso


      • Related Articles

      • Import categories and subcategories manually

        Following the article about importing locations to DJ-Classifieds, here's a tutorial on importing categories and subcategories the same way. To do it, you’ll need to be able to access your database via phpMyAdmin. Preparing the import file Create the ...
      • Display all locations/regions in one view

        The regions tree component view lets you display all the locations/regions in one view, so you can show your users all the places where your website gets the adverts. These regions list is based on the locations created by the Administrator. Learn ...
      • Locations

        To create a new location, click on the Locations button from the Control Panel, then click New from the top right toolbar and you will be directed to the page: Short description: Name – enter the name of the location Alias - displayed in URL Type – ...
      • How to display expanded tree of locations in DJ-Classifieds Regions module

        You can display a complete tree of locations in DJ-Classifieds Regions module. To do so, in module options, set the 'Expand type' parameter to 'All regions'.
      • How to display adverts number in regions module

        Watch the video and see how you can display the number of adverts in regions: