Clean-up

Pacemaker Community Edition provides a clean-up function that removes values for empty columns or relations that are no longer part of the CSV file.

Deleting data can significantly impact performance; the clean-up function should get used with caution.

It is recommended to use the add-update operation since it is generally only added or updated if it is already present

Product import

The clean-up functionality for product import is enabled by default and available for the following listed areas and all product attributes (clean-up-empty-columns) that require additional configuration:

Images

clean-up-empty-image-columns

Clean-up images

Media gallery

clean-up-media-gallery

Clean-up media gallery

Category Relations

clean-up-category-product-relations

Clean-up category relations

Website Relations

clean-up-website-product-relations

Clean-up website relations

Tier Prices

clean-up-tier-prices

Clean-up tier prices

URL Rewrites

clean-up-url-rewrites

Clean-up URL rewrites

Clean-up empty columns

clean-up-empty-columns

It is helpful to delete images that are no longer included in the CSV files from the database most of the time.

The Image type, e.g., is stored in different tables:
  • Thumbnail as an attribute

  • Links to the product

  • As well as name and position

Example

To clean-up both, it is necessary to set the flags to the default value 'true':
...
  "params": {
    ...,
    "clean-up-category-product-relations": "true",
    "clean-up-media-gallery": "true"
  },
...

If you are unsure what to do, both flags should have the same value.

Category relations

In many cases, the product category relationships do not change infrequently.

Suppose the product category relationships change frequently, and it is necessary to update them with the add-update operation.

Example

That can get performed by setting the clean-up-category-product-relations flag to true:
...
  "params": {
    ...,
    "clean-up-category-product-relations": "true"
  },
...

Since the product-category relation gets not persist to only one column, this relation cannot be cleaned-up by adding a column name to the clean-up-empty-columns array.

Website relations

Suppose the product-website relationships change frequently, and it becomes necessary to update them with the add-update operation.

Example

In that case, that can get achieved by setting the clean-up-website-product-relations flag to true:
...
  "params": {
    ...,
    "clean-up-website-product-relations": "true"
  },
...

Since the product-website-relationship gets not persist to only one column, that relationship cannot be cleaned up by adding a column name to the clean-up-empty-columns array

Tier prices

Example

Prices nearly always need to be up-to-date, so if tier prices are imported, the clean-up functionality should be activated by setting the flag clean-up-tier-prices to true:
...
  "params": {
    ...,
    "clean-up-tier-prices": "true"
  },
...

Categories

Since the category functionality in Magento is more basic, the clean-up only provides a flag for the URL rewrites.

Example

As with the product import, the flags must get configured at the subject level, e.g.:
{
  "operations": {
    "ce": {
      "catalog_category": {
        "add-update.url-rewrite": {
          "plugins": {
            "subject": {
              "id": "import.plugin.subject",
              "subjects": [ (1)
                {
                  "id": "import_category.subject.bunch",
                  "file-resolver": {
                    "prefix": "category-url-rewrite"
                  },
                  "params": {
                    "clean-up-url-rewrites": "false" (2)
                  },
                  "observers": [
                    {
                      "import": [
                        "import_category.observer.url.rewrite.update"
                      ]
                    }
                  ]
                }
              ]
            }
          }
        }
      }
    }
  }
}
1 Subject level
2 Url rewrites flag is set to false

Category url rewrites

Cleaning-Up URL rewrites will be necessary in most cases.

Example

To deactivate it, set the flag clean-up-url-rewrites to false:
...
  "params": {
    ...,
    "clean-up-url-rewrites": "false"
  },
...

Clean-up empty columns

Comma seperated ( , ) array list to define empty values for product attributes and additional attributes

Be aware that the columns specified in additional_attributes must be cleaned and contain empty values, e.g. if the following columns columns activity and in_recommends need to get cleaned, the column additional_attributes must contain the value "activity=,erin_recommends=" as a valid format.

Valid empty column format examples:
  • ["<column>="]

  • ["<column1>=,<column2>="]

Example

To enable the clean-up functionality for product attributes and additional attributes, the columns to get cleaned up must get specified in the clean-up-empty-columns array:
...
  "params": {
    ...,
    "clean-up-empty-columns": ["activity", "erin_recommends"]
  },
...

Disable clean-up

Example

To disable the clean-up function, add the following snippet and overwrite the corresponding clean-up-* flags in <custom-configuration-dir>/operations.json:
    "ce": {
      "catalog_product": {
        "add-update": {
          "plugins": {
            "subject": {
              "id": "import.plugin.subject",
              "subjects": [
                {
                  "id": "import_product.subject.bunch",
                  "file-resolver": {
                    "prefix": "product-import"
                  },
                  "params": {
                    "copy-images": false, (1)
                    "clean-up-media-gallery": false, (2)
                    "clean-up-empty-image-columns": false, (3)
                    "clean-up-website-product-relations": false, (4)
                    "clean-up-category-product-relations": false, (5)
                    "clean-up-empty-columns": [] (6)
                  },
                  "observers": [
                    {
                      "import": [
                        "import_product.observer.composite.base.add_update"
                      ]
                    }
                  ]
                }
              ]
            }
          }
        }
      }
    }