Skip to main content

How brands and collections sync from an ERP

Brands and collections, and the links between them and products, can arrive from the ERP through synchronization.

N
Written by Niyaz

What syncs from the ERP

Brands and collections, and the links between them and products, can arrive from the ERP through synchronization. This article explains how that data arrives and how it relates to what the Admin Panel shows.

A brand or collection sync brings in the records themselves, such as each brand's or collection's name and identifier. A separate link sync connects products to those records by pairing a product key with a brand key or a collection key. Keeping the links separate lets you sync the relation independently of the product data. This matters because some ERPs, including Microsoft Dynamics, do not store the brand or collection relation on the item record.

Supported ERPs

Brand and collection sync covers five ERPs: Priority, SAP B1, Hashavshevet, Digitrade and Dynamics. The Digitrade MSSQL and Rivhit ERP types have no brand synchronization.

Sync function names

Four sync functions carry brand and collection data.

  • getBrands syncs the brand list.

  • getCollections syncs the collection list.

  • getProductBrands syncs the links between products and brands.

  • getProductCollections syncs the links between products and collections.

A function with any other name fails the sync with an error that no matching method was found. Name the collection list function getCollections, never getCollectionSets. The record type is called a collection set, which makes the wrong name easy to choose. A function entry belongs to one ERP, so each ERP that needs a function needs its own entry. These functions belong to the catalog category and take no parameters.

Identifiers by ERP

Priority and Hashavshevet identify brand and collection records with syncKey. SAP B1, Digitrade and Dynamics identify them with exId. In a link row, the brand or collection key must use the same identifier that the ERP uses for its own brand or collection records. For a Dynamics brand list, the identifier and the name are required, and translations are optional.

How a product gets its brand or collection

You can set a product's brand or collection inline, by including the key in the product data. You can also set it through the link sync, which carries the key on its own. Either route works alone, and you can configure both for the same client. A product holds one brand and one collection, so a feed that returns several rows for one product keeps only the last row. Make the query return one row per product.

Fill-only and authoritative modes

By default, a link sync only fills a brand or collection that a product does not already have. In this default mode the product data wins, and a link sync never clears an existing value. To make the link sync the owner of the relation, set authoritative to true in the metadata of its data mapping. In authoritative mode, an empty value clears the product's brand or collection. In both modes, a key that matches no known brand or collection is skipped and never clears an existing value. An unknown key is usually a sync-ordering problem rather than a deliberate removal, which is why it is skipped. Use authoritative mode when the ERP does not keep the relation on the item record, because the link sync is then the only source of it.

Child products

Child products carry the same brand and collection as their parent. The link sync pushes the parent's value down to its children itself, and clearing a parent's value clears its children's value too. With the inline route, children pick up the parent's brand when the child product sync runs after the product sync.

Order of synchronization

The syncs depend on one another, because each step reads the records already stored when it starts.

  1. The brand list or the collection list syncs first.

  2. Products sync second.

  3. The links between products and brands or collections sync last.

A brand or collection created earlier in the same run is not visible to a later step in that run.

What a sync removes

A full list sync soft-deletes brands or collections that the ERP stopped returning. A link sync never removes products, brands or collections. This is deliberate, because a link sync does not cover every product or every brand.

What you see in the Admin Panel

Open Brands or Collections in the Admin Panel menu to see those lists. The brand and collection list syncs populate the records that these lists present. The Brands table has the columns ID, ERP NAME, TRANSLATION and IMAGES.

Brands list with ID, ERP NAME, TRANSLATION and IMAGES columns

The Brands list has an ID column with a numeric ID for every brand. The ID lets you read a brand's or collection's numeric ID without opening the record. Site Builder pages that show the products of one brand or one collection need that numeric ID in the product-list component's resource setting. Read the ID from these lists when you build a brand or collection page in Site Builder.

Storefront pages

The storefront has a page that lists brands and a page for each brand, and both work with any ERP. A brand page lists the products linked to that brand. If a brand page is empty, the links between products and that brand did not land. Collection pages can be assembled in Site Builder without frontend code, using a page block that lists collections.

Related

Did this answer your question?