How to export customer information in PrestaShop
In this article we'll describe how to export some customer information out of your PrestaShop database and save it into a file that you can view on your local computer. Here we will not discuss how to export customers from one installation and import them into another.
You can do this using phpMyAdmin. To access phpMyAdmin, log in to the Pixie control panel, go to the Databases section and click on the phpMyAdmin link in the black area on the right. Inside phpMyAdmin click on the name of the database in which your PrestaShop is installed; all databases are listed in the left frame. Once you do that its tables will be displayed in the right frame. Next, you need to execute an SQL query. To do that click on the SQL tab that's above the database tables. This will display a big text area in which you can type (or copy/paste) the query, then to execute it click on the Go button in the lower right corner.
For example, let's say that you want a list of your customers with their email addresses and birthdays. This information is stored in the table ps_customer. You can execute the following query:
SELECT `firstname`, `lastname`, `email`, `birthday` FROM `ps_customer`
You have to replace ps with the actual prefix of your database tables. This query will filter the first and last name of customers, together with the email address and birthday of each one. Then to export the results, mark the checkboxes for each customer and click on the Export button that's below the table rows. On the page that opens select CSV from the Format drop-down menu, click on the Go button and save the file on your local computer. You can view and edit the CSV file with applications like Microsoft Excel and Open Office Spreadsheet.
When you execute the SQL query in phpMyAdmin you can also select how the information should be ordered. For example, if you want the customers to be ordered alphabetically by their last name you can expand the above example query a bit so that it looks like this:
SELECT `firstname`, `lastname`, `email`, `birthday` FROM `ps_customer` order by `lastname`
The ps_customer database table doesn't contain the phone numbers and addresses of the customers. You can check its rows by clicking on the table name in phpMyAdmin. The phone numbers and addresses are stored in the table ps_address. So, for example, if you want to have a list of the customer phones, you can execute a query such as this one:
SELECT `firstname`, `lastname`, `phone`, `phone_mobile` FROM `ps_address`
Of course, you have to change ps in the above example query with the actual table prefix of your database. Then you can export the information on your local computer into a CSV file.
PrestaShop 1.5 and newer versions have a built-in SQL manager that you can use from the admin panel. You can access it from Advanced Parameters menu>SQL Manager sub-menu. If you find it more convenient than phpMyAdmin, you can use it to execute SQL queries and export the results.
Was this answer helpful?
- How to manage your PrestaShop orders
- How to add combinations to products in PrestaShop 1.5-1.6
- How to remove the "Add to cart" button from category pages for products with attributes in PrestaShop
- How to change the number of products per page in PrestaShop
- How to remove the "PrestaShop News" and "PrestaShop Link" blocks from the dashboard of the admin panel in PrestaShop