Magento Integration Plugin

About Magento

Magento is an open-source e-commerce solution, written in PHP. Magento has two editions - Community Edition (free) and Enterprise Edition - this plugin has been developed against version 1.9.2 of the Community edition.

Official Magento website.

Note: Magento 2.0 has been released as of 20 November 2015, but is not tested with the Jiwa Magento Integration Plugin

Sample Jiwa Magento webstore.

This sample web store runs Magento 1.9.2, on Debian 8.2 using MariaDB 10.1 on the Microsoft Azure platform. You are free to choose the OS and database of your choice. We chose Debian simply because it was the Linux distribution most familiar to our developers, and we chose MariaDB because Debian has now chosen that over MySQL, but MySQL works as well. We chose Azure to host the sample store as we already had infrastructure using Azure. Amazon, or any other hosting provider would be suitable.

We also chose the Infortis Ultimo theme for the site (see below in Recommendations).

Recommendations

It is not recommended to host your webstore on-premise. Use a reputable hosting or cloud provider. Why?

  • Bandwidth most business do not have the internet bandwidth required to cope with the potential demand of a public facing website.
  • DoS/DDoS most businesses do not have adequate Denial of Service protections. Encountering a DoS/DDoS attack when with a hosted or cloud provider will not only be mitigated by the provider, but will not result in your on-premise connection being isolated from the internet.
  • Availability You want your webstore online as much as possible. Hosted or cloud providers offer backup diesel power generators, redundant internet connections, fire suppression systems and 24 hour physical security. Cloud providers offer server redundancy to mitigate hardware failure, and automatic scale out to meet demand (if configured).
  • Security A public facing website is a target for malicious attacks - separating your sensitive corporate data from such targets mitigates risk.

The Jiwa Magento integration is designed specifically with hosted or cloud hosting in mind. Even if the connection to the Jiwa system is down, your store can still take orders and when the connection is reestablished, those orders will then flow into Jiwa.

We recommend the Infortis Ultimo theme for Magento. It's not free, but at only $99USD it provides a visually attractive and responsive (usable on mobile devices and tablets) skin to the site.

About the Jiwa Magento Integration

The Jiwa Magento integration enables a Magento Web Store to be connected to the Jiwa ERP system. Magento collects orders and these are imported into Jiwa as Sales Orders. The allocation of stock and dispatch of goods is controlled by the workflow chosen.

Both account and cash (non-account) sales are supported. Account sales depend on the Magento payment method "Purchase Order" being enabled.

Supported Workflows

There are two (currently) supported worflows. Additional workflows are possible through plugin customisations.

On-Premise Warehouse

  • Orders placed in Magento are imported into Jiwa as sales orders - non-serialised stock is allocated on a FIFO basis, serialised stock is forced onto backorder.
  • Payments attached to Magento orders (PayPal, VISA, et cetera) are processed into Cash book receipt batches, grouped by payment type and date.
  • Closed orders will cause a Shipment to be created in Magento, which includes tracking numbers from the Freight / Consignment section of the Jiwa sales order.

3PL

A Third Party Logistics (3PL) workflow is also supported. In this scenario, a 3PL will dispatch the goods and create the Magento Shipping document in the Magento Store.

  • Orders placed in Magento are imported into Jiwa as sales orders - all items are placed on Backorder.
  • Payments attached to Magento orders (PayPal, VISA, et cetera) are processed into Cash book receipt batches, grouped by payment type and date
  • Shipments found in Magento will cause the associated Jiwa sales order to be delivered, processed and updated with the Magento Shipment tracking information
  • Credit Memos placed in Magento are imported into Jiwa as credit notes.
3PL Workflow diagram

In both workflows the following options are available:

  • Stock Levels in Jiwa are exported to the Magento store.
  • Products in Magento are imported into Jiwa as Inventory Items
  • Inventory Items in Jiwa are export as Magento Products
  • Customers in Magento are imported into Jiwa as Debtors
  • Jiwa Inventory Categories are exported to Magento Product Categories
  • Magento Product Categories are imported into Jiwa as Inventory Categories1...5

All of the above are termed "Integration Actions" in the context of the plugin. The above integration actions are provided, but by creating a new plugin it is possible to introduce a new integration action to replace one of the existing integration actions, or to be used in addition to the existing actions.

Installation

  1. Import the plugin

    Import the plugin via the Plugin Maintenance form in Jiwa. Ensure the "Enabled" checkbox is checked and save the plugin.

  2. Run SQL Script

    The plugin depends on some SQL Tables and Triggers being created. The SQL Script is found on the documents tab of the plugin - open the SQL Script with Query Analyzer and run it.

  3. Exit Jiwa, and log back into Jiwa
  4. Import Menu, User Groups
    1. Open the Plugin Maintenance form again and locate the Magento Integration plugin - on the documents tab, extract the Menu and User Group XML documents.
    2. Open Menu Maintenance (System Settings -> Menu Configuration -> Menu Maintenance) and Import the menu XML. Save.
    3. Open Staff User Group Maintenance (System Settings -> Staff Configuration -> User Group Maintenance) and import the User Group XML. Save.
    4. Add staff members to the Magento User group - only these staff members will see the Magento Menu.
  5. Exit Jiwa, and log back into Jiwa

Configuration

System Settings

Several system settings are introduced by the plugin - Only some of these need to be set. Edit the values on the Magento Integration tab of the System Configuration form.

An explanation of each system setting is as follows:

System Settings
SettingDescriptionNotes
MagentoProductLastSyncDateThe date and time the Magento product changes were last synchronised. Used to obtain only a list of products changed in Magento since the last sync.This setting is used when importing product information from Magento. There should be no need to set this, as it is set when the "Import Magento Products" integration action is run.
MagentoCustomerLastSyncDateThe date and time the Magento customer changes were last synchronised. Used to obtain only a list of customers changed in Magento since the last sync.This setting is used when importing customer information from Magento. There should be no need to set this, as it is set when the "Import Magento Customers" integration action is run.
MagentoOrdersLastSyncDateThe date and time the Magento order changes were last synchronised. Used to obtain only a list of orders changed in Magento since the last sync.This setting is used when importing orders from Magento. There should be no need to set this, as it is set when the "Import Magento Orders" integration action is run.
MagentoShipmentsLastSyncDateThe date and time the Magento shipment changes were last synchronised. Used to obtain only a list of shipments changed in Magento since the last sync.This setting is used when importing shipments from Magento. There should be no need to set this, as it is set when the "Import Magento Shipments" integration action is run.
MagentoCreditMemoLastSyncDateThe date and time the Magento credit memos were last synchronised. Used to obtain only a list of credit memos changed in Magento since the last sync.This setting is used when importing credit memos from Magento. There should be no need to set this, as it is set when the "Import Magento Credit Memos" integration action is run.
JiwaSalesOrdersLastSyncDateTimeThe date and time the Jiwa sales orders were last synchronised. Used to obtain only a list of sales orders changed in Jiwa since the last sync.This setting is used when exporting completed sales orders from Jiwa. There should be no need to set this, as it is set when the "Export Jiwa Sales Orders" integration action is run.
JiwaDebtorsLastSyncDateTimeThe date and time the Jiwa debtors were last synchronised. Used to obtain only a list of debtors changed in Jiwa since the last sync.This setting is used when exporting debtors from Jiwa. There should be no need to set this, as it is set when the "Export Debtors" integration action is run.
MagentoWebStoreURLThe URL of the SOAP API endpoint of the Magento store 
MagentoWebStoreUsesSSLIndicates if the store uses SSL (HTTPS)
MagentoUserNameThe username as configured in Magento (Web Services -> SOAP/XML-RPC Users)Use the Magento Admin panel to add a username for the SOAP Services
MagentoAPIKeyThe API key as configured in Magento (Web Services -> SOAP/XML-RPC Users)Use the Magento Admin panel to add an API Key for the SOAP Services
MagentoStoreWarehouseThe warehouse in Jiwa the Magento store will useAll orders in Jiwa will be created in this nominated warehouse.
CashSalesDebtorThe debtor in Jiwa to use as a cash sales debtor for Magento orders which are for guest orders 

Magento Configuration Form

If you are logged in as a user which belongs to the Magento Integration user group (imported earlier), then a new menu option will have appeared on the main menu - Magento -> Magento Configuration.

By default there are two Integration Configurations defined in the system - "Magento" and "Magento 3PL". Many configurations are supported. Each configuration consists of Selected Actions, Schedules and Logs. When a configuration is executed, it runs the selected actions in the order they are in the Selected Actions grid. The order can be changed by dragging-and dropping the selected action row up or down. Selected actions can be added to, or removed. You can add Selected actions from the Available Actions grid.

Available Integration Actions

An integration action is an action or process. By default there are 18 available Integration Actions - 13 Import and 5 Export. Using another plugin, you can introduce additional integration actions to either complement or replace the default integration actions.

Default Available Actions
NameDirectionDescription
Import Magento Customer Pricing Groups
ImportObtains a list of all Magento Customer groups, and attempts to find a matching Jiwa Debtor Pricing Group Name to the Magento Customer group code - if none exists, then it is created.
Import Magento CustomersImport

Obtains a list of all Magento Customers whose "updated_at" date is newer than the Jiwa System Setting "MagentoCustomerLastSyncDate" (Note the date is adjusted from local time to UTC as the Magento "updated_at" for customers is stored in UTC), and adds these to the "Magento Customer" queue - then this queue is processed in order of datetime added. If a Jiwa Debtor with the custom field "customer_id" contents matches that of the Magento customer, then the debtor is updated with the Name, billing and shipping address information. If no debtor was found, then one is created and the "customer_id" custom field on the debtor is set to be that of the Magento customer_id.

Mappings - Default Magento Billing Address To Jiwa Debtor Address

Jiwa FieldMagento FieldNotes
Address1street 
Address2city 
Address3region 
Countrycountry_id mapped to CountryName 
Postcodepostcode 
Phonetelephone 
Faxfax 

Mappings - Shipping Addresses to Jiwa Delivery Addresses

Jiwa FieldMagento FieldNotes
Address1street 
Address2city 
Address3region 
Countrycountry_id mapped to CountryName 
IsDefaultis_default_shipping 
Import Magento Product CategoriesImportRetrieves the catalog tree from Magento, and attempts to match a Jiwa Inventory category based on name and depth within the catalog tree. Categories at depth level 1 are considered Jiwa Inventory Category 1, depth level 2 are considered Jiwa Inventory Category 2, et cetera. If a match on name and depth is not found, the Jiwa Inventory Category is created.
Enqueue - Import Magento ProductsImportObtains a list of all Magento Products whose "updated_at" date is newer than the Jiwa System Setting "MagentoProductLastSyncDate" (Note the date is adjusted from local time to UTC as the Magento "updated_at" for products is stored in UTC), and adds these to the "Magento Product" queue.
Dequeue - Import Magento ProductsImportCreates or updates Jiwa inventory items from the "Magento Product" queue.

If a Jiwa Inventory item with the Part No. matches that of the Magento sku, then the Inventory item is updated with the magento product details. If no Inventory item was found, then one is created with the PartNo as the sku of the Magento product.

Categories encountered which do not exist in Jiwa will be created as needed.

The following mapping occurs when updating or creating a product:

Mappings

Jiwa FieldMagento FieldNotes
DefaultPriceprice 
Descriptionname 
Details (Aux3)short_description 
Weightweight 
Statusstatus 
RRPmsrp 
Categories1...5Catalog CategoriesMatches Magento category with same name for the category depth (Category 1 in Jiwa is depth level 1 in Magento, Category 2 is depth level 2, et cetera)
DocumentsimagesImages are attached as documents with document type "Magento Image", description set to the Magento image label, physical filename is set to Magento image "file".
PictureimagesDefault Inventory picture is set to Magento product image with label "image", if found.
Debtor Group PricesSpecial PriceDebtor price group is set to null, start and end dates set, no quantity break.
Debtor Group PricesTier PricesDebtor price group is set to matching Magento customer group, quantity breaks set.
Custom Fieldsproduct_idCustom field "product_id" set to Magento product_id.
Enqueue - Magento OrdersImportImports a list of all Magento Orders whose "updated_at" date is newer than the Jiwa System Setting "MagentoOrdersLastSyncDate" (Note the date is adjusted from local time to UTC as the Magento "updated_at" for orders is stored in UTC), and adds them to the queue "Magento Order". 
Dequeue - Import Magento Orders (All BackOrdered)ImportCreates sales orders for all orders in the "Magento Order" queue, setting all stock deliveries to 0 - forcing all items on backorder, and processes the sales order.

If a Jiwa Sales Order with the custom field "magento_increment_id" contents matches that of the Magento order increment_id, then the Sales Order will only append comments and update two custom fields - "MagentoOrderState" and "MagentoOrderStatus". If no Sales order was found, then the following occurs:

  • Sales Order Created
  • Debtor set to cash sales debtor OR if the customer_id on the Magento order is attached to a Jiwa Debtor with the "customer_id" custom field value, then that debtor is used.
  • Magento increment_id stored in Reference and custom field "increment_id".
  • Initiated Date of sales order set "created_at" date/time of the Magento order, converted to local time.
  • Cash Sales information (Contact name, address) set to Magento order billing address
  • Snapshot Delivery information set to Magento order shipping address
  • Items are added to the order
    • Jiwa Inventory item match on Magento sku
    • Quantity Ordered set to the Magento order quantity
    • Price Inc GST of items set to Magento order item price
    • If the item is physical, the QuantityThisDelivery set to (forces all on backorder)
  • Cartage charge1 Inc GST amount set to Magento order shipping amount
  • Payment added
    • If no payment type in Jiwa matches the Magento payment type, then one is created
  • If the order is an account customer and the payment type is "purchaseorder", then the Magento purchase order No. is placed in the OrderNo field.
  • Order is saved and the payments processed - this creates a cash book receipt batch for each payment type each day - all like payment types are appended to the same cashbook receipt batch. The Cashbook transaction will have the RemitNo set to the Magento order increment_id, so the resultant bank transaction will be easily reconcilable.
  • Order is processed.

Any comments on the Magento Order not found on the Jiwa Sales Order as notes will be added as a note to the sales order.

Dequeue - Import Magento Orders (FIFO Stock)ImportCreates sales orders for all orders in the "Magento Order" queue, allocating stock on a FIFO basis.

If a Jiwa Sales Order with the custom field "magento_increment_id" contents matches that of the Magento order increment_id, then the Sales Order will only append comments and update two custom fields - "MagentoOrderState" and "MagentoOrderStatus". If no Sales order was found, then the following occurs:

  • Sales Order Created
  • Debtor set to cash sales debtor OR if the customer_id on the Magento order is attached to a Jiwa Debtor with the "customer_id" custom field value, then that debtor is used.
  • Magento increment_id stored in Reference and custom field "increment_id".
  • Initiated Date of sales order set "created_at" date/time of the Magento order, converted to local time.
  • Cash Sales information (Contact name, address) set to Magento order billing address
  • Snapshot Delivery information set to Magento order shipping address
  • Items are added to the order
    • Jiwa Inventory item match on Magento sku
    • Quantity Ordered set to the Magento order quantity
    • Price Inc GST of items set to Magento order item price
  • Cartage charge1 Inc GST amount set to Magento order shipping amount
  • Payment added
    • If no payment type in Jiwa matches the Magento payment type, then one is created
  • If the order is an account customer and the payment type is "purchaseorder", then the Magento purchase order No. is placed in the OrderNo field.
  • Order is saved and the payments processed - this creates a cash book receipt batch for each payment type each day - all like payment types are appended to the same cashbook receipt batch. The Cashbook transaction will have the RemitNo set to the Magento order increment_id, so the resultant bank transaction will be easily reconcilable.

If the sales order already exists in Jiwa, then

Any comments on the Magento Sales Order not found on the Jiwa Sales Order as notes will be added as a note to the sales order.

Enqueue - Import Magento ShipmentsImportAdds to the "Magento Shipment" queue all Magento Shipments whose "updated_at" date is newer than the Jiwa System Setting "MagentoShipmentsLastSyncDate" (Note the date is adjusted from local time to UTC as the Magento "updated_at" for shipments is stored in UTC)
Dequeue - Import Magento ShipmentsImportUpdates sales orders in the "Magento Shipment" queue - sets tracking information, and processes and closes the order.

If a Jiwa Sales Order with the custom field "magento_increment_id" contents matches that of the Magento order increment_id associated with the shipment (i.e.: If we had previously created a sales order this shipment is for), then the following occurs:

  • A New snapshot is created
  • The items on the shipment are matched to items on the sales order, and the delivery quantity on the sales order is set to the shipment quantity. If there is not enough stock for any item an exception is thrown (this may be due to a stock timing issue)
  • A note is added to the notes tab indicating a shipment has been imported and the magento shipment number is stored in the note text.
  • All tracking numbers are added to the sales order freight / consignment notes tab
  • The order is saved and then processed - this will result in a closed state if all items expected are delivered.
  • The debtor transaction created is matched and allocated fully against the debtor transaction created from the cash book transaction when the order was first received and processed

Any comments on the Magento Shipment not found on the Jiwa Sales Order as notes will be added as a note to the sales order.

Enqueue - Magento Credit MemosImportImports a list of all Magento Credit Memos whose "updated_at" date is newer than the Jiwa System Setting "MagentoCreditMemoLastSyncDate" (Note the date is adjusted from local time to UTC as the Magento "updated_at" for credit memos is stored in UTC), and adds them to the queue "Magento Credit Memo".
Dequeue - Magento Credit MemosImportCreates credit notes for all credit memos in the "Magento Credit Memo" queue.

If a Jiwa Credit Note with the custom field "magento_credit_id" contents matches that of the Magento credit memo increment_id, then the Sales Order will only append comments and update two custom fields - "MagentoOrderState" and "MagentoOrderStatus". If no credit note was found, then the following occurs:

  • Credit Note Created
  • Debtor set to debtor of the original sales order
  • Magento increment_id stored in Reference and custom field "magento_credit_id".
  • Initiated Date of sales order set "created_at" date/time of the Magento credit memo, converted to local time.
  • Cash Sales information (Contact name, address) copied from original sales order
  • Snapshot Delivery information copied from original sales order
  • Items from the credit memo are added to the order
    • Jiwa Inventory item match on Magento sku
    • Quantity Ordered set to the Magento credit memo quantity
    • Price Inc GST of items set to Magento order item price
  • Cartage charge1 Inc GST amount set to Magento credit memo shipping amount
  • Payment added
    • If no payment type in Jiwa matches the Magento payment type, then one is created
    • Payment from the original sales order is copied. This will cause a cash book payment to be created.

Any comments on the Magento Credit Memo not found on the Jiwa Credit Note as notes will be added as a note to the credit note.

Export Jiwa Stock LevelsExportUpdates Magento products with the current available (SOH - Backorders) stock. Magento products are matched by sku to the Jiwa Part No. Which items to update is controlled by two triggers - one on the IN_SOH table, and one on the IN_Onbackorder table - whenever stock levels or backorders change, the item is placed into a queue if the item is not already queued.
Export Jiwa Product CategoriesExportCreates Magento categories from the Jiwa Inventory Category1,2,3,4,5. Category 1 in Jiwa is mapped to the Magento categories of depth level 1, Category 2 is mapped to depth level 2, et cetera.
Export Jiwa Inventory ItemsExport

Creates or Updates Magento products from Jiwa Inventory Items. Items to update are taken from the queue "Jiwa Inventory", which is fed by a trigger on the table IN_Main. This queue is then processed in order they were added.

Mappings

Jiwa FieldMagento FieldNotes
PartNosku 
Descriptionproduct name 
Category1..5Magento Catalog CategoryMatches Category 1 to depth level 1 category in Magento, and matches on name. Missing Categories in Magento are created.
Details (Aux3)short_description 
PartNourl_key 
PartNourl_path 
Weightweight 
PhysicalItemmanage_stockIf physical, then the stock level is also set, in_stock set to true if stock level > 0
DecimalPlacesis_qty_decimalOnly used then Physical Item - if decimal places > 0 then is_qty_decimal is set to 1, else is_qty_decimal is set to 0
BackOrderablebackordersOnly used then Physical Item
RRPmsrpOnly if the product attribute "msrp" exists
StatusstatusActive or Slow moving items result in status enabled, otherwise set to disabled
 visibilityAlways set to 4 (Search and Catalog)
GSTOutwards.TaxRatetax_class_idWhen > 0 then Taxable goods, otherwise non-Taxable
DefaultPricepriceWhen SellPriceIncTax, then DefaultPrice, else DefaultPrice + TaxAmount
Debtor Group PricesSpecial PricesWhere Debtor group price for a null group and no quantity break)
Debtor Group PricesTier PricesWhere Debtor group price for a group and has quantity break
DocumentsImagesTries to match existing images on Jiwa Document Description to the Magento image label, if no match, image is added
Export Jiwa Sales OrdersExportCreates shipments in Magento. Obtains a list of all Jiwa Sales Orders whose "LastSavedDateTime" date is newer than the Jiwa System Setting "JiwaSalesOrdersLastSyncDateTime", where the History status is "Delivery" and the custom field "magento_shipment_id" is not set and the custom field "magento_increment_id" indicates this order originated from Magento, and adds them to the queue "Jiwa Sales Order" - then this queue is processed in order of datetime added.

The consignment note numbers on the Freight / consignment section of the sales order are added as tracking numbers to the shipment.

Export Jiwa DebtorsExportCreates customers in Magento. Obtains a list of all Jiwa debtors whose "LastSavedDateTime" date is newer than the Jiwa System Setting "JiwaDebtorsLastSyncDateTime", where the debtor is "Web Enabled", and adds them to the queue "Jiwa Debtor" - then this queue is processed in order of datetime added.

Debtors are created only - if the debtor already exists as a customer in magento then no action is taken. The debtor custom field "customer_id" is populated with the Magento customer_id when the customer is created.

Mappings

Jiwa FieldMagento FieldNotes
AcccountNofirstname 
Namelastname 
EmailAddress  
 passwordRandomly generated 36 character GUID (eg: 9D842D18-2956-477A-B7F2-BADCD121854E)
2group_idThe "Wholesale" group in Magento by default is group_id of 2.

Selected Integration Actions

When an available integration action is added as a selected integration action, you can set the Exception and Logging policies.

Exception Policy

The exception policy allows you to control the behaviour when a problem occurs. There are 3 options - Ignore, Abort Integration Action or Abort Batch.

  • Ignore will tell the system to behave as nothing occurred, and continue on. If the Integration Action is drawing from a queue (such as the "Magento Order" queue), then that queue entry will be flagged as in error, the error message attached to the queue entry. The next time the queue is processed, those queue items in error will be attempted to be processed again.
  • Abort Integration Action means move to the next step. If the Integration Action is drawing from a queue, then those unprocessed entries will remain in the queue
  • Abort Batch means to stop all remaining processing.
Logging Policy

The logging policy is useful for troubleshooting problems. There are 3 options - Exceptions, Information and Verbose

  • Exceptions means only log errors
  • Information means log exceptions AND informational details - typically these are when the system has done something, like create a product or order
  • Verbose means log exceptions and information and verbose log types - this can be useful in isolating performance issues.

About Queues

The plugin uses one physical table - Magento_Queue which contains many logical queues. An example of a logical queue is the "Magento Product" queue, which is a queue of all the Magento Products to import. An item can only go into a queue once, except when it is in a completed state - then there may be many completed entries for the same item in the same queue. This means that a product queued for updating can only appear once in the queue - this prevents unnecessary duplication of work. If an item is attempted to be added to a logical queue when it already is present, then it simply updates LastChangedDateTime field.

When queues are processed, only items in the queue which are of type pending or exception are examined. The items are processed in the order they were added to the queue.

Completed items will remain in the queue for as long as many days as the "Completed Queue Retention" setting is set to. Queue items can be manually removed using the "bin" button on the appropriate queue grid.

Queues are scoped global - they are visible to all integration configurations.

Schedules

The plugin allows the integration actions to be run manually, or on a scheduled basis. When running on a scheduled basis, the JiwaPluginScheduler service is used. Multiple schedules can be added to allow for different frequencies on different days / times. Typically one might want orders to be imported every 1 to 10 minutes during business hours, but every four hours outside business hours (allowing a sufficient window of time for any maintenance operations on either the Magento store or the Jiwa database) - so two schedules could be used in that instance.

Multiple Schedules

Schedules available to be added are those defined on the Magento Integration plugin. Only these schedules can be attached to the Magento Configuration.

Example schedule

The plugin comes with a number of pre-defined schedules:

  • Every 1 minute during work hours
  • Weekends
  • Every 10 minutes
  • Every 1 minute

By default, only the "Every 1 minute" schedule is enabled. This means, by default, only Magento Configurations with a schedule of "Every 1 minute" attached will run.

Logs

The logs are scoped to an integration configuration. The log can be filtered by right-clicking the header row and selecting "Show Filter Row" - this may be useful when trying to isolate certain log entries. Logs also have a setting controlling the number of days to retain log entries for. The log can be emptied at any time using the "Clear Log" button.

Note there is an Elapsed Milliseconds and Duration Milliseconds column in the log. Elapsed Milliseconds is the number of milliseconds elapsed since the batch was started. The duration is merely the difference in milliseconds between the current and previous log entry. Using this information, performance bottlenecks are able to be identified.

Running an Integration Configuration

Running the selected actions in configuration is done by simply pressing the "Run Selected Actions" button on the Magento Configuration form. As the actions are executed, the selected action grid will update with an indicator showing the state of the action. The queues and log grids will also update as entries are added.

Customising Integration Actions

It may be required to alter the built-in mappings between Jiwa and Magento, or there may be a need to introduce a completely different integration action.

This is achieved by the plugin system. It is not recommended to edit or alter the Magento Integration plugin - the recommended way to alter the logic or behaviour of an integration action is to create a new plugin. An example of this is provided as an document attachment to the Magento Integration plugin - the document "Sample Custom Integration Action Plugin" is in fact another plugin demonstrating how to author a new integration action - in this case it is an alternate to the "Import Magento Products" integration action, named "NEW Import Magento Products".

To make the "NEW Import Magento Products" available as an integration action, save the document to file by right clicking the document and selecting "Save As..." from the context menu which appears.

Now, using the XML Import within the Plugin Maintenance form, import the previously saved plugin XML and save. This has now created the integration action plugin. Of note is the inclusion of the "Magento Integration" on the Plugin References tab - this reference makes the code within the Magento Integration plugin accessible to this new plugin.

Exit Jiwa and log back in. Now when the Magento Configuration form is loaded the "NEW Import Magento Products" is seen in the list of available integration actions.

Tutorials

Existing Jiwa installation to new Magento store

Magento Configuration

Magento needs to be configured to expose the SOAP webservices API. Login to Magento's Admin Panel

Add SOAP/XML-RPC User


From the System menu, select Web Services SOAP/XML-RPC User, and then press the Add New User button.

Fill out the form and then press the Save User button


Add SOAP/XML-RPC Role From the System menu, select Web Services SOAP/XML-RPC Roles, and then press the Add New Role button.


Key in a Role name and enter the Magento admin password

Click on the Role Resources tab, and change the Resource Access from "Custom" to "All", Then press the Save Role button.


From the System menu, select Web Services SOAP/XML-RPC Users and then select the user added previously, click on the User Role tab, check the "Assigned" optionbox next to the previously added role, and press Save User.


Under the System / Configuration menu, Services / Magento Core API section, Enable WSDL Cache and press Save Config.

 

Jiwa Configuration

  • Open Plugin Maintenance, Enable the Plugin "Magento Integration" and save.
  • On the documents tab of the plugin, save the Menu, User Group amd SQL Script documents to file (right click, save as)
  • Exit Jiwa
  • Run the SQL Script (be sure to run against the correct database)
  • Login to Jiwa
  • Open System Settings / Menu Configuration / Menu Maintenance, Import from XML the menu XML saved previously. Save.
  • Open System Settings / Staff Configuration / User Group Maintenance, Import from XML the User group XML saved previously. Add your Jiwa staff user (eg: Admin) to the members of the group. Save.
  • Open the System Configuration Form, and on the "Magento Integration" tab enter values for the following settings:
    • MagentoWebStoreURL
    • MagentoWebStoreUsesSSL
    • MagentoUserName
    • MagentoUserName
    • MagentoStoreWarehouse
    • CashSalesDebtor
  • Open the Magento Configuration form
  • Create a new configuration by pressing the "New" button on the ribbon. Enter a Name and save. This configuration will be used to perform the initial export of Jiwa inventory categories and products to Magento.
  • Export Jiwa Inventory Categories to Magento
    • Locate and select the "Export Jiwa Product Categories" action from the "Available Actions" grid and then press the "<" button to move the available action to the selected actions grid. Then save the configuration.
    • Select the "Logs" tab on the bottom part of the form, then press the "Run Selected Actions" button. The Jiwa Inventory Categories will then be exported to Magento. Only categories not found in Magento are created. Changing the Log Policy to "Verbose" will display more information in the log as the integration runs. By default "Exceptions" is the log policy and only problems are logged.
  • Export Jiwa Products to Magento
    • Remove the "Export Jiwa Product Categories" action from the Selected actions grid by pressing the ">" button. Locate the "Export Jiwa Inventory Items" from the available actions grid and add it to the selected actions grid by pressing the "<" button. Save.

The plugin will detect which inventory items are to be exported by examining the Magento_Queue table for items with a name of "Jiwa Inventory". When we ran the magento.sql script earlier it also created a trigger on IN_Main - this trigger will automatically insert into the export queue "Jiwa Inventory" whenever a product changes or is created. To cause all products to appear in the queue, we can run a SQL script to force the trigger to run and queue all items for export:

UPDATE IN_Main SET Description = Description

This query does not change any data, but it will cause the trigger to fire and the queue table to be populated.

Refresh the Magento Configuration form and select the Queues tab and then the Jiwa Inventory Tab - it should be filled with all the products.

    • Select the Logs tab again, and change the Log policy for the selected action to be "Verbose". Click the Run Selected actions button and the export should begin and the log should update as the export progresses.

Existing Magento store to new Jiwa installation