Cart Integration SDK
The Shopgate Cart Integration SDK is a compilation of classes to manage the communication between your shop system and Shopgate via the Shopgate Plugin API and the Shopgate Merchant API. The SDK provides methods for processing incoming and outgoing requests, configuration options and for handling errors. The SDK also offers container classes, which allow easy storage of order data, among other things. Better like to start coding immediately? Have a look at the sample plugin code and get going! You’re welcome to check back here anytime.
The most important functions are:
- Shopgate Plugin API, i.e. the communication interface for Shopgate
- implementation of the Shopgate Merchant API communication for your order management
- workflow mapping (data export, order import, etc.)
- an easy-to-use interface
Download
Section titled “Download”Requirements
Section titled “Requirements”Following requirements must be met in order to use the Shopgate Cart Integration SDK:
- PHP version >= 5.2
- The PHP max_execution_time setting must be at least 10 seconds (depending on the number of products).
- The PHP memory_limit setting must be at least 20 MB (depending on the number of products).
- The CURL library for PHP must be installed in order to send requests to the Shopgate Merchant API.
Layout for the Plugin
Section titled “Layout for the Plugin”See chapter “Incoming Requests” to learn how calls to the Shopgate Plugin API can be dispatched to your plugin. Your plugin class extends the ShopgatePlugin class of the SDK and must implement its abstract callback methods. Use the PHP constant SHOPGATE_PLUGIN_VERSION to store the current versions number of your plugin in the 2.x.x format. The first two numbers must be identical with the version number of the Shopgate Library you are using.
Get the full plugin example code or have a look at the short example for a plugin class:
Example ShopgatePlugin Class
Section titled “Example ShopgatePlugin Class” <?phprequire_once(dirname(__FILE__).'/vendor/shopgate/cart-integration-sdk/shopgate.php'); // adjust this path to your environmentdefine('SHOPGATE_PLUGIN_VERSION', '2.9.0');
class ShopgatePluginMyShopSystem extends ShopgatePlugin { public function startup() { // ... }
public function getCustomer($user, $pass) { // ... }
public function registerCustomer($user, $pass, ShopgateCustomer $customer){ // ... }
public function addOrder(ShopgateOrder $order) { // ... }
public function updateOrder(ShopgateOrder $order) { // ... }
public function getOrders($customerToken, $customerLanguage, $limit = 10, $offset = 0, $orderDateFrom = '', $sortOrder = 'created_desc') { // ... }
protected function createItems($limit = null, $offset = null, array $uids = array()) { // ... }
protected function createReviews($limit = null, $offset = null, array $uids = array()) { // ... }
protected function createCategories($limit = null, $offset = null, array $uids = array()) { // ... }
public function cron($jobname, $params, &$message, &$errorcount) { // ... }
public function checkCart(ShopgateCart $shopgateCart) { // ... }
public function checkStock(ShopgateCart $shopgateCart) { // ... }
public function getSettings() { // ... }
public function syncFavouriteList($customerToken, $items) { // ... }}Configuration
Section titled “Configuration”Using the components of the Shopgate Cart Integration SDK depends on configuration settings in many parts. The class ShopgateConfig is responsible for loading and saving these. Advanced Implementation
To get all out of the new ShopgateConfig class you can extend it in order to add own validation rules, override the loading and saving procedures (e.g. to implement saving into a database instead of the file system) or define new default values.
A detailed description and examples can be found in the section Configuration-Details. Quick Implementation
Create a file called myconfig.php inside the Shopgate Cart Integration SDK’s config folder and define the $shopgate_config variable with your settings as shown below:
Example myconfig.php
Section titled “Example myconfig.php”<?php$shopgate_config = array ( 'customer_number' => '123456789', 'shop_number' => '11223', 'apikey' => '90d36a7cb029b23c21f5', 'alias' => 'myshop', 'cname' => '', 'server' => 'live', 'encoding' => 'UTF-8', 'plugin' => 'MyShoppingSystem', 'enable_ping' => '1');Incoming Requests
Section titled “Incoming Requests”The starting point for requests of the Shopgate Plugin API depends on the shopping system. The starting point can be an independent script (e.g. api.php), a controller of the shop system, a hook point or something similar. Parameters are transmitted via POST. To receive GET parameters please contact out tech support.
<?php### Simple initialization ###require_once(dirname(__FILE__).'/plugin.php'); // adapt path to your environment
$plugin = new ShopgatePluginMyShopSystem();$response = $plugin->handleRequest($_POST);
### More complex initialization with own configuration class #### require_once(dirname(__FILE__).'/plugin.php'); // adapt path to your environment## $config = new ShopgateConfigMyShopSystem();# $builder = new ShopgateBuilder($config, $_REQUEST);# $plugin = new ShopgatePluginMyShopSystem($builder);# $plugin->handleRequest($_POST);?>⚠ Note: Some requests, e.g. get_items, stop the execution of the script after the data file has been returned.
⚠ Note: Outputting anything before or after the output of the Shopgate Cart Integration SDK can cause script errors or an invalid response to Shopgate.
Outgoing Requests
Section titled “Outgoing Requests”In order to send a request, use the ShopgateMerchantApi object in your plugin class ($this->merchantApi) and run the required method. Parameters and response values can be found in the API documentation.
API methods will throw a ShopgateMerchantApiException or ShopgateLibraryException in case of an error. Errors at critical points (e.g. during the checkout process or while editing an order) must not abort the script execution in any case. Errors of that kind only need to be logged.
<?phprequire_once(dirname(__FILE__).'/vendor/shopgate/cart-integration-sdk/shopgate.php'); // Modify this path correspondinglydefine('SHOPGATE_PLUGIN_VERSION', '2.9.0');
class ShopgatePluginMyShopSystem extends ShopgatePlugin{
// ...
/** * Gets called when an order has been marked as "shipped" in the shop system. * * @param MyShopSystemOrder $shopOrder An object from the shop system which represents an order with your data. */ public function updateOrderStatus(MyShopSystemOrder $shopOrder) { try { $this->merchantApi->addOrderDeliveryNote($shopOrder->orderNumber, $shopOrder->shippingServiceId, $shopOrder->trackingNumber, true); $shopOrder->addComment('Shopgate has marked the order as shipped.');
} catch (ShopgateMerchantApiException $e) { // Do not abort at this point as this would crash editing the order in the shop system's backend. // The ShopgateMerchantApiExceptions are logged automatically.
$shopOrder->addComment('There was an error updating the order at Shopgate.'); } catch (ShopgateLibraryException $e) { // Do not abort at this point as this would crash editing the order in the shop system's backend. // The ShopgateLibraryExceptions are logged automatically.
$shopOrder->addComment('There was an error updating the order at Shopgate.'); } }}Sending requests to the Shopgate Merchant API when the status of an order changes.
<?php require_once(dirname(__FILE__).'/vendor/shopgate/cart-integration-sdk/shopgate.php'); // Modify this path correspondingly define('SHOPGATE_PLUGIN_VERSION', '2.9.0');
// ...
try { // create a new instance of ShopgateBuilder // it will load the configuration file automatically $shopgateBuilder = new ShopgateBuilder();
// get the ShopgateMerchantApi instance from the builder $merchantApi = $shopgateBuilder->buildMerchantApi();
// send requests to the Shopgate Merchant API $orders = $merchantApi->getOrders(array("limit" => 1));
} catch (ShopgateMerchantApiException $e) { // Do not abort at this point as this would crash editing the order in the shop system's backend. // The ShopgateMerchantApiExceptions are logged automatically.
Logger::log($e); } catch (ShopgateLibraryException $e) { // Do not abort at this point as this would crash editing the order in the shop system's backend. // The ShopgateLibraryExceptions are logged automatically.
Logger::log($e); }
// ...Sending requests to the Shopgate Merchant API to fetch one order
Configuration Details
Section titled “Configuration Details”Since version 2.1.0 the Shopgate Library offers a revised version of the ShopgateConfig class with better support for expandability of modules. You can influence the configuration saving and loading behaviour as well as additional settings by deriving your own configuration class, for instance, in order to implement saving the configuration to a database. Better like to start coding immediately? Simply download the sample code and get going! You’re welcome to check back here anytime.
Attribute, Getter & Setter
Section titled “Attribute, Getter & Setter”Configuration settings are saved in class attributes. Access is performed via getter and setter methods. The following conventions apply:
- Class attributes are protected. Do not use private!
- An attribute name consists of lowercase letters and underscores. Example: $enable_mobile_redirect
Names of the getter and setter methods for an attribute must be written in CamelCase. Example:
setEnableMobileRedirect($value),getEnableMobileRedirect() - Attributes representing a configuration setting are initialized in the
startup()method.
Loading & Initializing
Section titled “Loading & Initializing”The following sequence is executed internally when the configuration is initialized:
- Initialization of all attributes in the class ShopgateConfig.
- The
startup()method is called to initialize subclasses. - Loading of the passed array or the file
.../shopgate_library/config/myconfig.php
If you want to implement your own method to load configuration values (e.g. loadDatabase()), you should call them in the startup() method. To keep the class from trying to initialize configuration from a file or through an array, return boolean true.
In order to load the configuration after the initialization, you can call the loadArray() or loadFile() methods at any time later. Their visibility is public.
Saving
Section titled “Saving”The configuration can be saved to a file with the saveFile() method. When doing that, keep in mind:
- Parameter 1 has to contain the list of fields to be saved. If no list is given, nothing will be saved.
- Parameter 2 contains the path to the file in which the configuration should be saved. If this parameter is null the class will try to use the
.../shopgate_library/config/myconfig.phpfile to save the configuration.. - Parameter 3 indicates whether the saved data should (true) or should not (false) be validated.
- The method can throw a
ShopgateLibraryExceptionwhen saving or validation fails. You have to catch it.
You can implement your own method (e.g. saveDatabase()) if you do not want to save the configuration into a file. Your method should also throw a ShopgateLibraryException when errors occur during the saving process, so that they can be logged and displayed to the online shop user.
Validating
Section titled “Validating”For manual validation call the validate() method. You can use the $fieldList parameter with it. If the method does not return anything, the validation is successful. If the validation fails, it throws a ShopgateLibraryException.
Validation rules for the ShopgateConfig class configuration are contained in the $coreValidations attribute as regular expressions.
There are two ways to validate additional fields of your own configuration class:
- Define your own regular expressions in the
$customValidationsattribute. - Implement the
validateCustom()method.
Check the structure of the $coreValidations attribute to learn what the $coreValidations attribute has to look like. If regular expressions are insufficient for your purposes, you can define your own logic in validateCustom(). This method will be called automatically. Your return value must return a list of fields for which the validation failed or an empty array for a successful validation.
Both approaches can be combined.
Examples
Section titled “Examples”The following examples are divided by chapters, but always relate to the same sample class called ShopgateConfigMyShoppingSystem. You can download the complete sample code here.
Attribute, Getter & Setter
Section titled “Attribute, Getter & Setter”The sample class in the listing below creates additional configuration settings and introduces a database connection stored in the $db attribute. The connection will be used in the subsequent examples.
<?phprequire_once(dirname(__FILE__).'/shopgate_library/shopgate.php');class ShopgateConfigMyShoppingSystem extends ShopgateConfig { /** * @var DBConnector */ protected $db;
// additional settings protected $country; protected $language; protected $currency; protected $tax_zone_id; protected $customer_group_id;
public function getCountry() { return $this->country; } public function getLanguage() { return $this->language; } public function getCurrency() { return $this->currency; } public function getCustomerGroupId() { return $this->customer_group_id; }
public function setCountry($value) { $this->country = $value; } public function setLanguage($value) { $this->language = $value; } public function setCurrency($value) { $this->currency = $value; } public function setCustomerGroupId($value) { $this->customer_group_id = $value; }}Initializing
Section titled “Initializing”The startup() method in the following listing is an example to illustrate:
- Adding regular expressions for validation.
- Overwriting standard settings of the ShopgateConfig class.
- Initialization of the standard values for new settings.
- Loading the configuration through a custom method.
- Prevent further initialization of the ShopgateConfig class’ default routines by returning true.
<?phppublic function startup() { // custom validation rules: $this->customValidations = array( 'country' => '/[A-Z]{2}/', // 2 characters, only uppercase letters 'language' => '/[a-z]{2}/', // 2 characters, only lowercase letters );
// overwrite some default library settings $this->plugin_name = 'My Shopping System'; $this->enable_redirect_keyword_update = 1; $this->enable_ping = 1; $this->enable_add_order = 1; $this->enable_update_order = 1; $this->enable_get_orders = 0; $this->enable_get_customer = 1; /* ... */ $this->encoding = 'ISO-8859-15';
// initialize own settings $this->country = 'US'; $this->language = 'en'; $this->currency = 'USD'; $this->customer_group_id = 2;
// load configuration from the database try { $this->loadDatabase(); } catch (ShopgateLibraryException $e) { // do not interrupt the initialization, errors will be logged automatically }
// prevent the default initialization routine to be executed return true;}Loading
Section titled “Loading”The loadDatabase() method in the listing below is an example to illustrate:
- Initialization of the database connection (method initDatabase()).
- Loading the configuration from the database as a JSON string.
- Initialization with the values from the decoded JSON array.
- Appropriate error handling.
⚠ Attention: The
ShopgateLibraryExceptionalways needs to be caught in the front-end of the online shop when this method is called.
<?php/** * Initializes the database connection if not done yet. * * @throws Exception in case an error occurs. */protected function initDatabase() { if (empty($this->db)) { $this->db = new DBConnector(); $this->db->connect(); }}
/** * Loads the configuration from the database. * * @throws ShopgateLibraryException in case an error occurs. */public function loadDatabase() { try { $this->initDatabase(); $config = $this->jsonDecode($this->db->loadConfig('shopgate'), true); $this->loadArray($config); } catch (Exception $e) { throw new ShopgateLibraryException(ShopgateLibraryException::CONFIG_READ_WRITE_ERROR, $e->getMessage()); }}Saving
Section titled “Saving”The saveDatabase() method in the listing below is an example to illustrate:
- Validation of the configuration values to be saved.
- Initialization of the database connection (method initDatabase()).
- Conversion of the configuration into an array with toArray() and encoding it in JSON notation.
- Saving the created JSON string into the database.
- Appropriate error handling.
⚠ Attention: The
ShopgateLibraryExceptionalways needs to be caught in the front-end of the online shop when this method is called.
<?php/*** Initializes the database connection if not done yet.** @throws Exception in case an error occurs.*/protected function initDatabase() { if (empty($this->db)) { $this->db = new DBConnector(); $this->db->connect(); }}
/*** Saves the configuration into the database as a JSON string.** @param string[] $fieldList The list of fields to be saved.* @param bool $validate True to validate the fields to be saved.* @throws ShopgateLibraryException in case of failed validation or when an error occurred while saving.*/public function saveDatabase($fieldList, $validate = true) { if ($validate) { $this->validate($fieldList); }
try { $this->initDatabase(); $config = $this->jsonEncode($this->toArray()); $this->db->saveConfig('shopgate', $config); } catch (Exception $e) { throw new ShopgateLibraryException(ShopgateLibraryException::CONFIG_READ_WRITE_ERROR, $e->getMessage()); }}Validating
Section titled “Validating”Regular expressions contained in the $customValidations attribute will automatically be applied when the validate() method gets called. The following method can be used for validations that cannot be covered by regular expressions, or when you want to avoid using regular expressions.
The validateCustom() method in the following listing is an example to illustrate:
- Going through the list of fields to be validated.
- A sample validation of the
$currencyand$customer_group_idsettings. - Returning names of the fields that failed validation or an empty array if validation was okay.
⚠ Attention: This method is automatically called with the
validate()method. There is no need to call it separately.
<?phpprotected function validateCustom(array $fieldList = array()) { $failedFields = array();
foreach ($fieldList as $fieldName) { switch ($fieldName) { case 'currency': // must be one of "EUR", "USD" or "GBP" if (!in_array($this->$fieldName, array('EUR', 'USD', 'GBP'))) { $failedFields[] = $fieldName; } break; case 'customer_group_id': // must be numeric if (!is_numeric($this->fieldName)) { $failedFields[] = $fieldName; } break; } }
return $failedFields;}Updating to a New Version
Section titled “Updating to a New Version”Updating from 2.8.x to 2.9.x
Section titled “Updating from 2.8.x to 2.9.x”- New method createReviews() The new method createReviews() representing the export of product reviews in the XML format needs to be implemented in your plugin.
- New export model Shopgate_Model_Review Use the new export model Shopgate_Model_Catalog_Review to export product reviews in the Shopgate XML format.
Updating from 2.7.x to 2.8.x
Section titled “Updating from 2.7.x to 2.8.x”- New method syncFavouriteList() The new method syncFavouriteList()representing the synchronization of a favourites list with Shopgate needs to be implemented in your plugin.
- New method getOrders() The new method getOrders() representing the export of orders to Shopgate needs to be implemented in your plugin.
Updating from 2.6.x to 2.7.x
Section titled “Updating from 2.6.x to 2.7.x”- ShopgateAuthentificationService replaced by two new classes This is most likely not relevant to you. Try a “ping” from admin.shopgate.com to your interface and try importing an order. If that still works, ignore this.
The class ShopgateAuthentificationService is now named ShopgateAuthenticationServiceShopgate. The class ShopgateAuthenticationServiceOAuth was added for a state-of-the-art oAuth2 authentication process.
- ShopgateAuthentificationServiceInterface has been renamed The interface ShopgateAuthentificationServiceInterface has been renamed to ShopgateAuthenticationServiceInterface.
Updating from 2.5.x to 2.6.x
Section titled “Updating from 2.5.x to 2.6.x”- New method createCategories() The new method createCategories() representing XML export for categories needs to be implemented.
- New method createItems() The new method createItems() representing XML export for products needs to be implemented.
Updating from 2.4.x to 2.5.x
Section titled “Updating from 2.4.x to 2.5.x”- New method createMediaCsv() The new method createMediaCsv() representing the get_media_csv Method of the Shopgate Plugin API must be implemented.
- New method checkStock()() The new method checkStock() representing the check_stock Method of the Shopgate Plugin API must be implemented.
Updating from 2.3.x to 2.4.x
Section titled “Updating from 2.3.x to 2.4.x”- New method registerCustomer($user, $pass, ShopgateCustomer $customer) The new method registerCustomer($user, $pass, ShopgateCustomer $customer) representing the register_customer Method of the Shopgate Plugin API must be implemented.
Updating from 2.2.x to 2.3.x
Section titled “Updating from 2.2.x to 2.3.x”- New method getSettings() The new method getSettings() representing the get_settings action of the Shopgate Plugin API must be implemented.
- Changed default behaviour of ShopgateMerchantApi::addOrderDeliveryNote() The method’s fifth parameter $sendCustomerMail now defaults to false! If you want an email to be sent to the customer by Shopgate this needs to be manually set to true now.
Mobile Redirect
Section titled “Mobile Redirect”Shopgate_Helper_Redirect_MobileRedirect
Section titled “Shopgate_Helper_Redirect_MobileRedirect”The Shopgate Library offers a class which already implements the mobile redirect with the HTTP header functionality in PHP.
⚠ Important: There should not be any output before the header, or the redirect will fail.
Redirecting Types
Section titled “Redirecting Types”After setting the redirect target, you can call the appropriate method. For every redirecting type there is a method that instantly redirects the user if applicable (is using a smartphone, did not come back from the mobile website, …) or builds the Mobile Header and SEO optimized HTML tags (see below).
buildScriptShop()Redirecting to the Mobile Website homepage. If there is no mobile request, it returns the Mobile Header.buildScriptItem($itemNumber)Redirecting to a product on the Mobile Website by using the passed $itemNumber. If there is no mobile request, it returns the Mobile Header. The item number from the online shop is used as the parameter here.buildScriptItemPublic($itemNumberPublic)Redirecting to a product on the Mobile Website by using the passed $itemNumberPublic . If there is no mobile request, it returns the Mobile Header. The item number public from the online shop is used as the parameter here.buildScriptCategory($categoryNumber)Redirecting to a category on the Mobile Website. If there is no mobile request, it returns the Mobile Header. A category number from the online shop is used as the parameter here.buildScriptBrand($brandName)Redirecting to a brand on the Mobile Website. If there is no mobile request, it returns the Mobile Header. The name of the required brand is used as the parameter here.buildScriptSearch($searchQuery)Redirecting to a search for a product on the Mobile Website. If there is no mobile request, it returns the Mobile Header.The search term is used as the parameter here.buildScriptCms($cmsPage)Redirecting to a user-defined page on the Mobile Website. If there is no mobile request, it returns the Mobile Header. The internal name of the user-defined site is used as the parameter here.
Mobile Header and Meta Tags
Section titled “Mobile Header and Meta Tags”When a smartphone user returns to the desktop site, the Mobile Header must be displayed so the user can easily switch back to the mobile website. Additionally a bunch of HTML meta tags must be displayed to hint search engine crawlers to the deeplinks on the mobile website and in the native apps, if available.
The JavaScript code and markup for this is returned by the buildScript*() methods explained above. It just needs to be inserted into an appropriate place in your template, view or layout.
<head> ... <?php echo $shopgateJsHeader; ?> ...</head>Open Graph Tags
Section titled “Open Graph Tags”On top of the Mobile Header and SEO meta tags Shopgate offers the integration of Open Graph tags introduced by Facebook back in 2010. These are used to give social integrations more detailed information about a web site. If enabled, the tags are generated by the buildScript*() methods mentioned above along with the Mobile Header and meta tags.
Most of the Open Graph tags need parameters to be set or otherwise they won’t be generated. To set a parameter, use the method addSiteParameter($name, $value).
Valid values for $name can be found in the Shopgate_Helper_Redirect_TagsGeneratorInterface:: SITE_PARAMETER_* constants. Please also see the list of all currently supported parameters.
Sample Application
Section titled “Sample Application”The sample application of the class illustrates redirecting to the homepage and to the product and category levels.
<?phpuse Shopgate_Helper_Redirect_TagsGeneratorInterface as TagsGenerator;
$shopgateJsHeader = '';
### A method to check if the Shopgate Plugin is activeif ($shopgatePlugin->isActive()) { include_once DIR_FS_CATALOG.'/shopgate/shopgate_library/shopgate.php';
// only if you use your own extended ShopgateConfig class include_once DIR_FS_CATALOG.'/shopgate/my_own_shopgate_config.php'; $shopgate_config = new ShopgateConfig();
// instantiate and set up redirect class $builder = new ShopgateBuilder($shopgate_config); $shopgateRedirector= $builder->buildMobileRedirect($_SERVER['HTTP_USER_AGENT'], $_GET, $_COOKIE);
################## # redirect logic # ################## // set global site parameters $shopgateRedirector->addSiteParameter(TagsGenerator::SITE_PARAMETER_SITENAME, $siteTitle); $shopgateRedirector->addSiteParameter(TagsGenerator::SITE_PARAMETER_TITLE, $pageTitle); $shopgateRedirector->addSiteParameter(TagsGenerator::SITE_PARAMETER_DESKTOP_URL, $_SERVER['SCRIPT_NAME']);
// set redirection url and site specific parameters if ($product->isProduct) { $shopgateRedirector->addSiteParameter(TagsGenerator::SITE_PARAMETER_PRODUCT_AVAILABILITY, $product->stock); $shopgateRedirector->addSiteParameter(TagsGenerator::SITE_PARAMETER_PRODUCT_NAME, $product->name); $shopgateJsHeader = $shopgateRedirector->buildScriptItem($product->pID); } elseif (!empty($current_category_id)) { $shopgateJsHeader = $shopgateRedirector->buildScriptCategory($current_category_id); } elseif($site->isHomePage()) { $shopgateJsHeader = $shopgateRedirector->buildScriptShop(); } else { $shopgateJsHeader = $shopgateRedirector->buildScriptDefault(); }}
?><html><head>
[...]
<?php echo $shopgateJsHeader; ?></head><body> [...]</body></html>Example output
<html><head>
[...]
<!-- BEGIN SHOPGATE --> <link rel="alternate" media="only screen and (max-width: 640px)" href="http://m.myshop.com/item/3132333435" /> <link rel="alternate" href="android-app://com.example.android/http/example.com/gizmos/item/3132333435" /> <meta property="og:title" content="My Product" /> <meta property="og:site_name" content="My Shop" /> <meta property="og:product:availability" content="67" /> <meta name="twitter:app:id:googleplay" content="com.myshop.android" />
<script type="text/javascript"> var _shopgate = { shop_number: "12345", redirect: "item", is_default_redirect_disabled: true, item_number: "275" };
(function(b,d){ var a=("undefined"!==typeof _shopgate?_shopgate:{}).shop_number, e="http:"===b.location.protocol?"http:":"https:";if(a){var c=b.createElement(d); c.async=!/(ip(ad|od|hone)|Android)/i.test(navigator.userAgent); c.src=e+"//static.shopgate.com/mobile_header/"+a+".js"; a=b.getElementsByTagName(d)[0];a.parentNode.insertBefore(c,a)}} )(document,"script"); </script> <!-- END SHOPGATE --></head><body> [...]</body></html>Open Graph Tags
Section titled “Open Graph Tags”The class constants in the tables below refer to the constants in Shopgate_Helper_Redirect_TagsGeneratorInterface.
General Site Parameters
Section titled “General Site Parameters”| Parameter Name | Class Constant | Description | Example |
|---|---|---|---|
sitename |
SITE_PARAMETER_SITENAME | The name of the desktop website. | My Awesome Shop |
desktop_url |
SITE_PARAMETER_DESKTOP_URL | The URL to the desktop site. | http://www.my-awesome-shop.com |
mobile_web_url |
SITE_PARAMETER_MOBILE_WEB_URL | The URL to the mobile website. | http://m.my-awesome-shop.com |
title |
SITE_PARAMETER_TITLE | The title of the currently viewed page. | My Awesome Shop - Genesis - Invisible Touch |
Product Detail Page Parameters
Section titled “Product Detail Page Parameters”| Parameter Name | Class Constant | Description | Example |
|---|---|---|---|
product_image |
SITE_PARAMETER_PRODUCT_IMAGE | The URL to a product image. | http://cdn.my-awesome-shop.com/images/products/CD-GENESIS-INV_TOUCH-1.png |
product_name |
SITE_PARAMETER_PRODUCT_NAME | The name of the product. | Genesis - Invisible Touch |
product_description_short |
SITE_PARAMETER_PRODUCT_DESCRIPTION_SHORT | A short (max. 140 characters) description of the product. | Invisible Touch is the thirteenth studio album from the English rock band Genesis. |
product_ean |
SITE_PARAMETER_PRODUCT_EAN | The European Article Number of the product. | 0075678164125 |
product_availability |
SITE_PARAMETER_PRODUCT_AVAILABILITY | One of “instock”, “oos” or “pending” to indicate the availability of the product. | instock |
product_category |
SITE_PARAMETER_PRODUCT_CATEGORY | The name of the category this product is in. | 80s rock / pop |
product_price |
SITE_PARAMETER_PRODUCT_PRICE | The (gross, if can be calculated) price of the product. | 12.99 |
product_currency |
SITE_PARAMETER_PRODUCT_CURRENCY | The currency the price is declared in. | $ |
product_pretax_price |
SITE_PARAMETER_PRODUCT_PRETAX_PRICE | The net price of the product. | 10.00 |
product_pretax_currency |
SITE_PARAMETER_PRODUCT_PRETAX_CURRENCY | The currency the net price is declared in. | $ |

