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 |
Cleanup Flags
Images |
Clean-up images |
|
Media gallery |
Clean-up media gallery |
|
Category Product relations |
Clean-up category product relations |
|
Website Product relations |
Clean-up website Product relations |
|
Tier Prices |
Clean-up tier prices |
|
URL Rewrites |
Clean-up URL rewrites |
|
Clean-up empty columns |
Clean-up empty columns for product attributes and additional attributes |
|
Product variant |
Clean-up product variant |
|
Product Links |
Clean-up product links |
Images/Media Gallery
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':
{
"operations" : {
"ce" : {
"catalog_product" : {
"add-update" : {
"plugins" : {
"subject" : {
"id" : "import.plugin.subject" ,
"subjects" : [
{
"id" : "import_product_ee.subject.bunch" ,
"file-resolver" : {
"prefix" : "product-import"
} ,
"params" : {
"copy-images" : false ,
"media-directory" : "pub/media/catalog/product" ,
"images-file-directory" : "var/importexport/media/catalog/product" ,
"clean-up-media-gallery" : true , (1)
"clean-up-empty-image-columns" : true , (2)
},
"observers" : [
{
"import" : [
"import_product_ee.observer.composite.base.add_update"
]
}
]
}
]
}
}
}
}
}
}
}
1 | To set the clean-up-media-gallery flag to true or false |
2 | To set the clean-up-empty-image-columns flag to true or false
|
If you are unsure what to do, both flags should have the same value. |
Category Product 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 totrue
:
{
"operations" : {
"ce":{
"catalog_product": {
"add-update": {
"plugins": {
"subject": {
"id": "import.plugin.subject",
"subjects": [
{
"id": "import_product_ee.subject.bunch",
"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-category-product-relations" : true ,(1)
}
"observers": [
{
"import": ["import_product_ee.observer.composite.base.add_update"]
}
]
}
]
}
}
}
}
}
}
}
1 | To set the clean-up-category-product-relations flag to true or false .
|
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 |
Website Product relations
Suppose the product-website relationships change frequently, and it becomes necessary to update them with
the add-update
operation.
Example
- In that case, it can get achieved by setting the
clean-up-website-product-relations
flag to true:
{
"operations" : {
"ce":{
"catalog_product": {
"add-update": {
"plugins": {
"subject": {
"id": "import.plugin.subject",
"subjects": [
{
"id": "import_product_ee.subject.bunch",
"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-website-product-relations": true,(1)
"observers": [
{
"import": [
"import_product_ee.observer.composite.base.add_update"
]
}
]
}
]
}
}
}
}
}
}
}
1 | To set website-relations flag to true or false
|
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 |
Tier prices
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
.
Example
{
"operations": {
"catalog_product": {
"add-update.tier-prices": {
"plugins": {
"subject": {
"id": "import.plugin.subject",
"listeners": [
{
"plugin.process.success": [
"import_product_tier_price.listener.delete.obsolete.tier_prices"
]
}
],
"params": {
"clean-up-tier-prices": true,(1)
},
"subjects": [
{
"id": "import_product_tier_price.subject.tier_price",
"listeners": [
{
"subject.import.success": [
"import_product.listener.register.sku.to.pk.mapping"
]
}
],
"file-resolver": {
"prefix": "tier-price"
},
"observers": [
{
"import": [
"import_product_tier_price.observer.tier_price.update"
]
}
]
}
]
}
}
}
}
}
}
1 | To set clean-up-tier-prices flag to true or false
|
Url rewrite
Since the category/product functionality in Magento is more basic, the clean-up only provides a flag for the URL rewrites.
Example Category url rewrite
- As with the category 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 | To set Url rewrites flag to true or 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
|
Product Variants
-
In Magento 2, a product variant refers to a specific variation or option of a configurable product
-
A configurable product is a parent product that represents a set of related products with different attributes, such as size, color, or material
-
Each unique combination of attributes represents a variant of the configurable product.
-
To delete this relation set the
clean-up-variants
flag totrue
Example
{
"operations": {
"catalog_product": {
"add-update": {
"plugins": {
"subject": {
"id": "import.plugin.subject",
"subjects": [
{
"id": "import_product_ee.subject.bunch",
"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,(1)
}
"observers": [
{
"import": ["import_product_ee.observer.composite.base.add_update"]
}
]
}
]
}
}
}
}
}
}
1 | To set the clean-up variants flag to true or false , false is set by default |
Product Links
In Magento 2, product links refer to the associations or relationships between different products within the system. These links allow you to establish connections between products based on various criteria. Magento 2 provides several types of product links that serve different purposes
-
To delete this relation set the
clean-up-links
flag totrue
-
This cleanup removes all old relationships that no longer exist.
-
This cleanup should first be enabled (see example). The file should only contain existing relationships, which will delete the old ones
Example
{
"operations": {
"catalog_product": {
"add-update": {
"plugins": {
"subject": {
"id": "import.plugin.subject",
"subjects": [
{
"id": "import_product_ee.subject.bunch",
"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-links": false,(1)
}
"observers": [
{
"import": ["import_product_ee.observer.composite.base.add_update"]
}
]
}
]
}
}
}
}
}
}
1 | To set the clean-up links flag to true or false , false is set by default |
Disable clean-up
Example
- To disable the clean-up function, override the operations file and set the
clean-up-*
flags to false in<custom-configuration-dir>/operations.json
: -
-
Disable
copy-images
clean-up -
Disable
clean-up-media-gallery
clean-up -
Disable
clean-up-empty-image-columns
clean-up -
Disable
clean-up-website-product-relations
clean-up -
Disable
clean-up-category-product-relations
clean-up -
Disable
clean-up-variants
clean-up -
Disable
clean-up-links
clean-up -
See described
clean-up-empty-columns
option array format for empty fields
-