1

I'm using feeds with Commerce. For each of my product variation, I have 4 images.

Each time I execute the feed import, the images are all copied by the number of variation. For example, if a product has 10 variations that are supposed to use image testpicture.jpg, the result is 10 copies named testpicture.jpg, testpicture0.jpg, testpicture1.jpg, etc.

How can All my product variations point to the same image and not make copies of the image with an incremental number?

1

I suppose there are a few ways, but this is how I do it:

You need to have your images managed by Drupal. I use Media module (7.x-2.0) and its sub-modules to first upload my images to the Media library. I make sure that my images have unique file names and I do not change it during the upload (Media allows you to rename after upload, just leave at default).

I then map my images via:

  • Image -> Images: Ref in the feed settings and use Feeds Tamper to Explode in case I need multiple images
  • Images: Alt and Images: Title, again using Feeds Tamper.

In my uploader file I then use the exact same image names as the file names for Image. Feeds will then map to the Drupal Managed File entity ids which it looks up by name via the URI stream wrapper (I think). I also include fields for Image Alt and Title.

If you don't want to use Media then you may use FileField Sources, but getting the images in the very first time is then a hassle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.