Operations

Extend Configuration

Add the subject that processes the ENTITY to your configuration file, see available Entity Type Code

The configuration for the appropriate operations has to get extended /changed as follows

The best strategy to extend/customize the configuration file operations.json is either:

  • Create a custom Magento module including all modifications

  • Create a copy of operations.json under app/etc/configuration/operations.json, remove unnecessary default lines/sections, and insert the needed customizations in the new operations.json

add-update

For the add-update operation, the configuration has to be structured as following code
        "add-update": { (1)
          "plugins" : [
            {
              "id": "import.plugin.subject", (2)
              "subjects": [
                ...,
                {
                  "id": "import_product.subject.bunch", (3)
                  ...,
                  "observers": [
                    {
                      "import": [
                        "import_product.observer.composite.base.add_update", (4)
                        "import_product_msi.observer.product.source.item" (5)
                      ]
                    }
                  ]
                },
                ...,
                {
                  "id": "import_product_msi.subject.bunch", (6)
                  "identifier": "files", (7)
                  "file-resolver": {
                    "prefix": "inventory-msi" (8)
                  },
                  "observers": [
                    {
                      "import": [
                        "import_product_msi.observer.inventory.source.item.update" (9)
                      ]
                    }
                  ]
                }
              ]
            }
            ...,
          ]
        },
      }
    }
  }
}
1 Find add-update section
2 Find id: import.plugin.subject section
3 Find id: import_product_msi.subject.bunch section
4 Add the observer import_product.observer.composite.base.update to import
5 Add the observer import_product_msi.observer.product.source.item to import
6 Find next id: import_product_msi.subject.bunch section
7 Add/find identifier: files
8 Update file-resolver.prefix value to inventory-msi. This can be any name for the generated file prefix.
9 Add the observer import_product_msi.observer.inventory.source.item.update to import

replace

For the replace operation, the configuration has to be structured as following code
        "replace": { (1)
          "plugins" : [
            {
              "id": "import.plugin.subject", (2)
              "subjects": [
                {
                  "id": "import_product.subject.bunch", (3)
                  ...,
                  "observers": [
                    {
                      "import": [
                        "import_product.observer.composite.base.replace", (4)
                        "import_product_msi.observer.product.source.item" (5)
                      ]
                    }
                  ]
                },
                ...,
                {
                  "id": "import_product_msi.subject.bunch", (6)
                  "identifier": "files", (7)
                  "file-resolver": {
                    "prefix": "inventory-msi" (8)
                  },
                  "observers": [
                    {
                      "import": [
                        "import_product_msi.observer.clear.inventory.source.item", (9)
                        "import_product_msi.observer.inventory.source.item" (10)
                      ]
                    }
                  ]
                }
              ]
            }
            ...,
          ]
        },
1 Find replace section
2 Find id: import.plugin.subject section
3 Find id: import_product_msi.subject.bunch section
4 Add the observer import_product.observer.composite.base.replace to import
5 Add the observer import_product_msi.observer.product.source.item to import
6 Find next id: import_product_msi.subject.bunch section
7 Add/find identifier: files
8 Update file-resolver.prefix value to inventory-msi. This can be any name for the generated file prefix.
9 Add the observer import_product_msi.observer.clear.inventory.source.item to import
10 Add the observer import_product_msi.observer.inventory.source.item to import

delete

For the delete operation, the configuration has to be structured as the following code
{
  "operations": {
    "general": {
      "catalog_product_inventory_msi": {
        "delete": { (1)
          "plugins" : [
            {
              "id": "import.plugin.subject", (2)
              "subjects": [
                ...,
                {
                  "id": "import_product.subject.bunch", (3)
                  ...,
                  "observers": [
                    {
                      "import": [
                        "import_product.observer.last.entity.id", (4)
                        "import_product_msi.observer.product.source.item", (5)
                        "import_product.observer.composite.base.delete" (6)
                      ]
                    }
                  ]
                },
                ...,
                {
                  "id": "import_product_msi.subject.bunch", (7)
                  "identifier": "files", (8)
                  "file-resolver": {
                    "prefix": "inventory-msi" (9)
                  },
                  "observers": [
                    {
                      "import": [
                        "import_product_msi.observer.clear.inventory.source.item" (10)
                      ]
                    }
                  ]
                }
              ]
            }
            ...,
          ]
        },
1 Find delete section
2 Find id: import.plugin.subject section
3 Find id: import_product_msi.subject.bunch section
4 Add the observer import_product.observer.last.entity.id to import
5 Add the observer import_product_msi.observer.product.source.item to import
6 Add the observer import_product.observer.composite.base.delete to import
7 Find next id: import_product_msi.subject.bunch section
8 Add/find identifier: files
9 Update file-resolver.prefix value to inventory-msi. This can be any name for the generated file prefix.
10 Add the observer import_product_msi.observer.clear.inventory.source.item to import