Inhalte aufrufen

Profilbild

Suggestion how to update pictures on lots of products


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
3 Antworten zu diesem Thema

#1 altmoola

altmoola

    Advanced Member

  • Members
  • 41 Beiträge

Geschrieben: 10 April 2020 - 00:04

I'm looking to know the best way to perform two operations in bulk (from a list of product IDs):

 

  1. Add an image with DisplayOrder = 0 so that the image becomes the new thumbnail
  2. Change the reference across many products to use the same image


#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3541 Beiträge

Geschrieben: 13 April 2020 - 16:43

If possible you should wait for version 4.0, because 2. will only be possible with 4.0. Otherwise I recommend to look at ProductImporter.ProcessProductPictures for bulk importing images. The main image of a product is referenced by the property Product.MainPictureId, which usually is the product picture with the lowest DisplayOrder.

  • stefanmueller gefällt das

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#3 altmoola

altmoola

    Advanced Member

  • Members
  • 41 Beiträge

Geschrieben: 21 April 2020 - 16:46

Just curious, for #2, is there a reason I couldn't just run a direct SQL update on the Product_Picture_Mapping table where I update all products with PictureId = X to PictureId = Y? I suppose I'd have to clear the cache as well after this.

UPDATE Product_Picture_Mapping
SET    PictureId = Y
WHERE  PictureId = X AND ProductId IN (<List>)


#4 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3541 Beiträge

Geschrieben: 21 April 2020 - 19:02

A multiple assignment of one image to several products will only be possible with 4.0.
Product_Picture_Mapping is just the assignment of an existing image to a product.
Via Product.MainPictureId the main product thumbnail is referenced.
Product.MainPictureId can be set automatically by calling ~/Admin/Product/FixProductMainPictureIds.

Schöne Grüße aus Düsseldorf,
Marcus Gesing