1.3 PHP MySQL Bridge Connection

fmPreferences - fmBridgeConnection

This section describes how to setup Bridge connection in Store Manager for PrestaShop.

Bridge Connection is the most convenient type of connection in complicated cases. This type of connection is useful when you have issues with direct access to a store’s database.

Advantages:

Disadvantages:

A bridge is just another way to connect to your PrestaShop database. Normally program uses the direct MySQL connection to a remote database installed on the website or some other web server. In some cases this type of connection does not work - your hosting provider may not allow direct connections or your LAN settings/firewall prevent the connection from being established. The bridge allows you to work with the remote database without a direct MySQL connection established.

While working through the bridge you must store your temporary data somewhere in the local database. Bridge.php is used only for two major operations - get data from a remote database and post data to that database. You must understand the difference between a bridge connection and a direct MySQL connection. Bridge.php is not a connection itself, actually, this is just a way to transfer data between remote and local machines and nothing else.

To configure PHP MySQL bridge connection, follow few steps:

1. Download the latest version of PHP MySQL Bridge here (recommended) or open your application main directory - usually, it is "C:\Program Files(x86)\eMagicOne\Store Manager for PrestaShop " and find directory "Service" there. Inside this directory, you can find the bridge.php file.

Warning!

Please make sure that you are using the latest version of PrestaShopAND Store Manager for PrestaShop software before you proceed with bridge.php file installation and configuration. You should have the version of Store Manager that supports the appropriate version of Shopping cart and the bridge.php file. The support of PrestaShop versions can be found at:
https://www.prestashopmanager.com/discover-the-latest-updates-of-store-manager-for-prestashop/

Before you proceed, backup your old bridge file in order to be able to roll back in case needed.

2. Important. Edit bridge.php file

Attention! We strongly recommended changing the default username and password (default username and password are 1) to keep your store protected!

Open bridge.php file (you can open it using NotePad or WordPad) and find the following lines there:

$username = "1";

$password = "1";

Put your own values instead of "1" in both lines and save the updates. 

 Also here you can find how you can make Bridge connection more secure.

You may keep all other settings as they are unless you have any errors.

3. Copy bridge to your online store root (catalog) directory. A bridge should be accessible as: https://www.onlinestore.com/bridge.php whereas your store link is: https://www.onlinestore.com.

4. Open Store Manager -> Tools -> Preferences (F12) - > Advanced mode - > Show more settings and enable PHP MySQL bridge connection checkbox.

5. Specify the following PHP MySQL Bridge and Local Database Connection Settings:

Tip: Use the Bridge.php Self Test tool to check your website and to make sure there are no issues in your hosting configuration. Your hosting support can solve all problems found there.

Tip: Use the [Test PHP Bridge Connection] button to verify if all settings are correct. 

6. Click [OK] to save this entry, close "Preferences" and connect to your local database, or click Cancel to discard this entry.

Also, you can use Database Connection Wizard to set up your connection

7. Now you have to retrieve data from your web store into your local database.

Go to Tools -> Get Data from Web (CTRL + G). Wait while data is transferred. Depending on database size and connection speed, it may take from few seconds to several hours (large database + slow connection). 

"Get Data from Web" means each time you start working in Store Manager you should launch the corresponding command from the top toolbar:

or press the following hotkeys Ctrl+G simultaneously; and allows retrieving data from the database, which is placed remotely (somewhere locally).

Afterward, you get the actual store's database.

Note: It is strongly recommended to make a full database backup before you proceed. You can make a backup using Tools ->  Database Backup/Restore wizard.

Follow a few steps of Backup/Restore wizard. Now you may work with your data - add/modify products, categories, import products etc.

8. It is important to post all changes that you have made to your remote database to see them at your online store. Select Tools -> Post Changes to Web (CTRL + P)

"Post Data to Web" serves for data synchronization. It allows all changes, modifications, and updates that were made from one location uploading (synchronizing with) to the direct database and reflecting them at the store.

Take a note, Store Manager doesn't overwrite the data from the database and doesn't erase any other information. It only posts the data that has been changed or modified and not rewrite any field of the database.

This action will post all commands stored in Pending Bridge Data section to bridge.php installed on your store. When Bridge receives the file, it executes all commands one by one in order as they were stored/made locally. 

After all commands are executed successfully, your remote store will reflect all changes you made locally.

Also, you can Clear all Changes (will clear all commands) made locally before posting, if you do not want them to be applied to your remote database.

Pay attention that you won't be able to undo this action.

9. Check, whether all changes you made were reflected on web store properly.

Note: It is strongly recommended to create a database backup before any mass operations which may be potentially unsafe.

Check the following guide about this type of connection: