Skip to main content

King - Item sync

King Connector - Item Update This document describes the item synchronization process for the King connector. The process involves retriev...

Updated over a week ago

King Connector - Item Update

This document describes the item synchronization process for the King connector. The process involves retrieving item data from XML files via an FTP server and enriching it with stock information from a web service.

Data Source Configuration

The item update process uses the following data sources:

  • FTP Server: Item data is read from XML files located on an FTP server. The FTP connection details (host, username, password) are configured in the administration settings. The following files are used:

    • items.xml: Contains the main item data.

    • itemfilters.xml: Contains information about item classes (attributes).

  • King Web Service: Stock information is retrieved from the King `MultegraKingWS.asmx` web service. The endpoint for fetching stock is `BepaalVoorraadPerMagazijn`.

Data Mapping

App4Sales Field

Source Field (XML)

Logic/Notes

ItemCode

entity.ID

Mapped from the `ID` attribute of the `entity` node in `items.xml`.

Description

items.description

Mapped from the `items.description` field.

SalesPrice

items.salespackageprice

Mapped from the `items.salespackageprice` field. The value is converted to a decimal.

Currency

N/A

Hardcoded to the currency symbol from the administration settings, or defaults to 'EUR'.

EanCode

items.eancode

Mapped from the `items.eancode` field.

VatIncluded

items.vatincluded

Mapped from the `items.vatincluded` field. The value is converted to a character.

VatPercentage

items.vatpercentage

Mapped from the `items.vatpercentage` field. If the value contains a '~', it's split to get the VAT code and country to look up the percentage. Otherwise, it's parsed as a decimal.

PurchasePackageSize

items.purchasepackagesize

Mapped from the `items.purchasepackagesize` field. The value is converted to a decimal.

Description2, Description3, Description4, Description5

items.description2, items.description3, items.description4, items.description5

Additional description fields.

Unit

items.unit

Mapped from the `items.unit` field.

LastAvailableStock

items.lastavailablestock

Mapped from the `items.lastavailablestock` field. The value is converted to a decimal.

NextDelivery

items.nextdelivery

Mapped from the `items.nextdelivery` field. The value is converted to a nullable DateTime.

MinimumOrderQuantity

items.minimumorderquantity

Mapped from the `items.minimumorderquantity` field. The value is converted to a decimal.

RelatedItems

items.relateditems

Mapped from the `items.relateditems` field. This XML contains linked items for the item detail card.

RelatedItemsText

items.relateditemstext

Mapped from the `items.relateditemstext` field. This is a search field to link items.

ItemClasses

itemclassvalues.value[index]

Item classes are created based on the `itemclassvalues.value` fields. The description of the item class is looked up in the `itemfilters.xml` data using the index.

PicturesBytes

items.picture

Mapped from the `items.picture` field, which is expected to be a Base64 encoded string.

Domain Specifics

Price Logic

The connector supports multiple price lists. Prices are read from fields with the pattern `items.price_X` in the `items.xml` file, where X is the ID of the price list. These are then stored as separate price lists in App4Sales.

App4Sales Entity

Source Field (XML)

Logic/Notes

PriceListPrice

items.price_2, items.price_3, items.price_4

Creates a `PriceListPrice` for each `items.price_X` field found. The price list code is derived from the number in the field name.

Stock & Availability

Stock information is retrieved from both the `items.xml` file and a real-time web service call to the King ERP system.

App4Sales Field

Source

Logic/Notes

LastAvailableStock

items.lastavailablestock (from items.xml)

Initial stock value from the XML file.

StockIndicator

King Web Service (`BepaalVoorraadPerMagazijn`)

The stock indicator is calculated based on the `available` stock returned by the web service. The color of the indicator (red, orange, green) is determined by the `QuantityForRed` and `QuantityForGreen` settings in App4Sales. A custom Jint script (`CalculateStockIndicatorByFormula`) can also be used for more complex calculations.

Matrix & Attributes

The connector supports matrix items (parent/child relationships).

App4Sales Field

Source Field (XML)

Logic/Notes

MatrixParent

items.matrixparent

This field links a child item to its parent item.

MatrixXDescription

items.matrixxdescription

The description for the X-axis of the matrix (e.g., 'Color').

MatrixXValue

items.matrixxcode

The value for the X-axis of the matrix (e.g., 'Red').

MatrixYDescription

items.matrixydescription

The description for the Y-axis of the matrix (e.g., 'Size').

MatrixYValue

items.matrixycode

The value for the Y-axis of the matrix (e.g., 'XL').

Related Settings & Prerequisites

The following settings can influence the item update process:

  • Webservice Address: The URL of the King web service.

  • Webservice Port: The port of the King web service.

  • Warehouse: The default warehouse to use when fetching stock information.

  • Get Stock Indicator By Formula: If enabled, the stock indicator is calculated using a formula or script. Otherwise, it is based on the `items.stockindicator` field from the XML.

  • Only Import Items With Price List: This setting can be used to filter items based on whether they have a price in a specific price list.

  • Only Update New Pictures: If enabled, the connector will only update new pictures and not re-process existing ones.

Known Limitations

  • The connector does not sync barcodes.

  • The connector only supports one warehouse at a time when fetching stock information.

Did this answer your question?