Depending on the respective environment, it may be necessary, for example, to adapt the format for the format contained in the CSV files to the respective locale.

Since with 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 a corresponding snippet, e.g. 'app/etc/configuration/operations.json', which has the following content

{
    "operations": {
        "general": {
            "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,
                                "date-converter": {
                                    "source-date-format": "d.m.y, H:i"
                                },
                                "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.callback.custom.array.validator"],
                                    "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"]
                                }]
                            }]
                        }
                    }
                }
            }
        },
        "ce": {
            "catalog_product": {
                "add-update": {
                    "plugins": {
                        "subject": {
                            "id": "import.plugin.subject",
                            "subjects": [{
                                "id": "import_product.subject.bunch",
                                "date-converter": {
                                    "source-date-format": "d.m.y, H:i"
                                },
                                "file-resolver": {
                                    "prefix": "product-import"
                                },
                                "params": {
                                    "copy-images": 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"
                                    ]
                                }]
                            }]
                        }
                    }
                }
            }
        }
    }
}

In the example above, we override the validation as well as the add-update operation, as both need the appropriate date format. As this changed the date format to d.m.y, H:i, the file MUST contain dates like 17.01.20, 14:11.

Next Post Previous Post

Load Comments

Please note that by clicking "Load Comments", your browser will establish a connection with servers from Disqus.
For more information, please visit our privacy statement.