- Blog
- How to add TaxId att in product details import for nopCommerce Sync plugin
How to add TaxId att in product details import for nopCommerce Sync plugin
- 12:47:00 PM
- Friday, June 5, 2020
Base on source data for TaxId we can have different import scenarios. We will show in this article how to map TaxCategoryId and use Lookup and TableLookup conversion types.
1. nopCommerce TaxCategoryId is used in your Data Source for products
It's a simplest scenario. We will need just to specify mapping for TaxCategoryId in ImportProducts task by adding SourceField att with xpath for your XML element(for example "./taxid")
{
"SourceField": "./taxid",
"EntityField": "TaxCategoryId"
},
2. nopCommerce TaxCategory.Name is used in your Data Source for products
We will need to use TableLookup conversion here.
- Add TaxCategoryConvertion to the Conversions array
{
"Name": "TaxCategoryConvertion",
"Type": "TableLookup",
"IdColumnName": "Id",
"ValueColumnName": "Name",
"TableName": "TaxCategory"
},
- Specify conversion for your mapping
{
"SourceField": "./taxname",
"EntityField": "TaxCategoryId",
"ConversionName": "TaxCategoryConvertion"
},
3. External Tax Names is used in your Data Source for products
If you're not planning to change tax categories dynamically, we can use Lookup conversion here to map your external names to nopCommerce TaxCategoryId.
- Add TaxCategoryConvertion to the Conversions array
{
"Name": "TaxCategoryConvertion",
"Type": "Lookup",
"Maps": {
"Electronics & Software": "2",
}
},
- Specify conversion for your mapping
{
"SourceField": "./taxname",
"EntityField": "TaxCategoryId",
"ConversionName": "TaxCategoryConvertion"
},
Also, you can create your own conversion for more complex scenario..
For example, if you need to have lookup in your external system or add Tax Categories to nopCommerce dynamically.