Support Center

Connecting to Swisscart

Follow

 

Swisscart is available as a shopping cart system at Shopgate.

By setting up the Shopgate plugin for your Swisscart shop, you will get these wonderful features straight into your mobile shop and apps:

Support

Version

 

4

Import to Swisscart

Orders

 

Customer Account

Login with Desktop Shop Account
Login to Desktop Shop with Mobile Account
Customer Groups / Tier Pricing
Show Desktop Orders On Mobile

 



✘ / ✘

Export to Shopgate Mobile Shop

Products
Categories
Reviews

 



Sync

Delivery Status "Shipped"
Order Status "Canceled"
Stock Quantity, on Product Detail Page

 



Validate, upon Cart Changes

Coupon
Shipping Method & Price
Product Availability

 



Payments Supported

N/A

Notes

N/A

 

In this article, you will find the instructions to set up the Shopgate plugin for your shop with Swisscart.

 

Topics covered in this article:

  1. Installing the Shopgate Plugin
  2. Establishing connection between plugin and Shopgate
  3. Updating an existing Shopgate plugin
  4. Configuring the Plugin

 

1. Installing the Shopgate plugin

The Shopgate plugin for Swisscart can be installed in all Swisscart shops starting from version 4.0. Simply upload the plugin to your Swisscart folder and activate it in your Swisscart admin page. To do this, please follow the steps below:

1.1 Downloading the plugin

Download the latest plugin via this link: http://files.shopgate.com/plugins/oscommerce.zip (this is the same plugin as osCommerce) and extract the contents of the zip file.

 

1.2 Uploading the plugin

You need an FTP client tool to copy the plugin into your Swisscart shop's root directory. Plenty of FTP programs can be found on the internet. If you don’t know which one to use, we recommend FileZilla. (Link to download FileZilla)

  1. Connect FileZilla or another FTP program to your server.
  2. Navigate to the Shopgate plugin you just extracted from the previous step. Mark the files and drag them to your shop's main directory. When asked, choose to overwrite files and folders.

 

1.3 Setting permissions

Set permissions for the folders config and temp that are located in ext/modules/shopgate/shopgate_library to readable and writeable (774*). Check all checkboxes in the pop-up, and choose "Apply to all files and directories". Click OK.

* If you cannot save your changes or configurations, set file permissions to 777.

 

1.4 Modifying the codes

In order for the Shopgate plugin to work in your Swisscart system, a few lines of codes need to be added to 9 files in your Swisscart backend. For detailed descriptions on how to modify codes in your shop's backend folders, click here.

Please modify all files listed below. Copy the marked codes, and paste them at the corresponding lines in your file. Line numbers in the following code snippets, however, refer to an "unmodified" version of files. If you already modified your files, the line numbers may vary. Only the highlighted parts need to be added into the files.

The paths are relative to your shop’s base folder. E.g. if your Swisscart has been installed at /public_html/catalog/, then the path of includes/filenames.php refers to /public_html/catalog/includes/filename.php.

Also keep in mind that the default folder name admin is used below. If you have renamed your admin folder, please locate the files in that directory.

 

----------------------------------- file 1 -----------------------------------

File: includes/filenames.php

define('FILENAME_SHOPPING_CART', 'shopping_cart.php');
define('FILENAME_SPECIALS', 'specials.php');
define('FILENAME_SSL_CHECK', 'ssl_check.php');
define('FILENAME_TELL_A_FRIEND', 'tell_a_friend.php');
define('FILENAME_UPCOMING_PRODUCTS', 'upcoming_products.php');

/******** SHOPGATE **********/
define('FILENAME_SHOPGATE', 'shopgate.php');
/******** SHOPGATE **********/

 

----------------------------------- file 2 -----------------------------------

File: admin/includes/filenames.php

define('FILENAME_TAX_CLASSES', 'tax_classes.php');
define('FILENAME_TAX_RATES', 'tax_rates.php');
define('FILENAME_VERSION_CHECK', 'version_check.php');
define('FILENAME_WHOS_ONLINE', 'whos_online.php');
define('FILENAME_ZONES', 'zones.php');

/******** SHOPGATE **********/
define('FILENAME_SHOPGATE', 'shopgate.php');
/******** SHOPGATE **********/

 

----------------------------------- file 3 -----------------------------------

File: admin/includes/column_left.php

if (tep_session_is_registered('admin')) {
$cl_box_groups = array();

include(DIR_WS_BOXES . 'configuration.php');
include(DIR_WS_BOXES . 'catalog.php');
include(DIR_WS_BOXES . 'modules.php');
include(DIR_WS_BOXES . 'customers.php');
include(DIR_WS_BOXES . 'taxes.php');
include(DIR_WS_BOXES . 'localization.php');
/******** SHOPGATE **********/
include(DIR_WS_BOXES . 'shopgate.php');
/******** SHOPGATE **********/
include(DIR_WS_BOXES . 'reports.php');
include(DIR_WS_BOXES . 'tools.php');

 

----------------------------------- file 4 -----------------------------------

File: admin/includes/languages/english.php

define('ERROR_DESTINATION_DOES_NOT_EXIST', 'Error: Destination does not exist.');
define('ERROR_DESTINATION_NOT_WRITEABLE', 'Error: Destination not writeable.');
define('ERROR_FILE_NOT_SAVED', 'Error: File upload not saved.');
define('ERROR_FILETYPE_NOT_ALLOWED', 'Error: File upload type not allowed.');
define('SUCCESS_FILE_SAVED_SUCCESSFULLY', 'Success: File upload saved successfully.');
define('WARNING_NO_FILE_UPLOADED', 'Warning: No file uploaded.');

/******** SHOPGATE **********/
include(DIR_FS_CATALOG . "ext/modules/shopgate/base/admin/includes/languages/english.php");
/******** SHOPGATE **********/

 

----------------------------------- file 5 -----------------------------------

File: admin/orders.php

if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {
tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");

$customer_notified = '0';
if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
$notify_comments = '';
if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {
$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
}

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

$customer_notified = '1';
}

tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')");

/******** SHOPGATE **********/
include(DIR_FS_CATALOG . "ext/modules/shopgate/base/admin/orders.php");
onUpdateOrdersStatus($oID, $status);
/******** SHOPGATE **********/

$order_updated = true;
}

 

----------------------------------- file 6 -----------------------------------

File: admin/includes/functions/general.php

function tep_remove_order($order_id, $restock = false) {
if ($restock == 'on') {
$order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
while ($order = tep_db_fetch_array($order_query)) {
tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . (int)$order['products_id'] . "'");
}
}

tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "'");
tep_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order_id . "'");
tep_db_query("delete from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "'");
/******** SHOPGATE **********/
include(DIR_FS_CATALOG . "ext/modules/shopgate/plugin.php");
tep_db_query("delete from " . TABLE_ORDERS_SHOPGATE_ORDER . " where orders_id = '" . (int)$order_id . "'");
/******** SHOPGATE **********/
}

 

----------------------------------- file 7 -----------------------------------

File: includes/application_top.php

 // initialize the message stack for output messages
require(DIR_WS_CLASSES . 'message_stack.php');
$messageStack = new messageStack;

/******* SHOPGATE **********/
include_once DIR_FS_CATALOG.'ext/modules/shopgate/base/includes/application_top.php';
/******* SHOPGATE **********/

 

----------------------------------- file 8 -----------------------------------

File: includes/template_top

<script type="text/javascript" src="ext/jquery/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="ext/960gs/<?php echo ((stripos(HTML_PARAMS, 'dir="rtl"') !== false) ? 'rtl_' : ''); ?>960_24_col.css" />
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<?php echo $oscTemplate->getBlocks('header_tags'); ?>
<?php
/******** SHOPGATE **********/
echo $shopgateJsHeader."\n";
/******** SHOPGATE **********/
?>
</head>
<body>

 

----------------------------------- file 9 -----------------------------------

File: includes/languages/english.php

define('TEXT_CCVAL_ERROR_INVALID_DATE', 'The expiry date entered for the credit card is invalid. Please check the date and try again.');
define('TEXT_CCVAL_ERROR_INVALID_NUMBER', 'The credit card number entered is invalid. Please check the number and try again.');
define('TEXT_CCVAL_ERROR_UNKNOWN_CARD', 'The first four digits of the number entered are: %s. If that number is correct, we do not accept that type of credit card. If it is wrong, please try again.');

define('FOOTER_TEXT_BODY', 'Copyright © ' . date('Y') . ' ' . STORE_NAME . '
Powered by osCommerce');

/******* SHOPGATE **********/
include_once DIR_FS_CATALOG.'ext/modules/shopgate/base/includes/languages/english.php';
/******* SHOPGATE **********/
?>

 

1.5 Installing the plugin

  1. Log in to your shop’s backend.

  2. Navigate to Modules > Payment in the left menu bar, locate Shopgate in the list, and click + Install button on the right.



  3. If installed correctly, the Shopgate plugin should now be listed on the menu bar on top. If you don't see it right away, reload the page. Your plugin is now installed successfully in your Swisscart backend.

  4. Click on Shopgate > Installation aid on the menu bar to open the settings page (shown below) for the Shopgate plugin. Leave this page open - we will explain how to find the required info in the next chapters.

 

2. Establishing connections between the plugin and Shopgate

After the Shopgate plugin has been installed successfully, two simple tasks need to be done to connect your mobile shop at Shopgate to your shop's backend: to enter API credentials in your shop's backend, and to enter your shop's URL in your Shopgate's admin page.

2.1 Getting API credentials

  1. Log in to your Shopgate Admin page. If you don’t have an account yet, sign up for free now.

  2. Click on Integration from the menu bar, then select Install Interface.



  3. In the drop-down labeled Select system, type Swisscart and select it.



  4. A popup opens. Look for Customer number, Shop number, API key, and Alias under 2. Configure. These are the API credentials the plugin needs to authenticate at the Shopgate backend. Leave this page open - we will come back to enter the URL (explained in 2.2 Establishing connection)



  5. Copy Customer number, Shop number, API key, and Alias, and paste them individually onto the plugin configuration page you left open from the last chapter. The rest of the options can be configured later (Explained in Chapter 4. Configuring the Plugin). Click Save.


 

2.2 Connecting your shop to Shopgate

  1. Go back to the pop-up window at your Shopgate merchant page (step 4). Enter your shop's URL to the text field under 3. Enter URL. Click connect to establish the interface.



  2. If a connection is made successfully, a popup shown below will open. Here you will be able to assign jobs for your first connection. We recommend to leave all assignments to ON at this time. Click Save.



  3. Congratulations! Now you should see the progress bar running, and the Shopgate backend automatically filling your mobile shop with your products. Depending on how many products you have, the import process can take anywhere from a few minutes to a few hours. You can always check the status of the imports. If no status bar is shown, it means either the import is finished, or no import is running at the moment.

    Welcome to the mobile world :)

 

3. Updating an existing Shopgate plugin

3.1 Deactivating the plugin

Log in to your shop’s backend. Navigate to Modules > Payment in the left menu bar. Find Shopgate in the list of modules, and click - Remove button on the right.

3.2 Backing up the plugin

Use an FTP tool like FileZilla to back up your installation of the plugin. Back up the folder ext/modules/shopgate by downloading it:




3.3 Deleting the plugin

Use your FTP tool to delete the folder ext/modules/shopgate: Right click on Shopage folder, click Delete, and click Yes.



3.4 Installing the new version

Please refer to Chapter 1 to learn how to install the latest version of the plugin.

 

4. Configuring the plugin

Find the detailed explanations under each option. Refer to Chapter 1.5.4 to learn where to find the configuration page.

4.1 Connection Settings

Configure your Shopgate credentials. Those are needed in order to connect to Shopgate.

  1. Module type
    Choose “Non US” if you’re on a market with fixed tax rates, as most countries in Europe. Choose “US” if you’re on a market with tax rates depending on where your shop is located and where customers are located.
  2. Customer number
    Your customer number at Shopgate.
  3. Shop number
    Your shop’s number at Shopgate.
  4. API key
    Your API key assigned by Shopgate.

 

4.2 Mobile Redirect

Set up your mobile website and redirect.

  1. Shop alias
    The alias is the subdomain of shopgate.com, e.g. myshop.shopgate.com, where your mobile website can be found. This is used as a fallback if no CNAME is configured.
  2. Custom URL to mobile webpage (CNAME)
    A CNAME is a subdomain of your own domain that points to your mobile website. Usually that’s something like m.myawesomeshop.com. You’ll have to configure this on your server.
  3. Redirected languages
    Select the languages the redirect to the mobile website should be active for.

 

4.3 Exporting Categories and Products

Choose how your products should be exported.

  1. Language
    Choose the language the products should be exported in.
  2. Currency
    Choose the currency your products should be exported in.
  3. Country
    Choose the country your products should be exported for.
  4. Tax zone for Shopgate
    Select the tax zone products should be exported.

4.4 Importing Orders

Configure how orders are imported into your shop.

  1. Shipping not blocked
    Set the status to be assigned on incoming Shopgate orders that are not blocked for shipping.
  2. Shipping blocked
    Set the status to be assigned on incoming Shopgate orders that are blocked for shipping.
  3. Shipped
    Select the status you set on orders that have been shipped. This is used to synchronize the shipping status of orders with Shopgate.
  4. Cancelled
    Select the status you set on orders that have been cancelled. This is used to synchronize the cancellation status of orders with Shopgate.

 

4.5 System Settings

These are debug settings that are usually only used on test and development systems or for compatibility reasons.

  1. Shop system encoding
    Choose the encoding of your system. Swisscart uses ISO-8859-15 by default. If you modified your shop you might need to choose a different encoding instead.
  2. Shopgate server
    Choose between the “Live” or the “Playground” Shopgate servers for API communication. Alternatively you can provide a “Custom” Shopgate API URL.
  3. Custom Shopgate server URL
    If you chose “Custom” in the dropdown menu box above, provide a custom URL to the Shopgate API here.

 

Comments