Developer's copy of the online store
Some of the modifications you make to your online store require changes to your files and database. The work can stretch over time, as it requires analysis, comparison and checking. A developer's copy of the store will protect you from errors that occur during your or your programmer's work. Thanks to the copy you will avoid downtime in sales, and the comfort of your work on the developing store will increase.
A copy is a duplicate of the files and database of your production store. A copy of your store gives you control over changes before they reach your customers. You can modify the copy without worrying about the functioning of the production store.
The development store is usually placed in a subdomain of your store's domain, e.g. dev.domain.com. A well-prepared copy does not interfere with the production store, is invisible to web robots, and is easy to access for you and your colleagues.
PrestaShop copy in 10 steps
- Using SSH, pack your store files.
Using e.g. PhpMyAdmin , make a copy of the database, e.g. to a zip file.
Useful SSH commands
# ls - list the files and directories in the directory where you are located.
# cd. - descend to the directory below
# cd foldername/ - entering the directory
# df - area of the entire server
# du -sh - area of the current folder
# zip -r filename.zip foldername/ - packing the folder you are in
# unzip filename.zip - unpacking
# zip -r filename foldername/ - packing the folder to zip
# wgetfilename.com/filename.zip - downloading to the folder where you are a file from the Internet
# rm filetodelete.txt or foldertodelete/- deleting a file or directory
# mkdir - creating a directory
# up arrow - last typed ssh commands
# tab - autocomplete the typed command or file path
- Create a new database and through PhpMyAdmin upload the copy you made to it.
- In the new database, find the ps_shop_url and ps_configuration tables and replace the values in PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL with, for example, dev.domain.com
- Extract the files using SSH to a new folder on the server, which should be outside your store's directory.
- Clean the extracted files from the contents of the cache folder:
PrestaShop 1.6: /cache
PrestaShop 1.7: /var/cache.
- Enter the data for the new database in the file:
PrestaShop 1.6: config/settings.inc.php
PrestaShop 1.7: app/config/parameters.php.
- In the server panel, create a subdomain, such as dev.domain.com, and point it to the new folder.
- Log into the back-office at dev.domain.com, check the URL settings and save them to generate a new .htaccess file. You can disable SSL if you won't be using it in the dev store.
- On the dev.domain.com store, enable technical break and add your IP address to the list of accepted addresses.
- Instead of enabling the technical break, you can add in the .htaccess to secure your store with a password.
In your template files, it's a good idea to add noindex and nofollow, so Google robots won't index your store copy and you'll avoid duplicate content.
To make sure that you have secured the developer copy correctly you can use the agile and lightweight module"Developer Tools for PrestaShop".
Problems when using the dev version
Changes that you make in the back-office of the production store such as editing products, installing modules, etc. will not be visible in the development store. Such changes are not made simultaneously in both versions of the store to save time. Therefore, once in a while it is worth refreshing the files and database of the development version, so that this one is an accurate representation of the production store.
Applications useful for working with PrestaShop
PrestaShop + Figma
Figma is a free in basic version, a convenient tool for creating graphics for Web and eCommerce. You use the entire workspace for design and communication with your team. Make sure that the graphic designer preparing a new template for your store uses modern tools. A well-done design in Figma will be easily transferred by a programmer to the code of a new template.
PrestaShop + VSC
Visual Studio Code is a free software from Microsoft that is perfect for working on your store files. You can also support git and Docker containers in it.
PrestaShop + git
Git gives you access to the history of everything that has been happening with your files. You can see who, when and what they modified. You can review, evaluate and undo changes. With git you can do a quick synchronization of modifications in files between dev <-> prod versions. It is a must-have for teamwork.
Good tools to make working with git easier are github or gitlab. In addition to visibility into repositories, they allow you to manage users, schedule tasks, etc.
PrestaShop + Docker
Docker also runs the server environment along with the database and files. With Docker, you will fire up copies of your store quickly on your own computer, as well as on any server, without worrying about parameters such as PHP version and configuration, extensions, etc., because this configuration is stored and handled by Docker.
Docker, git and PrestaShop are happy to work together.
You canrun your work on multiple branches (branch) of git. Each branch stores all the information about the store and the changes you are working on. With a few commands, you can run a specific branch from git locally with Docker to review or further develop it. When you finish and test the changes, you can merge them with the branch responsible for the production store.
Server for PrestaShop
The optimal solution for PrestaShop is a server over which we have full root control. Such a server will allow you to develop new skills, and will certainly not limit you when the need for changes comes. Full root access is on offer on most VPS servers, such as at OVH, Digital Ocean, Google Cloud or AWS.
To conveniently manage your server's parameters and add-ons (e.g. mail, antivirus, etc.), it's worth investing in a Server Admin Panel, such as Plesk, which is constantly evolving and receives frequent automatic updates.
For those who are demanding, but don't have the time, we offer server deployment with a dev copy and a complete set of enhancements and tools for convenient work, including Plesk panel, SSL, CloudFlare and a backup system on an external server:
If you would like us to elaborate on any of the points or talk in detail about some tools used when working with PrestaShop let us know in the comments :-)