Using bespoke software with the Magento module

When integrating ChannelUnity with your Magento platform, some extra customisation may be necessary to fit with your bespoke software.

The key issues on this topic are summarised here.

Stock Level Updates

If you use custom software to update your Magento database i.e. to update stock levels from a third-party source for example, you will need to make sure that ChannelUnity is also informed of this stock level update so that your new Magento stock level stays in-sync with ChannelUnity and hence all of your connected channels. The same holds true whether you use the standard Magento attribute for your stock level or a different attribute (set via Describe Product Fields).

Informing ChannelUnity of a product data update

The following PHP code must be added to your Magento module or script to notify ChannelUnity that your product data has changed.

// Get XML data to represent the product
$data = Mage::getModel('channelunity/products')
->generateCuXmlForSingleProduct([PRODUCT_ID], [STOREVIEW_ID]);
// Get the URL of the store
$sourceUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
// Create overall XML message
$xml = <<<XML
// Send to ChannelUnity
Mage::getModel('channelunity/products')->postToChannelUnity($xml, 'ProductData');

Shipment updates

If you have a piece of bespoke software which you use to mark orders as shipped, you will need to integrate in a similar fashion, so that ChannelUnity is aware when you ship orders. ChannelUnity hooks into the standard functionality of Magento by default. If these observers are by-passed in any way, you will need to use the custom PHP code shown below.


Informing ChannelUnity of an order shipment

$orders = Mage::getModel('channelunity/orders');
$xml = $orders->generateCuXmlForOrderShip(
    $order, // This is the Magento order object
    "Royal Mail", // The name of the shipping carrier* (replace with Carrier variable of required)
    "tracking", // Title of tracking information* (replace with tracking variable if relevant)
    "BB333344333" // Tracking number* (replace with your tracking number variable eg. $tracking)
// Send XML to CU
$orders->postToChannelUnity($xml, 'OrderStatusUpdate');


Note that some or all of the * items can be sent as an empty string if you don’t have the information.

Category updates

If your categories are updated in your Magento store via direct database access, these updated categories can be posted to your ChannelUnity account using the below code.


Store view updates

If your storeviews are updated in your Magento store via direct database access, these new storeviews can be posted to your ChannelUnity account using this code.


Product updates

The following script can be used to send product data changes to ChannelUnity. This can be run as a standalone script.

It will send full details about each product to your ChannelUnity account, i.e. include all attribute values of the product.

Note that this script only works if you have one store view in Magento.


Using Shipworks with Magento


If you are using Shipworks along with Magento and ChannelUnity then this information could be useful for you.

The Issue

If you use Shipworks to ship your ChannelUnity-imported marketplace orders, then ChannelUnity will not see the shipment messages as these by-pass the standard Magento shipment observers that are provided. Therefore you may end up with orders showing unshipped on Amazon/eBay despite shipping them in Shipworks. To fix this problem you can add a small fragment of code into your Shipworks PHP module.


You will require access to the files on your web server on which you have installed Magento. Typically this is over FTP.

The shipworks PHP file is normally just called “Shipworks.php” or similar such as “shipworks3.php”.

To make the necessary modifications, first look for the following piece of code:




The code below needs to be added in the section marked with asterisks.


If you want to sell on marketplaces but don't yet have an online store, Synchromatic is the solution for you.
More Details