StyleMan Connector - Item Update
Overview
This function synchronizes item data from the StyleMan REST API to App4Sales. It retrieves items in batches, processes their details including pricing, images, stock, and various classifications (item groups), and then updates the App4Sales database. The StyleMan connector specifically disables batch updating for items, meaning it processes all available items in a single, large retrieval operation.
Data Source Configuration
Item data is pulled from the configured StyleMan REST API endpoint for items. The connector makes an HTTP GET request to {BaseUrl}/api/{Version}/Items?$orderby=ItemCode&$skip={offset}, where {BaseUrl} and {Version} are determined by the connector's configuration, and {offset} is used for pagination (though effectively disabled for StyleMan due to DisableBatchUpdate being true). Items are ordered by ItemCode.
Data Mapping Table (Items)
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
|
| Directly mapped from the StyleMan API. Whitespace is trimmed. |
|
| Directly mapped. |
|
| Directly mapped. |
|
| Directly mapped. See "Stock & Availability" for detailed logic. |
|
| Directly mapped. |
|
| Directly mapped. |
|
| Mapped from the exclusive sales price. |
|
| Directly mapped. |
|
| Mapped from the item creation timestamp. Defaults to current date/time if not provided. |
|
| Mapped from the item modification timestamp. Defaults to current date/time if not provided. |
| Hardcoded | Always set to 'E' (Exclusive). |
|
| Directly mapped. |
|
| Directly mapped. Defaults to |
|
| Mapped from the matrix code. |
|
| Mapped from the matrix description. |
|
| Mapped from the matrix ID. |
|
| Mapped from the matrix X-axis value. |
|
| Mapped from the matrix X-axis description. |
|
| Mapped from the matrix Y-axis value. |
|
| Mapped from the matrix Y-axis description. |
|
| Multi-language descriptions are mapped from the |
|
| Free fields are converted from a list of key-value pairs ( |
|
| Mapped based on the |
|
| Image data (Base64) is downloaded from provided URLs. See "Image Handling" for detailed logic. |
Data Mapping Table (Item Prices)
This table describes how individual item prices (per price list) are processed and mapped.
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
|
| Unique identifier for the item. |
|
| Internal App4Sales Price List ID. |
|
| Textual code for the price list. |
|
| Description for the price list. |
|
| The price of the item, exclusive of VAT. |
Special Logic & Filters
Price Logic
The connector fetches a list of available price lists.
It iterates through item sales prices (
SalesPricesfrom the API). For each price, it attempts to match it to an existing price list using either the internal GUID (PriceList) or an external ID (PriceListExternalId).If no matching price list is found in the ERP data, and a default Price List 1 is not provided by the ERP, the system will create a default Price List 1.
If the ERP *does* provide Price List 1, and an item price doesn't match any price list, that specific item price will be skipped to avoid overwriting ERP-provided Price List 1 data.
The
ItemCodeon individual sales price entries is populated from the main item'sItemCodeif it's missing.
Image Handling
Images are processed only if the global PIM setting
UseImagesOnlyFromPIMis disabled.The connector first attempts to retrieve images from a list of picture URLs (
PictureUrls). If this list is empty, it falls back to an obsolete single picture URL (PictureUrl).Image data is downloaded either as raw content (if
UseRelativePictureUrlis enabled) or from a full URL.A cache is used to prevent re-downloading the same image multiple times.
If an image download or processing fails, the URL is added to an
invalidUrlsset to prevent future attempts for that specific URL within the same sync.Downloaded images are stored as Base64 encoded byte arrays within App4Sales.
Stock & Availability
The item's
StockIndicatoris mapped directly if provided by the API. Otherwise, it defaults to the existing stock indicator in App4Sales or-1.If the connector's
Warehousesetting is not specified, and the item from the API providesStockValues, these values are used to populate thefullStockValuesdictionary, which is used for a global stock update.If a specific item's stock values are present in
fullStockValuesbut lack an explicitAvailableStockentry, theLastAvailableStockfor that item is calculated using a predefined stock formula based on other stock values (e.g.,ShelfStock,ToBeReceived, andToBeDelivered).
Matrix & Attributes (Item Groups and Classification)
The way item groups are processed depends on the
UseMultipleItemGroupLevelssetting.If
UseMultipleItemGroupLevelsis ON:ItemGroups(which can have nestedChildren) are recursively converted into App4SalesItemClassandItemClassValueDescriptionentities.If the App4Sales system has been "upgraded", these item groups are mapped to CMS Lookbooks (
CmsLookbook,CmsLookbookItem, etc.), with images from the item groups'PictureUrlbeing stored as media files.Otherwise (if not upgraded), they are mapped to legacy Editions (
Edition) and Mood Pictures (MoodPicture), also handling associated images and translations.Multi-language descriptions (Dutch, German, French) for item class values are extracted from the item group texts.
If
UseMultipleItemGroupLevelsis OFF:ItemGroupsthat have aValueare converted into simpleItemClassandItemClassValuepairs. TheNameof the item group becomes theItemClassdescription, and itsValuebecomes theItemClassValue.
Translations for Item Group Names and Values are retrieved and updated separately.
Domain Specifics (Expanded)
Price Logic
The connector synchronizes item prices associated with price lists. Each item can have multiple prices, one for each price list. The system prioritizes exact matches for price list IDs or external IDs from the ERP. If a price is provided without a matching price list, it may be skipped or assigned to a default price list (Price List 1) based on existing configuration.
Image Handling
Images are linked to items by downloading them from specified URLs and storing them in App4Sales. The system supports both absolute and relative image URLs. Images are typically stored as Base64 encoded strings. A local cache is maintained to optimize performance and avoid redundant downloads. Images are not processed if the system is configured to use images only from the Product Information Management (PIM) system.
Stock & Availability
Stock information, including a stock indicator and detailed stock values, is synchronized. The connector can process stock values from multiple warehouses if configured. The LastAvailableStock is either provided directly by the ERP or calculated using a formula based on components like ShelfStock, ToBeReceived, and ToBeDelivered.
Matrix & Attributes
The connector supports flexible item classification through item groups. Depending on the UseMultipleItemGroupLevels setting, these groups can represent simple attributes or complex, hierarchical structures that translate into App4Sales Item Classes. For systems that have been upgraded, these hierarchical item groups also form the basis for CMS Lookbooks. For older implementations, they contribute to Editions and Mood Pictures. Multi-language descriptions for these classifications are also supported.
Related Settings & Prerequisites
DisableBatchUpdate(StyleMan specific): Set totrue. This means all items are fetched and processed in one go, rather than in paginated batches.FilterNonIso88591Characters(StyleMan specific): Set totrue. This setting ensures that non-ISO-8859-1 characters are filtered out from strings where necessary.Warehouse: (Optional) Specifies a particular warehouse code to filter stock information. If empty, the connector may aggregate stock values differently or from all warehouses.UseRelativePictureUrl: (Boolean) Iftrue, the connector expects relative image URLs and will attempt to download them as raw content. Iffalse, it expects full URLs.UseMultipleItemGroupLevels: (Boolean) Determines how item groups are processed. Iftrue, hierarchical item groups are supported, leading to more complex mapping to ItemClasses and potentially Lookbooks/Editions. Iffalse, only single-level item groups with values are processed.DisallowDuplicateData: (Boolean) Iftrue, the system checks for duplicate item codes across batches (though withDisableBatchUpdatebeing true for StyleMan, this primarily applies to duplicates within the single response from the API). An exception is thrown if duplicates are found.SupportsStockBatchCall: (Boolean) Influences whether stock can be retrieved for multiple items in a single API call.PIM Setting (
AdministrationSession.CurrentSession.PimSettings.UseImagesOnlyFromPIM): If this global App4Sales setting istrue, the connector will skip all image handling, assuming images are managed solely by the PIM system.
Known Limitations
The StyleMan connector's
DisableBatchUpdateis hardcoded totrue, meaning large item sets might lead to long processing times or memory issues as all items are retrieved in a single API call.The
PictureUrlproperty onRestJsonItemis marked as obsolete; it's recommended to use thePictureUrlslist for multiple images.