Skip to main content

Initial product import

[missing screenshot: confluence_logo_new.png]

The initial product import can be done after completing all NetSuite configuration. There are two different cases:

  • you already have the products in Magento, so you only need to "link" them to their NetSuite counterpart
  • you do not have the products in Magento, so you need to import them

Linking existing NetSuite products

This can be accomplished with the following command:

php bin/magento netsuite:utils:netsuiterelinkproductsbysku

The following parameters can be passed:

NameExample valueDescription
dry-runn/aThis will execute the job and print output, but will not do any changes. Highly recommended to do a dry-run first to make sure the configuration is correct
--netsuite-sku-fielditemIdThis is the name of a standard NetSuite field that corresponds to the sku. It defaults to itemId
--sku-resume-atSKUA sku to resume at. This is useful if the script crashes and you want to continue without having to relink all products to that point


Importing products

Normal import

A full import can be trigger with:

php bin/magento netsuite:utils:importproducts --type all


The following parameters can be passed:

ParameterExample valueDescription
--typeall or add-only"all" will both add new products and change existing ones. "add-only" only adds new products
--wipe-existingn/aIf this is passed, the whole catalog is deleted before the import. Useful if you realised you did an incorrect full import and want to start over
--resume-at2The page number to resume at. Useful if script crashes and you want to restart at a specific point
--product-typeall, simple, configurableThe types of products to import. Defaults to all.
--auth-typetokenSpecify an authentication type, if you want to use another set of credentials that is not defined in system configuration. Valid values are "user" and "token"
--app-id171199F6-3EE8-4219-BDEA-FD0D8747F0FBApp Id to use in case of custom authentication. Needed for both token and user authentications.
--consumer-keyc23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d82Consumer key in case of custom authentication. Needed for token authentications.
--consumer-secretc23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d82Consumer secret in case of custom authentication. Needed for token authentications.
--token-idc23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d82Token id in case of custom authentication. Needed for token authentications.
--token-secretc23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d82Token secret key in case of custom authentication. Needed for token authentications.
--userfooo@example.comSpecify a NetSuite user for the import. Needed for user authentications.
--passwordasd3er2423Specify a NetSuite password for the import. Needed for user authentications.
--debugn/aMore debug messages
--multi-loginn/aSee the "Multi-threaded" section below


Multi-threaded import

For huge product catalogs, it might make sense to use multiple threads to import products. First, you need to have more NetSuite users, as only one NetSuite user can handle a request at one time. Get the users, passwords and application IDs and add them in a csv file in the following format (user, pass, app id):

webuser@rocketweb.com,324234234,171199F6-3EE8-4219-BDEA-FD0D8747F0F2
gregor.pollak@rocketweb.com,21312312,171199F6-3EE8-4219-BDEA-FD0D8747F0F2
paul@rocketweb.com,asdasdas,171199F6-3EE8-4219-BDEA-FD0D8747F0F2

Or, for tokens (consumer key, consumer secret, token id, token secret, app id:

c23bee1d94930c9f110ce3c50476a3184bd4024613258987c41255858d89,c23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d,c23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d3,c23bee1d94930c9f110ce3c577060476a3184bd40246132589,171199F6-3EE8-4219-BDEA-FD0D8747F0F2
c23bee1d94930c9f110ce3c50476a3184bd4024613258987c41255858d89,c23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d,c23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d3,c23bee1d94930c9f110ce3c577060476a3184bd40246132589,171199F6-3EE8-4219-BDEA-FD0D8747F0F2


Then start the import, passing the path to the CSV file in the multi-login parameter:

php bin/magento netsuite:utils:importproducts --type all --multi-login tokens.csv --auth-type token


The import script will iterate through all the logins, check that they are valid, then create an import thread for each.