Initial product import
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:
| Name | Example value | Description |
|---|---|---|
| dry-run | n/a | This 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-field | itemId | This is the name of a standard NetSuite field that corresponds to the sku. It defaults to itemId |
| --sku-resume-at | SKU | A 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:
| Parameter | Example value | Description |
|---|---|---|
| --type | all or add-only | "all" will both add new products and change existing ones. "add-only" only adds new products |
| --wipe-existing | n/a | If 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-at | 2 | The page number to resume at. Useful if script crashes and you want to restart at a specific point |
| --product-type | all, simple, configurable | The types of products to import. Defaults to all. |
| --auth-type | token | Specify 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-id | 171199F6-3EE8-4219-BDEA-FD0D8747F0FB | App Id to use in case of custom authentication. Needed for both token and user authentications. |
| --consumer-key | c23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d82 | Consumer key in case of custom authentication. Needed for token authentications. |
| --consumer-secret | c23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d82 | Consumer secret in case of custom authentication. Needed for token authentications. |
| --token-id | c23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d82 | Token id in case of custom authentication. Needed for token authentications. |
| --token-secret | c23bee1d94930c9f110ce3c577060476a3184bd4024613258987c41255858d82 | Token secret key in case of custom authentication. Needed for token authentications. |
| --user | fooo@example.com | Specify a NetSuite user for the import. Needed for user authentications. |
| --password | asd3er2423 | Specify a NetSuite password for the import. Needed for user authentications. |
| --debug | n/a | More debug messages |
| --multi-login | n/a | See 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.
No comments to display
No comments to display