beta.blog

Random()

hybris: Remove all ONLINE medias, products, etc

by on Apr.27, 2020, under Programming, Random()

In order to delete all Medias, Products or any other Itemtype by specific search criteria, first go to hybris administration console (hac) and go to Impex Export. Tick the checkbox that says “Enable code execution” and use a script similar to:

REMOVE Media;pk[unique=true]
"#% impex.exportItemsFlexibleSearch(""SELECT {pk} FROM {Media AS m JOIN CatalogVersion AS cv ON {cv.pk}={m.catalogVersion}} WHERE {cv.version}='Online'"");"

This will generate a .zip file containing an Impex Script with the remove header as well as a csv file containing all items to delete. You may then go back to hac and this time go to Impex Import. Simply import the zip file exported previously and it will delete all Medias matching your criteria.

Needless to say, one may replace the query used to choose which items get deleted with any other query matching their criterias.

Leave a Comment :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!