Magento 1 & 2

Send Order to Clougistic

Please read the Xtento Manual before reading this section.

https://support.xtento.com/wiki/Magento_2_Extensions:Magento_Order_Export_Module#HTTP_Server 


General setting

Export each order separately : Yes

Destination Type: HTTP Server

Automatic Export: 

After order modification (Event: sales_order_save_after) 

After order placement completed (Event: sales_order_payment_place_end) 

After invoice creation (Event: sales_order_invoice_register) 


Export Destination

Destination Type: HTTP Server

Custom Function: Clougistic


Use the following examples to export from Magento

Http.php for Order Exporter

public function Clougistic($fileArray)    {        foreach ($fileArray as $filename => $fileContent) {            $curlClient = curl_init();            curl_setopt($curlClient, CURLOPT_URL, 'https://[YOUR CLOUGISTIC URL]/api/v1/order/enqueue');            curl_setopt($curlClient, CURLOPT_RETURNTRANSFER, 1);            curl_setopt($curlClient, CURLOPT_POST, 1);            curl_setopt($curlClient, CURLOPT_POSTFIELDS, $fileContent);            //curl_setopt($curlClient, CURLOPT_POSTFIELDS, array('SampleParameter' => $fileContent)); // Send as a parameter instead            curl_setopt($curlClient, CURLOPT_HTTPHEADER, array(                'Content-Type: application/json'            ));            curl_setopt($curlClient, CURLOPT_SSL_VERIFYPEER, 0);            curl_setopt($curlClient, CURLOPT_SSL_VERIFYHOST, 0);            $result = curl_exec($curlClient);            curl_close($curlClient);
            // Log result            $logEntry = $this->_registry->registry('orderexport_log');            #$logEntry->setResult(\Xtento\OrderExport\Model\Log::RESULT_WARNING);            $logEntry->addResultMessage(__('Destination "%1" (ID: %2): %3', $this->getDestination()->getName(), $this->getDestination()->getId(), htmlentities($result)));        }    }

Payload

Please validate the exported JSON before connecting to Clougistic. 

Only add Order Option parts if they're being used in Clougistic (like pos / consignmentzone).

<?xml version="1.0" encoding="UTF-8"?><files><file filename="%lastincrementid%.json"><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl"><xsl:output method="text"/><xsl:variable name="sepstart" select="'&#34;'"/> <xsl:variable name="sepmid" select="'&#34;: '"/> <xsl:variable name="mid" select="': '"/> <xsl:variable name="sepend" select="',&#xD;&#xA;'"/> <xsl:variable name="newline" select="'&#xD;&#xA;'"/> <xsl:template match="/">
<xsl:for-each select="objects/object"><xsl:text>{</xsl:text><xsl:value-of select="$newline"/>
    <xsl:value-of select="concat($sepstart, 'access_key', $sepmid, php:functionString('json_encode','[CLOUGISTIC API ACCESS KEY]'), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'entity_id', $sepmid, php:functionString('json_encode','[CLOUGISTIC ENTITY ID]'), $sepend)"/>
    <xsl:value-of select="concat($sepstart, 'magestatus', $sepmid, php:functionString('json_encode',status), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'payload', $sepmid, '{', $newline)"/>        <xsl:choose>        <xsl:when test="state='new'"><xsl:text>"status" : "0"</xsl:text></xsl:when>        <xsl:when test="state='pending'"><xsl:text>"status" : "0"</xsl:text></xsl:when>        <xsl:when test="state='pending_payment'"><xsl:text>"status" : "0"</xsl:text></xsl:when>        <xsl:when test="state='payment_review'"><xsl:text>"status" : "0"</xsl:text></xsl:when>        <xsl:when test="state='processing'"><xsl:text>"status" : "1"</xsl:text></xsl:when>        <xsl:when test="state='holded'"><xsl:text>"status" : "8"</xsl:text></xsl:when>        <xsl:when test="state='canceled'"><xsl:text>"status" : "9"</xsl:text></xsl:when>        <xsl:when test="state='closed'"><xsl:text>"status" : "9"</xsl:text></xsl:when>        <xsl:when test="state='complete' and count(items/item[qty_canceled>0])>0"><xsl:text>"status" : "9"</xsl:text></xsl:when>         <xsl:otherwise>"status" : "0"</xsl:otherwise>    </xsl:choose>    <xsl:text>,</xsl:text>    <xsl:value-of select="$newline"/>
    <xsl:variable name = "order_type">        <xsl:choose>            <xsl:when test="(shipping_method='freeshipping_freeshipping' and store_id='0')">1</xsl:when>            <xsl:when test="(customer/consignment_type='sale' and customer/consignment_zone > 0)">1</xsl:when>            <xsl:when test="(customer/consignment_type='supply' and customer/consignment_zone > 0)">0</xsl:when>            <xsl:otherwise>0</xsl:otherwise>        </xsl:choose>    </xsl:variable>    <xsl:value-of select="concat($sepstart,'type', $sepmid, $order_type, $sepend)"/>
    <xsl:comment>ORDER OPTIONS</xsl:comment>
    <xsl:variable name = "pos_zone_id">        <xsl:choose>            <xsl:when test="(shipping_method='freeshipping_freeshipping' and store_id='0')">5</xsl:when>            <xsl:when test="(customer/consignment_type='sale' and customer/consignment_zone > 0)">                <xsl:value-of select="php:functionString('json_encode', customer/consignment_zone)" />            </xsl:when>            <xsl:otherwise></xsl:otherwise>        </xsl:choose>    </xsl:variable>        <xsl:variable name = "consignment_zone_id">        <xsl:choose>            <xsl:when test="(customer/consignment_type='supply' and customer/consignment_zone > 0)">                <xsl:value-of select="php:functionString('json_encode', customer/consignment_zone)" />            </xsl:when>            <xsl:otherwise></xsl:otherwise>        </xsl:choose>    </xsl:variable>        <xsl:comment>Options part</xsl:comment>    <xsl:value-of select="concat($sepstart,'options', $sepmid, '{', $newline)"/>            <xsl:if test="string-length($pos_zone_id)!=0">            <xsl:value-of select="concat($sepstart,'@pos_zone_id', $sepmid, $pos_zone_id, $sepend)"/>        </xsl:if>                        <xsl:if test="string-length($consignment_zone_id)!=0">            <xsl:value-of select="concat($sepstart,'@consignment_zone_id', $sepmid, $consignment_zone_id, $sepend)"/>        </xsl:if>                    <xsl:comment>for forwarding shipmentinformation to 3th party connectors</xsl:comment>    <xsl:value-of select="concat($sepstart,'carrier', $sepmid, '{', $newline)"/>        <xsl:value-of select="concat($sepstart, 'name', $sepmid, php:functionString('json_encode', shipping_method), $sepend)"/>        <xsl:value-of select="concat($sepstart, 'type', $sepmid,  php:functionString('json_encode', '0000'), $newline)"/>    <xsl:text>}</xsl:text>            <xsl:text>},</xsl:text>    <xsl:value-of select="$newline"/>
        <xsl:comment>Cash On Delivery Amount</xsl:comment>    <xsl:choose>        <xsl:when test="shipping_method='Cash on Delivery'">            <xsl:value-of select="concat($sepstart, 'cod_amount', $sepmid, php:functionString('json_encode', base_grand_total),$sepend)"/>        </xsl:when>        <xsl:otherwise>            <xsl:value-of select="concat($sepstart, 'cod_amount', $sepmid, php:functionString('json_encode', '0'),$sepend)"/>        </xsl:otherwise>    </xsl:choose>
    <xsl:value-of select="concat($sepstart, 'source_id', $sepmid, php:functionString('json_encode','[A UNIQUE SOURCE CODE]'), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'reference', $sepmid, php:functionString('json_encode', increment_id),$sepend)"/>    <xsl:value-of select="concat($sepstart, 'customer_id', $sepmid, php:functionString('json_encode', customer_id),$sepend)"/>    <xsl:value-of select="concat($sepstart, 'currency', $sepmid, php:functionString('json_encode', store_currency_code),$sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_method', $sepmid, php:functionString('json_encode', shipping_method),$sepend)"/>    <xsl:value-of select="concat($sepstart, 'flag_partial', $sepmid, php:functionString('json_encode', can_ship_partially),$sepend)"/>
    <xsl:value-of select="concat($sepstart, 'created_at', $sepmid, php:functionString('json_encode', created_at),$sepend)"/>              or    <xsl:value-of select="concat($sepstart, 'created_at', $sepmid, php:functionString('json_encode', php:functionString('strftime','%Y-%m-%d %H:%M:%S', created_at_timestamp)),$sepend)" /> 
    <xsl:value-of select="concat($sepstart, 'delivery_at', $sepmid, php:functionString('json_encode', delivery_at),$sepend)"/>        <xsl:value-of select="concat($sepstart, 'billing_company', $sepmid, php:functionString('json_encode', billing/company), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'billing_firstname', $sepmid, php:functionString('json_encode', billing/firstname), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'billing_lastname', $sepmid, php:functionString('json_encode', billing/lastname), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'billing_street_full', $sepmid, php:functionString('json_encode', billing/street), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'billing_postcode', $sepmid, php:functionString('json_encode', billing/postcode), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'billing_city', $sepmid, php:functionString('json_encode', billing/city), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'billing_region', $sepmid, php:functionString('json_encode', billing/region), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'billing_country', $sepmid, php:functionString('json_encode', billing/country_id), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'billing_phone', $sepmid, php:functionString('json_encode', billing/phone), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'billing_email', $sepmid, php:functionString('json_encode', billing/email), $sepend)"/>
    <xsl:value-of select="concat($sepstart, 'shipping_company', $sepmid, php:functionString('json_encode', shipping/company), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_firstname', $sepmid, php:functionString('json_encode', shipping/firstname), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_lastname',  $sepmid, php:functionString('json_encode', shipping/lastname), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_street_full', $sepmid, php:functionString('json_encode', shipping/street), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_postcode', $sepmid, php:functionString('json_encode', shipping/postcode), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_city', $sepmid, php:functionString('json_encode', shipping/city), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_region', $sepmid, php:functionString('json_encode', shipping/region), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_country', $sepmid, php:functionString('json_encode', shipping/country_id), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_phone', $sepmid, php:functionString('json_encode', shipping/phone), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'shipping_email', $sepmid, php:functionString('json_encode', shipping/email),$sepend)"/>          <xsl:value-of select="concat($sepstart, 'items', $sepmid,'[',$newline)"/>        <xsl:for-each select="items/item">                <xsl:comment>Needed Qty Calculation</xsl:comment>                <xsl:variable name = "qty_refunded_calc">            <xsl:choose>                <xsl:when test="qty_refunded >=0"><xsl:value-of select="php:functionString('json_encode', round(qty_refunded))"/></xsl:when>                <xsl:otherwise>0</xsl:otherwise>            </xsl:choose>        </xsl:variable>
        <xsl:variable name = "qty_canceled_calc">            <xsl:choose>                <xsl:when test="qty_canceled >=0"><xsl:value-of select="php:functionString('json_encode', round(qty_canceled))"/></xsl:when>                <xsl:otherwise>0</xsl:otherwise>            </xsl:choose>        </xsl:variable>                <xsl:variable name = "qty_shipped_calc">            <xsl:choose>                <xsl:when test="qty_shipped >=0"><xsl:value-of select="php:functionString('json_encode', round(qty_shipped))"/></xsl:when>                <xsl:otherwise>0</xsl:otherwise>            </xsl:choose>        </xsl:variable>                <xsl:variable name = "qty_calc" select= "round(qty - $qty_refunded_calc - $qty_canceled_calc - $qty_shipped_calc)">
        </xsl:variable>                    <xsl:choose>                <xsl:when test="(product_attributes/type_id='simple' and string-length(parent_item_id/text())=0)">                    <xsl:text>[{</xsl:text>                                <xsl:comment>Simple Product without Parent</xsl:comment>                                <xsl:value-of select="$newline"/>                                <xsl:value-of select="concat($sepstart, 'sku', $sepmid, php:functionString('json_encode', sku),$sepend)"/>                                <xsl:value-of select="concat($sepstart, 'description', $sepmid, php:functionString('json_encode', name),$sepend)"/>                                <xsl:value-of select="concat($sepstart, 'weight', $sepmid, php:functionString('json_encode', weight),$sepend)"/>                                <xsl:value-of select="concat($sepstart, 'reference', $sepmid, php:functionString('json_encode', item_id),$sepend)"/>                                <xsl:value-of select="concat($sepstart, 'unit_price', $sepmid, php:functionString('json_encode',php:functionString('number_format',base_price,2,'.','')))"/><xsl:value-of select="$sepend"/>                                <xsl:value-of select="concat($sepstart, 'qty', $sepmid, php:functionString('json_encode', $qty_calc),$newline)"/>
                                <xsl:if test="string-length(custom_options/custom_option/text())!=0">                                        <xsl:text>,"custom_options": { "option_data": [</xsl:text>                                </xsl:if>                                        <xsl:for-each select="custom_options/custom_option">                                            <xsl:text>{</xsl:text>                                                    <xsl:value-of select="concat($sepstart, 'label', $sepmid, php:functionString('json_encode', name),$sepend)"/>                                                    <xsl:value-of select="concat($sepstart, 'value', $sepmid, php:functionString('json_encode', value))"/>                                            <xsl:text>}</xsl:text>                                        </xsl:for-each>                                <xsl:if test="string-length(custom_options/custom_option/text())!=0">                                    <xsl:text>]}</xsl:text>                                </xsl:if>                    <xsl:text>}]</xsl:text>                    <xsl:if test="not(position()=last())"><xsl:text>,</xsl:text><xsl:value-of select="$newline"/></xsl:if>                </xsl:when>                                <xsl:when test="(product_attributes/type_id='simple' and parent_item/product_attributes/type_id='configurable' and string-length(parent_item_id/text())!=0)">                    <xsl:text>[{</xsl:text>                            <xsl:comment>Simple Product with Configurable as Parent</xsl:comment>                            <xsl:value-of select="$newline"/>                            <xsl:value-of select="concat($sepstart, 'sku', $sepmid, php:functionString('json_encode', parent_item/sku),$sepend)"/>                            <xsl:value-of select="concat($sepstart, 'description', $sepmid, php:functionString('json_encode', name),$sepend)"/>                            <xsl:value-of select="concat($sepstart, 'weight', $sepmid, php:functionString('json_encode', weight),$sepend)"/>                            <xsl:value-of select="concat($sepstart, 'reference', $sepmid, php:functionString('json_encode', parent_item_id),$sepend)"/>                            <xsl:value-of select="concat($sepstart, 'unit_price', $sepmid, php:functionString('json_encode',php:functionString('number_format',parent_item/base_price,2,'.','')))"/><xsl:value-of select="$sepend"/>                            <xsl:value-of select="concat($sepstart, 'qty', $sepmid, php:functionString('json_encode', $qty_calc),$newline)"/>                                                    <xsl:if test="string-length(parent_item/custom_options/custom_option/text())!=0">                                        <xsl:text>,"custom_options": { "option_data": [</xsl:text>                                </xsl:if>                                        <xsl:for-each select="parent_item/custom_options/custom_option">                                            <xsl:text>{</xsl:text>                                                    <xsl:value-of select="concat($sepstart, 'label', $sepmid, php:functionString('json_encode', name),$sepend)"/>                                                    <xsl:value-of select="concat($sepstart, 'value', $sepmid, php:functionString('json_encode', value))"/>                                            <xsl:text>}</xsl:text>                                        </xsl:for-each>                                <xsl:if test="string-length(parent_item/custom_options/custom_option/text())!=0">                                    <xsl:text>]}</xsl:text>                                </xsl:if>                    <xsl:text>}]</xsl:text>                    <xsl:if test="not(position()=last())"><xsl:text>,</xsl:text><xsl:value-of select="$newline"/></xsl:if>                </xsl:when>                                <xsl:when test="(product_attributes/type_id='simple' and parent_item/product_attributes/type_id='bundle' and parent_item/product_attributes/shipment_type='1')">                    <xsl:text>[{</xsl:text>                    <xsl:comment>Bundle Items / Option Ship Separately is set!</xsl:comment>                    <xsl:value-of select="$newline"/>                    <xsl:value-of select="concat($sepstart, 'sku', $sepmid, php:functionString('json_encode', sku),$sepend)"/>                    <xsl:value-of select="concat($sepstart, 'description', $sepmid, php:functionString('json_encode', name),$sepend)"/>                    <xsl:value-of select="concat($sepstart, 'weight', $sepmid, php:functionString('json_encode', weight),$sepend)"/>                    <xsl:value-of select="concat($sepstart, 'reference', $sepmid, php:functionString('json_encode', item_id),$sepend)"/>                    <xsl:value-of select="concat($sepstart, 'unit_price', $sepmid, php:functionString('json_encode',php:functionString('number_format',base_price,2,'.','')))"/><xsl:value-of select="$sepend"/>                    <xsl:value-of select="concat($sepstart, 'qty', $sepmid, php:functionString('json_encode', $qty_calc),$newline)"/>                    <xsl:text>}]</xsl:text>                    <xsl:if test="not(position()=last())"><xsl:text>,</xsl:text><xsl:value-of select="$newline"/></xsl:if>                </xsl:when>                            </xsl:choose>                    </xsl:for-each>          <xsl:text>]</xsl:text>
  <xsl:value-of select="$newline"/>
</xsl:for-each><xsl:text>}</xsl:text><xsl:value-of select="$newline"/><xsl:text>}</xsl:text></xsl:template></xsl:stylesheet></file></files>

Import Clougistic Shipment & Tracking numbers to Magento

Create Shipment & Invoice

General configuration

File Processor: XML

Import Type: Order update

Settings & Filters

Order Identifier: Order Increment ID

Product Identifier: SKU

File Mapping

Data XPath: //orders/order

Magento field: Order identifier - File Field name: id

Magento field: Product identifier - File Field name: sku - Addition Configuration:

<?xml version="1.0" encoding="UTF-8"?><configuration><nested_xpath xpath="//items/item"/></configuration>

Magento field: Quantity - File Field name: qty - Addition Configuration:

<?xml version="1.0" encoding="UTF-8"?><configuration><nested_xpath xpath="//items/item"/></configuration>

Actions

Import Partial Shipments: Yes

Import Partial Invoices: Yes

Create Shipment for imported order: Yes

Create Invoice for imported order: Yes

Import Sources

Connection to the server where the shipping data is offered

Do not forget to set the option: Delete Imported Files

Import Tracking numbers


General configuration

File Processor: XML

Import Type: Order update

Settings & Filters

Order Identifier: Order Increment ID

Product Identifier: SKU

File Mapping

Data XPath: //orders/order

Magento field: Order identifier - File Field name: @id

Magento field: Tracking number - File Field name: number 

Addition Configuration:

<?xml version="1.0" encoding="UTF-8"?><configuration><nested_xpath xpath="//tracks/track"/></configuration>

Magento field: Shipping Carrier Code - File Field name: code  

Addition Configuration:

<?xml version="1.0" encoding="UTF-8"?><configuration><nested_xpath xpath="//items/item"/></configuration>

If you have a shipper extension installed that match code, it will create clickable URL's automatically.

Actions

Add tracking numbers to existing shipments & import multiple tracking numbers: Yes

Send shipment to customer: Yes  (optional)

Import Sources

Connection to the server where the shipping data is offered.

Set the Archive Directory to store your trackingnumbers.

Use Filename Pattern /xml/i (this prevents error report entries  in  Xtento "checking emty folders on the FTP server")




Update Stock Qty & ETA in Magento using Clougistic Product API

Clougistic keeps track of all product stock and ETA changes.  These are queued to be called by external sources (like Magento). With Xtento Stock importer you are able to call these updates. In this step by step instruction, a connection is setup between Clougistic and Magento.


Step 1. Create an entity source in Clougistic

Goto Setting, choose Scope (the Entity). 

Under Entity > Sources > Add a source id (f.e. your store name) and Save

Step 2. Create the file \app\code\local\Xtento\StockImport\Model\Source\Http.php in Magento

Make sure that you have setup the 

Place these in the file \app\code\local\Xtento\StockImport\Model\Source\Http.php like below:

class Xtento_StockImport_Model_Source_Http extends Xtento_StockImport_Model_Source_Abstract{    /*     * !!!!! IMPORTANT !!!!!     *     * Modify below this line. Add custom functions, similar to the function below. Must return parameter $filesToProcess as in example below.     */    public function ClougisticStockUpdate()    {
        $post = '{                   "access_key": "[CLOUGISTIC ACCESS KEY]",                   "entity_id": "[CLOUGISTIC ENTITY]",                   "payload": {                       "source_id": "[THE SOURCE YOU WANT TO UPDATE]",                       "purge_mode": 0,                       "size": 100,                       "format": "csvh"                     }        }';
        $filesToProcess = array();        $curlClient = curl_init();        curl_setopt($curlClient, CURLOPT_URL, 'https://[YOUR CLOUGISTIC URL]/api/v1/product/updated-sku-list');        curl_setopt($curlClient, CURLOPT_RETURNTRANSFER, 1);        curl_setopt($curlClient, CURLOPT_POST, 1);        curl_setopt($curlClient, CURLOPT_POSTFIELDS, $post);        curl_setopt($curlClient, CURLOPT_SSL_VERIFYPEER, 0);        curl_setopt($curlClient, CURLOPT_SSL_VERIFYHOST, 0);        curl_setopt($curlClient, CURLOPT_HTTPHEADER, array(            'Content-Type: application/json'        ));        $fileContents = curl_exec($curlClient);        curl_close($curlClient);
        $filesToProcess[] = array('source_id' => $this->getSource()->getId(), 'path' => '', 'filename' => 'http_download', 'data' => $fileContents); // Set a filename here. 'data' must contain the returned string from the HTTP source which will then be imported
        // Return files to process        return $filesToProcess;    }

Step 3. Create a Profile in Xtento Stock Importer

These settings are available in the Magento admin area

General Configuration

Choose CSV/TXT as File processor

File Configuration

Skip header line: Yes

Field Delimiter:  , (comma)

Fiel Enclosure Character:  " (double quotation mark)

File Mapping

Product Identifier: sku

Qty In Stock: qty

If a ETA (date format) product attribute in Magento exsists, the ETA is also available to update

ETA: eta  

Import Sources

Settings

Source Type: HTTP Server (Custom)

HTTP Configuration

Custom Function: ClougisticStockUpdate  (this is the function name created in step 2)

Automatic Import

Set the Cron to update automatically.

Import/Update a product in Clougistic with Xtento Product Export

Payload for Xtento profile

<?xml version="1.0" encoding="UTF-8"?><files><file filename="%lastentityid%.json"><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl"><xsl:output method="text"/><xsl:variable name="sepstart" select="'&#34;'"/> <xsl:variable name="sepmid" select="'&#34;: '"/> <xsl:variable name="mid" select="': '"/> <xsl:variable name="sepend" select="',&#xD;&#xA;'"/> <xsl:variable name="newline" select="'&#xD;&#xA;'"/> <xsl:template match="/">
<xsl:for-each select="products/product"> <xsl:text>{</xsl:text><xsl:value-of select="$newline"/>    <xsl:value-of select="concat($sepstart, 'access_key', $sepmid, php:functionString('json_encode','[CLOUGISTIC API ACCESS KEY]'), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'entity_id', $sepmid, php:functionString('json_encode','[CLOUGISTIC ENTITY ID]'), $sepend)"/>    <xsl:value-of select="concat($sepstart, 'payload', $sepmid, '{', $newline)"/>
    <xsl:comment>Place Product attributes</xsl:comment>    <xsl:value-of select="concat($sepstart, 'sku', $sepmid, php:functionString('json_encode', sku),$sepend)"/>    <xsl:value-of select="concat($sepstart, 'name', $sepmid, php:functionString('json_encode', name),$newline)"/>    <xsl:comment>End place Product attributes</xsl:comment>
    <xsl:text>}</xsl:text></xsl:for-each><xsl:text>}</xsl:text></xsl:template></xsl:stylesheet></file></files>

Http.php for Productsave

<?php
/** * Product:       Xtento_ProductExport * Last Modified: 2016-04-14T15:37:57+00:00 * File:          app/code/Xtento/ProductExport/Model/Destination/Http.php * Copyright:     Copyright (c) XTENTO GmbH & Co. KG <info@xtento.com> / All rights reserved. */
namespace Xtento\ProductExport\Model\Destination;
class Http extends AbstractClass{    public function ClougisticProductSave($fileArray)    {        // Do whatever - sample code for a HTTP request below.        foreach ($fileArray as $filename => $fileContent) {            $curlClient = curl_init();            curl_setopt($curlClient, CURLOPT_URL, 'https://[YOUR CLOUGISTIC URL]/api/v1/product/save');            curl_setopt($curlClient, CURLOPT_RETURNTRANSFER, 1);            curl_setopt($curlClient, CURLOPT_POST, 1);            curl_setopt($curlClient, CURLOPT_POSTFIELDS, $fileContent);            curl_setopt($curlClient, CURLOPT_HTTPHEADER, array(                   'Content-Type: application/json'            ));            curl_setopt($curlClient, CURLOPT_SSL_VERIFYPEER, 0);            curl_setopt($curlClient, CURLOPT_SSL_VERIFYHOST, 0);            $result = curl_exec($curlClient);            curl_close($curlClient);
            // Log result            $logEntry = $this->_registry->registry('productexport_log');            #$logEntry->setResult(\Xtento\ProductExport\Model\Log::RESULT_WARNING);            $logEntry->addResultMessage(__('Destination "%1" (ID: %2): %3', $this->getDestination()->getName(), $this->getDestination()->getId(), htmlentities($result)));        }    }
    /*     * !!!!! Do not modify below this line !!!!!     */    public function testConnection()    {        $this->initConnection();        if (!$this->getDestination()->getBackupDestination()) {            $this->getDestination()->setLastResult($this->getTestResult()->getSuccess())->setLastResultMessage($this->getTestResult()->getMessage())->save();        }        return $this->getTestResult();    }
    public function initConnection()    {        $this->setDestination($this->destinationFactory->create()->load($this->getDestination()->getId()));        $testResult = new \Magento\Framework\DataObject();        $this->setTestResult($testResult);        if (!@method_exists($this, $this->getDestination()->getCustomFunction())) {            $this->getTestResult()->setSuccess(false)->setMessage(__('Custom function/method \'%1\' not found in %2.', $this->getDestination()->getCustomFunction(), __FILE__));        } else {            $this->getTestResult()->setSuccess(true)->setMessage(__('Custom function/method found and ready to use.', __FILE__));        }        return true;    }
    public function saveFiles($fileArray)    {        if (empty($fileArray)) {            return [];        }        // Init connection        $this->initConnection();        // Call custom function        @$this->{$this->getDestination()->getCustomFunction()}($fileArray);        return array_keys($fileArray);    }}