Change the import number format
Depending on the respective environment, it may be necessary, for example, to adapt the format for the numbers contained in the CSV files to the respective locale.
In the example below, we override the validation as well as the add-update operation, as both need
the appropriate number format. As this changed the number format to locale de_DE the file *MUST
* contain numbers like 1.408,88
.
Since as of version 3.8.0 it is no longer necessary to overwrite the complete configuration file, but only
the affected configurations, it is sufficient to create an appropriate snippet, e.g.
|
Example: operations.json
{
"operations":{
"ce":{
"catalog_product":{
"validate":{
"plugins":{
"subject":{
"id":"import.plugin.subject",
"listeners":[
{
"plugin.process.start":[
"import.listener.reset.loader.eav.attribute.option.value"
],
"plugin.process.success":[
"import.listener.stop.validation"
]
}
],
"subjects":[
{
"id":"import.subject.validator",
"create-imported-file":false,
"number-converter":{
"locale":"de_DE"
},
"file-resolver":{
"prefix":"product-import"
},
"listeners":[
{
"subject.artefact.header.row.process.start":[
"import.listener.validate.header.row"
]
}
],
"params":{
"custom-validations":{
"sku":[
"/.+/"
],
"product_type":[
"simple",
"virtual",
"configurable",
"bundle",
"grouped",
"giftcard"
],
"visibility":[
"Not Visible Individually",
"Catalog",
"Search",
"Catalog, Search"
]
}
},
"observers":[
{
"import":[
"import_product.observer.composite.base.validate"
]
}
],
"callbacks":[
{
"sku":[
"import.callback.custom.regex.validator"
],
"store_view_code":[
"import.callback.store.view.code.validator"
],
"attribute_set_code":[
"import.callback.attribute.set.name.validator"
],
"product_type":[
"import_product.callback.validator.product_type"
],
"tax_class_id":[
"import_product.callback.validator.tax.class"
],
"product_websites":[
"import.callback.store.website.validator"
],
"visibility":[
"import.callback.visibility.validator"
],
"related_skus":[
"import_product.callback.validator.link"
],
"upsell_skus":[
"import_product.callback.validator.link"
],
"crosssell_skus":[
"import_product.callback.validator.link"
],
"created_at":[
"import.callback.validator.datetime"
],
"updated_at":[
"import.callback.validator.datetime"
],
"special_price_to_date":[
"import.callback.validator.datetime"
],
"special_price_from_date":[
"import.callback.validator.datetime"
],
"custom_design_to":[
"import.callback.validator.datetime"
],
"custom_design_from":[
"import.callback.validator.datetime"
],
"new_to_date":[
"import.callback.validator.datetime"
],
"new_from_date":[
"import.callback.validator.datetime"
],
"price":[
"import.callback.validator.number"
],
"special_price":[
"import.callback.validator.number"
],
"map_price":[
"import.callback.validator.number"
],
"msrp_price":[
"import.callback.validator.number"
],
"qty":[
"import.callback.validator.number"
]
}
]
}
]
}
}
},
"add-update":{
"plugins":{
"subject":{
"id":"import.plugin.subject",
"subjects":[
{
"id":"import_product.subject.bunch",
"number-converter":{
"locale":"de_DE"
},
"file-resolver":{
"prefix":"product-import"
},
"params":{
"copy-images":false,
"media-directory":"pub/media/catalog/product",
"images-file-directory":"var/importexport/media/catalog/product",
"update-url-key-from-name":true,
"clean-up-variants":false,
"clean-up-links":false,
"clean-up-media-gallery":true,
"clean-up-empty-image-columns":true,
"clean-up-website-product-relations":true,
"clean-up-category-product-relations":true,
"clean-up-empty-columns":[
"special_price",
"special_price_from_date",
"special_price_to_date"
]
},
"observers":[
{
"import":[
"import_product.observer.composite.base.add_update"
]
}
]
}
]
}
}
}
}
}
}
}