Category Archives: Tutorials


Clone Prestashop

Have you ever thought that, “I will just test this module quickly” or “I will just modify this stylesheet” and you end up with more work or more problems than expected.

The proper way is to setup a clone (an exact copy) of your original shop and test the changes first. Once you know that it is working, do the same thing in the live installation.

Step 1: Create a subdomain for your test shop

In my opinion the best way to setup the testshop is to use a separate subdomain (or even a totally different domain. If your hosting provider does not allow you to create more subdomains you will have to put the test site in a normal subfolder on your server.

Creating a subdomain is simple. After logging into Plesk just go to the Websites & Domains and at the bottom of the page you will find these options:
add subdomain in plesk
Select “Add new subdomain” and enter the name of the new subdomain and the folder on the server where you want to put the test site. In our case we call it “perf” which means the testsite will be available in Normally you want to name the subdomain and the folder the same.

Step 2: Copy the files we need for the prestashop clone

We will work through Plesk in this guide since it is much faster than downloading the full shop over ftp just to upload it again.

In the same Website & Domains, click on File Manager:
plesk file manager

and if your Prestashop is installed in the default httpdocs folder, click on that folder and you will see a long list of the Prestashop files.

Important: Now we must select all files. Find the word “All” to the right on top of the file list and click it.

Now all files are shown on one page. Select the checkbox to the left in the file manager header:

Now all files and folders are selected and the file list looks like this:

Click the Copy/Move button:

and you are taken to a confirmation screen where you need to also enter the destination directory.
Important: If you are using a subdomain, remember to remove the /httpdocs/ and just enter the folder name like in our example:

and when it has completed you will return to the FileManager with a success message.

And we are done with the transfer of the Prestashop files.

Step 3: Create a new database for our Prestashop clone

Go back to Websites & Domains and click on the Databases icon.
Choose “Add new database”

In the next screen just give the database a proper name. We have chosen “perf” to match the name of the subdomain.

Step 4: Create a user for the database

Now just click on the “add new database user” icon.

Choose a name and password for the database user. You can pick anything. For simplicity we have chosen givensa_perf to have a prefix “givensa” and a connection to the test site “perf” so we do not risk mixing it up with other databases.

Step 5: Importing the original database

Before importing anything, we would have to export the original database. How to export a database is already explained in How create a Prestashop database backup. Please refer to that article and then come back here for the next step when you are done.

Now ensure that you are back at the page with your newly created database (in our case the one called perf). Then click “Webadmin”

and you will enter the phpMyAdmin tool which allows us to import an existing database. In the menu there are not so many options at this time. Simply click “Import”

Click choose-file

and choose the database you just Exported. Click “Continue” and wait for a while for the database to be imported.

Wow thats awesome, now we have the files copied and we have a database uploaded. However the database contains some info from the live site that we need to change.

Step 6: Modifying the database to work with the Prestashop copy

One the left side find the table called ps_configuration prestshop-config

and click on it.

Change the Number of Rows field to show 3000 instead of 30 and press Enter so we can easily search the whole database.

Search on the page for the field called PS_SHOP_DOMAIN and when you find it, below you also see PS_SHOP_DOMAIN_SSL. Change both of them to the new url of the test site. In our example we will insert perf in front of the domain name.

If your prestashop version is 1.5 or higher. You also need to find the table called ps_shop_url and make the same changes so it looks something like this:

Step 7: Updating our database settings to match the new database

Now when we have the database imported, we must tell Prestashop which database to use. In the copy we made previously Prestashop still wants to look at the original database and this is definetely not what we want.

So, go back to Websites & Domains and click again on the File Manager. Go inside the folder of our new testsite (in our case it is /perf/) and click on the config folder and locate the file and click on the pen icon to edit the file.

Change the fields DB_USER and DB_PASSWD to match the credentials we set earlier. In our case we entered givensa_perf for both. If you old settings does not say:
define(‘_DB_SERVER_’, ‘localhost’);
you will have to enter the name of the new database in that field (in our case it would be “perf”).

Now Prestashop will be able to use the correct database.

Step 8: Updating our .htaccess file

In order for things to work we must regenerate the .htaccess. This we do from the Prestashop admin interface so go to and under the Preferences tab select SEO & URLs.prestashop_perf_tab

In order to make Prestashop rewrite the .htaccess file, all you have to do is click the Save button.

Fantastic, if you now go to your test site (in our case it is you should see it working.

Congratulations, you have created an identical copy of your prestashop site. In order to finish up nicely, we would not like for Google to index this site so we add a robots.txt that blocks all search engines from browsing our test installation.

Add blocking robots.txt for the Prestashop test site

Go back to the File Manager in Websites & Domains and find robots.txt in your test site folder. Click on the pen to edit it. Delete all info in the file and add these lines:
User-agent: *
Disallow: /

Now search engines will not crawl your test site.

Finishing up

Now everything should be in order and you are ready to start hacking around in your test installation. I hope you find the tutorial useful and if you have any comments or found errors or things that could be more clear, do not hesitate to let me know by posting a comment below.


How create a Prestashop database backup


Sometimes when making changes in Prestashop I feel that we loose control. You unhook one module and the whole site explodes (or maybe implodes) and it might be hard to understand what happened.

In these scenarios as always the recommendation is to backup the site and the database. However if you are on a standard ftp connection with your hosting provider, downloading the whole shop might take a very long time.

If you are just testing new modules or trying to remove some Prestashop modules to make your site faster, then it might be enough just to make a backup of the database. This way if things go bad, you can just restore this backup and you are back where you started with a working shop.

In this example we will show how to make a backup using Plesk. The good thing with this approach is that it is generic so it applies for any mySQL database, Prestashop, WordPress etc and since we normally do a lot of things like copying files and editing configs through Plesk rather than through ftp it is starting to feel like a familiar environment.

Getting started

Start by logging into Plesk with your username and password provided by your hosting company. You will see a screen of the

Finding the database to backup

If you click on the tab called “Websites and Domains” and then on “Databases” you will get into the Plesk database page. plesk-databases
Find the database that is attached to your Prestashop installation.

Click on the webadmin button

prestashop database for backup

Database for backup

and you will get into the phpMyAdmin tool.
phpMyAdmin prestashop
Where you will see a huge table of database info. You can just ignore all that.

Exporting the database

Now just click the Export button:
and click Continue.

Now a download of your database will start automatically and you are done.

As long as you only modify things from the Prestashop admin, if anything goes wrong it can usually be restored by simply Importing this Prestashop database again. How to Import a Prestashop database backup is explained in this blogpost.