Skip to main content

Product synchronization for Magento 2

[missing screenshot: confluence_logo_new.png]

Field mapping


The core of the product synchronization is the map defined at System->NetSuite->Settings->Product synchronization->Field Mapping . This mapping defines the link between Magento attributes and Inventory Items custom/standard fields. Each mapping line contains 3 elements:

  • NetSuite field name. Either the custom field id from NetSuite or a standard field name, as defined in the NetSuite SuiteTalk documentation
  • NetSuite settings. Various options explained in the table below.
  • Magento . A drop-down where you can pick up a Magento attribute. If the Magento attribute is a dropdown or multi-select, then the options will be created automatically. I.e. if you import colors, you only need to create the "color" attribute in Magento and map it, no need to populate it with all possible colors before hand


SettingDescriptionExtra parameters and description
Standard FieldA InventoryItem standard field. Please refer to the SuiteTalk documentation for a full listnone
Custom Field - simple

A custom field defined in NetSuite that does not represent a list

none
Custom Field - listA custom field defined in NetSuite that represents a listNetSuite list id - the internal NetSuite id for the list
Custom Field - checkboxA custom record defined in NetSuite that has the checkbox typeValue - define the value that is to be imported in Magento when the checkbox is checked in NetSuite, i.e. "1" or "y"
Constant Magento Value

A constant value that should be set to all Magento products during import.

When selected the NetSuite field name field is hidden

Value - this is a text field to define the value that will be set in every Magento product.


You don't need to map all attributes. If you want to handle an attribute directly in Magento, then don't create any mapping for it so it will never be overwritten by NetSuite data. However, you do have to map all the attributes that are used in the creation of configurable products.

Not supported mappings

In general, the connector can import mappings to each standard or custom product attribute except media. Here are some examples of mappings that cannot be defined:

  • media images (basic logic for Image management was added recently, it requires some form of customization based on NS & Magento setup)
  • categories
  • related/upsell/cross-sell products (works out of a CSV field in NetSuite)

One to many mappings

If you want to map multiple NetSuite fields into a single Magento attribute, you can add all the NetSuite fields in the "Netsuite field name" map item, comma delimited. By default the values will be merged by adding space between them, but a custom event ("netsuite_product_fields_merge") is also thrown, allowing you to write code to do a custom merge.

Product type mapping

NetSuite TypeMagento type
Matrix ItemConfigurable product
Matrix Child ItemSimple product
Kit ItemBundle product
Assembly ItemBundle product
Inventory ItemSimple product

Complete list of imported fields

Magento fieldNetSuite fieldApplies toNotes
type_id-AllThe type of the product, according to the product type mapping above
MultipleMultipleAll

All the fields defined at System->NetSuite->Settings->Product synchronization->Field Mapping . The following fields must be mapped at a minimum:

  • SKU
  • Product name


VisibilityAs definedOnly new productsApplies to new products only according to the settings at System->NetSuite->Settings->Product synchronization.
StatusAs definedOnly new productsApplies to new products only according to the settings at System->NetSuite->Settings->Product synchronization.
Tax classAs definedOnly new productsApplies to new products only according to the settings at System->NetSuite->Settings->Product synchronization.
Website IDsAs definedOnly new productsApplies to new products only according to the settings at System->NetSuite->Settings->Product synchronization.
Store IDsAs definedOnly new productsApplies to new products only according to the settings at System->NetSuite->Settings->Product synchronization.
Attribute Set IDAs definedOnly new productsApplies to new products only according to the settings at System->NetSuite->Settings->Product synchronization.
Imported tier price customer groupAs definedOnly new productsThe default customer group to be used for tiers
Imported tier price websiteAs definedOnly new productsThe default website id to be used for tiers (All websites can also be specified)
Stock infoAs definedAll

Simple products: Quantity grabbed from the "Quantity field name" connector config and from the "Location Internal Id" location

Configurable products: always in stock (simples will handle the actual stock)

Bundles: always in stock (simples will handle the actual stock)

PriceAs definedAllGrabbed from the defined price level inside the connector config. If quantity-based prices are defined, then they will be imported as tiers
Special PriceAs definedSimpleGrabbed from defined price level inside the connector config.
Configurable attributesAs definedConfigurableMatrix items will import the matrix options as configurable attributes. All the matrix options must also be present in the mapping at System->NetSuite->Settings->Product synchronization->Field Mapping
Bundle price typeAlways set to "dynamic"Bundles
Price viewAlways set to 1 (Display "As low as")



Import / reimport scripts

Importing all products

A Magento command is exposed as netsuite:utils:importproducts that allows you to import all products

Param namePossible valuesDescription
typeEither "all" or "add-only". add-only only adds new products, while all will also update existing ones
wipe-existingnone, just add the paramStart by deleting all the products imported from NetSuite
resume-atintegerProducts are grabbed in pages. If you want to resume an import at a specific page, add the page number here
product-typesimple, configurable, bundle, assembly, allallows to import only a specific product type

Example: 

bin/magento netsuite:utils:importproducts --type all --product-type simple --resume-at 2 

The above will import simple products, starting with page 2. It will also update existing products. 

Import a single product

See the Magento shell command netsuite:utils:importsingleproduct to force the import of a specific product

Param namePossible valuesDescription
idnetsuite internal idThe netsuite internal id of the product to be imported
delete-existingnonewhether the product should be deleted first if it exists in Magento


Matrix product imports

In case you are using the NetSuite CSV import and also using matrix products, an additional step is needed after the import. You need to run a mass update on all (or only newly imported matrix items). The connector makes use of suite script + user events to populate some relational fields:

EQtcustom-fields.png

The above is usually present under the "Magento" tab on the item view screen.

Please get in touch with your NetSuite implementor or Rocket Web to create this mass update for you if needed.


Related products and Upsells

To enabled importing of the related products and upsell products you need to configure the following fields:

Param nameDescription

Related Products Field Name

This field should contain comma-separated internal IDs of the related products

Upsells Field Name

This field should contain comma-separated internal IDs of the upsells


After these are configured - all related and upsell products will be imported automatically when products will be updated in the NetSuite. Full reimport is needed to update all the products.