The test environment is basically a clone of your live shop where you can test everything in it. To set up a test environment, you have to copy the live shop into a secondary directory. The public folder in this directory can then be accessed through, for example, a subdomain of the hoster. The following steps are necessary to copy the live shop into a secondary directory.
Copying the live system
Create a new folder next to the main store directory, e.g. “testshop”.
Then copy the files of your live environment into the newly created folder.
Note:- It is important that you also copy the .env and .htaccess files. Please note that files beginning with “.” may not be displayed directly. In this case, you may need to adjust the display settings of the program that you are using to copy the files.
Create a subdomain
Create a subdomain of your main domain. This can look like this: https://live-shop.subdomain.com
Now to route this domain to the newly created folder you have copied the main store. This subdomain should be different from the shop domain, otherwise, the main domain will route to the test environment.
Create a new database
Click on the Databases option to open the overview of the database. Then enter a name for the test database and select as collation “utf8mb4_unicode_ci”. In our example, we call the database “testshop”.
Changing the .env-file
Edit the .env file of the test environment according to the new database. The .env file is located in the root directory of the test environment. In the file, the line beginning with DATABASE_URL adds the database name. The code line should look like this.
DATABASE_URL=mysql://user:passwort@localhost:3306/testshop
You have to adjust the APP_URL entry so that the complete call for the test shop is stored there. The code line should look like this.
APP_URL=http://my-shop.com/testshop/public
It may necessary to adjust the entry under COMPOSER_HOME.
This is only necessary if the path stored there leads to your Shopware directory. If the Composer is located outside of the Shopware installation, no adjustment is necessary.
Copying the Live Database
Copy the data of the live database to the newly created database. To copy the database you can use the import/export functions within phpMyAdmin.
Note:- Some extensions store an APP_URL in the database, which contains the URL of the Shopware installation. In the copy of the database created here, this URL then no longer matches the URL of the test environment in the secondary directory. This leads to a message when the admin is called up for the first time:
Your shop domain has changed
Here you select the second option Reinstall your apps. This automatically adjusts the entry in the database.
Customize the sales channel domain
Go to the admin panel and click on the sales channel in the menu on the left side.
In the Domains section, you can add the domain of your test environment.
Please contact us at manish@bay20.com or call us at +91-8800519180 for any support related to shopware. You can also visit the Shopware development page to check the services we offer.