Skip to content

Setting up a test shop

A test shop is a copy of your live shop that runs separately from your real shop operations. In it you can try out updates, new modules, theme changes or new settings without your customers noticing. Only once everything works in the test shop do you apply the change to your live shop.

This guide is for operators of self-hosted shops. Setting up a separate test shop is not intended for cloud shops (gambiocloud.com).

Note

You do not need an additional support license for a test shop. The requirement is that it is clearly a test shop, for example a copy of your live shop. A test shop does not get its own shop key and is fully covered by Support. Step 8 explains how to store it in the Gambio customer portal.

Overview

Depending on the size of your shop, the setup takes about one to three hours. You follow these steps:

  1. Create a subdomain and an empty database for the test shop
  2. Copy the files of the live shop to the test directory
  3. Copy the database of the live shop and remove the shop key and Hub connection from the copy
  4. Adjust the configuration files of the test shop
  5. Protect the test shop from outside access
  6. Clear the cache and log in to the test shop
  7. Separate the test shop from live operations (shop key, emails, tasks, interfaces)
  8. Register the test shop in the Gambio customer portal
  9. Check the test shop

Attention

In steps 4 to 9, work exclusively in the test shop. Before every change, check the address bar of your browser or your FTP program to make sure you really are in the test shop. A mix-up can damage your live shop.

What you need

  • Access to the customer menu of your hosting provider (to create the subdomain, database and directory protection)
  • FTP or SFTP access to your web space and an FTP program, for example FileZilla
  • Access to phpMyAdmin or a comparable database tool of your hosting provider
  • The login details of your live shop for the Gambio Admin and the Gambio customer portal
  • Free storage space of roughly the size of your live shop (files and database)
  • A plain text editor, for example Notepad++ or Visual Studio Code (not Word)

Note

If possible, set up the test shop with the same hosting provider and the same PHP version as your live shop. Only then does the test shop behave like the original. The supported PHP and MySQL versions are listed in the release notes of your shop version on developers.gambio.de.

Step 1: Create a subdomain and database

Create the following in the customer menu of your hosting provider:

  1. A subdomain for the test shop, for example test.your-shop.com, with its own empty directory, for example /testshop
  2. An SSL certificate for the subdomain (free of charge with Let's Encrypt at most providers)
  3. A new, empty database with its own database user

Write down the access data of the new database. You will need it in step 4:

Item Example
Database server localhost
Database name myshop_test
Database user myshop_test_user
Password a secure, new password

Attention

Never use the database of your live shop for the test shop. Otherwise both shops access the same data, and every change in the test shop immediately ends up in the live shop.

Note

Instead of a subdomain, you can also set up the test shop in a subdirectory, for example www.your-shop.com/testshop. The .htaccess file detects the directory by itself, you do not need to change anything there.

Step 2: Copy the files

Copy all files and directories of your live shop to the directory of the test shop. Your live shop can stay online while you do this.

With the file manager of your hosting provider (fastest option): Many providers can copy entire directories directly on the server. Copy the contents of the shop directory to the test directory.

With an FTP program:

  1. Connect to your FTP server
  2. Enable the display of hidden files. In FileZilla you find this option under Server > Force showing hidden files. Only then are files like .htaccess copied as well
  3. Download the complete contents of the shop directory to your computer
  4. Upload everything to the directory of the test shop

Depending on the number of product images, this can take some time. Copy the cache directory as well. You delete the cached files in it later in step 3.

If copying the cache takes too long, you can leave out the cached files. However, this structure must exist in the test shop:

  • The cache directory with the files .htaccess and index.html
  • The subdirectories cronjobs, sessions and smarty, each with its index.html file

Note

After copying, the file permissions must be correct. The cache directory and its subdirectories need write permissions (777). Most FTP programs do not carry over permissions automatically. In FileZilla you set them by right-clicking the directory and choosing File permissions.

Step 3: Copy the database

You export the database of your live shop and import it into the new test database. Your live shop stays online and unchanged.

  1. Open phpMyAdmin and select the database of your live shop in the left column. You find the name of the database in the file includes/configure.php of your live shop
  2. Click the Export tab, leave the export method on Quick and the format on SQL and click Export. The file is downloaded to your computer

  3. In phpMyAdmin, now select the new, empty database of the test shop

  4. Click the Import tab, select the downloaded file and click Import at the bottom

Note

phpMyAdmin limits the size of import files (2 MB in the image). If your database is larger, export it compressed (export method Custom, compression gzipped) or use the import tool of your hosting provider. For very large databases, your hosting provider can help you, see also the section For advanced users: copying via SSH.

Remove the shop key and Hub connection from the test database

The copied database still contains the shop key and the Hub client key of your live shop. With them, the test shop would identify itself to the Gambio customer portal and the Gambio Hub as your live shop. As a result, the address of your live shop stored in the customer portal changes, and the Hub connection of your live shop can be disrupted. This is why you remove both keys before you open the test shop for the first time:

  1. Select the database of the test shop in phpMyAdmin
  2. Click the SQL tab
  3. Paste the following commands and click Go

    sql UPDATE gx_configurations SET `value` = '' WHERE `key` = 'configuration/GAMBIO_SHOP_KEY'; UPDATE gx_configurations SET `value` = '' WHERE `key` = 'gm_configuration/GAMBIO_HUB_CLIENT_KEY'; UPDATE gx_configurations SET `value` = 'False' WHERE `key` = 'configuration/MODULE_PAYMENT_GAMBIO_HUB_STATUS';

  4. Via FTP, delete all files except .htaccess and index.html in the cache directory of the test shop and in its subdirectories. Keep the subdirectories themselves

Attention

Run these commands only in the database of the test shop, never in the database of your live shop. Before you do, check in the left column of phpMyAdmin which database is selected.

Attention

Do not disconnect the Hub under Gambio Hub > Account, neither in the live shop nor in the test shop. Disconnecting and reconnecting via the interface changes the Hub client key and the shop key. The Hub can then no longer assign PayPal orders that were placed with the old key to your shop.

Note

Your Hub payment methods and their settings are stored in the Gambio Hub, not in your shop database. The commands above do not change them, and your live shop stays connected to the Hub.

Without a shop key, you cannot use the Updater and the Gambio Store in the test shop.

Step 4: Adjust the configuration files

So that the test shop uses its own address and its own database, you adjust four files in the test shop:

  • includes/configure.php
  • includes/configure.org.php
  • admin/includes/configure.php
  • admin/includes/configure.org.php

For security reasons these files are write-protected (file permissions 444). In your FTP program, right-click the file, choose File permissions and temporarily set them to 644. Then download the file and open it in your text editor.

1. Change the address: In each of the four files, replace the address of your live shop with the address of the test shop. This concerns the lines with HTTP_SERVER, HTTPS_SERVER, HTTP_CATALOG_SERVER and HTTPS_CATALOG_SERVER:

// before
define('HTTP_SERVER', 'https://www.your-shop.com');
// after
define('HTTP_SERVER', 'https://test.your-shop.com');

The easiest way is the search and replace function of your editor: search for www.your-shop.com and replace all occurrences with test.your-shop.com.

2. Change the database: Further down in each file there is a block starting with define_database(. Enter the access data of the test database from step 1 there:

define_database('localhost',            // database server
                'myshop_test_user',     // database user
                'YOUR-NEW-PASSWORD',    // password
                'myshop_test',          // database name
                'false');               // do not change

Note

Above it there are lines like //define('DB_SERVER', ...). The two slashes at the beginning mean that these lines are not used. Only the define_database( block matters.

Save the files, upload them to the test shop again and set the file permissions back to 444.

Note

In older shop versions the configuration files sometimes contain fixed server paths, for example /var/www/web123/html/shop/. If your test shop is in a different directory, replace these paths with the path of the test directory as well.

Check redirects in the .htaccess file

Open the file .htaccess in the main directory of the test shop and search for the address of your live shop. Many shops redirect all requests to www.your-shop.com there, for example. These rules would also redirect the test shop to the live shop. Put a # in front of each of these lines so that they no longer apply in the test shop.

Step 5: Protect the test shop

Your test shop contains real customer data and real products. It must not be reachable for visitors or search engines.

Set up directory protection: In the customer menu of your hosting provider, create directory protection (password protection) for the directory of the test shop. When the test shop is opened, the browser then asks for a user name and password. Depending on the provider, this function is called directory protection, password protection or htaccess protection, for example.

Note

With directory protection active, the Gambio Store, the Google Services and the Gambio Hub do not work in the test shop, because these services need to reach the shop from outside. As they are not used in the test shop anyway, this is fine.

Keep search engines out: Replace the contents of the robots.txt file in the test shop with these two lines:

User-agent: *
Disallow: /

Set the test shop offline: As an additional safeguard, you set the test shop offline later in step 7. As a logged-in administrator you still see the shop as usual.

Attention

A notice like "This is only a test shop" is not enough. A publicly reachable test shop can lead to legal warnings, duplicate content in search engines and data protection problems.

Step 6: Clear the cache and log in

  1. Open the Gambio Admin of the test shop, for example https://test.your-shop.com/login_admin.php
  2. Log in with the same credentials as in your live shop
  3. Open Toolbox > Cache and click Execute for all entries, from bottom to top

Note

If the test shop only shows a white page or an error message when you first open it, delete the files in the cache directory of the test shop again as described in step 3. Then reload the page.

Step 7: Separate the test shop from live operations

The test shop works with the same settings as your live shop. So that it does not send real emails, report orders to marketplaces or trigger payments, you now make the following settings in the test shop.

Check the shop key

Open Settings > My Shop, select the System category and click the link to the shop key page under Shop Key. The Shop-Key field must be empty. If a key is still entered, run the SQL commands from step 3 again.

Attention

Never enter the shop key of your live shop in the test shop. Otherwise the address of your live shop stored in the Gambio customer portal changes automatically, or you get a message in the admin that the shop key is already in use.

Do not connect the Gambio Hub

In the footer of the Gambio Admin, the test shop must show HUB disconnected. Do not connect the test shop to the Gambio Hub. If it shows something else, run the SQL commands from step 3 again. For test orders, use payment methods without the Hub, for example Prepayment or Invoice.

If you want to use payment methods of the Gambio Hub in the test shop, you need a separate contract for the test shop. You cannot use the settings or the shop key of your live shop for this. In this case, contact Gambio Support.

Turn off sending emails

Open Settings > My Shop, select the System category and turn off the Send E-mails option under Email Options. Then click Save.

Attention

This option only stops the automatic system emails, for example the order confirmation and the account creation email. Emails that you trigger yourself are still sent. This applies, for example, to status changes of an order with the Notify customer option enabled. Therefore only edit orders of your own test customers in the test shop.

Deactivate scheduled tasks

Open Toolbox > Scheduled tasks and deactivate all tasks marked as active. To do this, click the pencil icon of each task. Tasks that talk to other systems are especially important, for example the Afterbuy synchronization or the legal texts update.

Also, do not create any cron jobs for the test shop at your hosting provider. The existing cron jobs of your live shop stay unchanged.

Check interfaces and payment methods

Go through the modules that are connected to external services, and deactivate them in the test shop or switch them to a test mode if the module offers one. Typical examples:

  • Merchandise management and marketplaces, for example Afterbuy, magnalister or JTL-Wawi
  • Payment methods with their own credentials outside the Gambio Hub
  • Legal text interfaces, for example IT-Recht Kanzlei or Händlerbund
  • Review and trust seal services, for example Trusted Shops
  • Newsletter services, price comparison portals and exports, for example Google Shopping or idealo

Attention

These services are connected with the same credentials as your live shop. An active synchronization from the test shop can transfer orders twice, overwrite stock levels or notify customers. Separate the test shop only by deactivating the module. Do not log out of the external service and do not revoke credentials there, otherwise this also affects your live shop.

Set the test shop offline

Open Content > Shop online/offline, set Actual Shopstatus to Off and click Save. Visitors then only see the offline page. As long as you are logged in as an administrator, you can use and test the shop as usual.

Step 8: Register the test shop in the customer portal

In the Gambio customer portal you can store your test shop with its own access data alongside your live shop. The test shop is fully covered by Support. When you create a support request, you can then select the test shop directly, and Support has all access data at hand right away without having to ask you for it.

  1. Log in to the Gambio customer portal and edit your shop under Shops. You see two tabs: one for your live shop (Produktiver Shop) and one for your test shop (Shop in Testumgebung)
  2. Switch to the test environment tab (Shop in Testumgebung)
  3. Enter the name, address and shop version of the test shop as well as the access data for the Gambio Admin, FTP, database and directory protection. You can also add other notes about the test shop there. The more information is stored, the faster Support can handle your request
  4. Click Save

Step 9: Check the test shop

Finally, check that the test shop is set up correctly:

  • When you open test.your-shop.com, the browser asks for the password of the directory protection
  • Without an admin login, the offline page appears
  • Start page, categories, products and images are displayed correctly
  • Links and buttons lead to test.your-shop.com, not to your live shop
  • The Gambio Admin shows HUB disconnected at the bottom, and the Shop-Key field is empty
  • A test order with prepayment can be completed, and no email is sent
  • Nothing has changed in your live shop: the Hub is connected and your payment methods work

Note

Fixed links in your content, for example in the Content Manager or in banners, still point to your live shop. This is normal and has no effect on the live shop.

Updating or deleting the test shop

Updating: To bring the test shop up to the current state of your live shop, repeat steps 2 to 7. Empty the test database beforehand (select all tables of the test database in phpMyAdmin and drop them) and overwrite the files in the test directory.

Deleting: When you no longer need the test shop, delete it completely. It contains personal data of your customers that should not be stored longer than necessary:

  1. Delete the directory of the test shop
  2. Delete the test database and the associated database user
  3. Delete the subdomain and the directory protection
  4. Remove the test shop in the Gambio customer portal

Common problems

Problem Possible cause and solution
The test shop redirects to the live shop Address not changed in one of the four configuration files, or a redirect in the .htaccess file is active (see step 4). Then clear your browser cache
White page or error 500 Empty the cache directory and check the write permissions (see steps 2 and 6). Also check whether the PHP version matches the shop version
Message that no connection to the database is possible Check the access data in the define_database( block. Look out for typos and spaces
Product images are missing The images directory was not copied completely. Copy it again
Logging in to the admin does not work Delete the browser cookies for the test address and log in again
Import in phpMyAdmin aborts File too large. Export compressed or ask your hosting provider for help
The admin shows a notice about writable configuration files Set the file permissions of the four configuration files back to 444

For advanced users: copying via SSH

If your hosting provider offers SSH access, copying is much faster. Replace paths, users and database names with your own values. Your live shop stays unchanged.

# Copy files (including hidden files and file permissions)
cp -a /path/to/liveshop/. /path/to/testshop/

# Export the live database
mysqldump --single-transaction -u LIVE_USER -p LIVE_DATABASE > live.sql

# Import into the test database, then delete the file
mysql -u TEST_USER -p TEST_DATABASE < live.sql
rm live.sql

Then run the SQL commands from step 3 to remove the shop key and Hub connection, and continue with step 4.