Bulk override of the categories images and products images


Is there any way to override old images with the new one, if the images names are the same?


The image in the assets folder is Image_1234678.jpg

the new image in the folder has the same name Image_1234678.jpg.

Apr 25, 2016 11:40

How were you uploading images before?

Apr 25, 2016 18:10

We did it via File manager in the assets pane. Then the images were assigned to the products. Now there are a folder with updated images on the disk , that have the same name as uploaded and linked. Is there any possibility to replace the assigned with the new aotimatically?

Apr 26, 2016 7:32


If you know the ContentLink or the ContentGuid of the new Images, then you can simply do this:

- Iterate over the products.

- Foreach the product, iterate over its CommerceMediaCollection, for each CommerceMedia you will have the ContentLink of the asset - get the content to get its name and match it with the maps you have.

- Replace the old CommerceMedia with new CommerceMedia points to new ContentLink.

- Save the product content.

If you don't know the ContentLink of new images then it'll be trickier. From the old CommerceMedia you can get the name, then search for the name to find new ContentLink. Of course it'll be slower.



Apr 26, 2016 11:28
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.