0

I'm using Migrate 7.x-2.5 to keep Commerce products synchronized between a legacy system and a Drupal ecommerce website.

I setup two migration methods, one for Commerce Products entities and one to generate nodes for product display. Migration tasks are supposed to be run every night, because people during the day add new products, update some, and delete others. So both migration tasks are run with the "update" checkbox checked. I take care to delete obsolete content at postImport() and all is good.

Everything is working for me, except for product images. When source files are updated with different pictures, filename doesn't change (that's a legacy system behaviour). Migrate doesn't seem to notice that the file has changed, so it doesn't migrate it and pictures don't get updated.

Anyone can help dealing with this file updating issue?

Here's the relevant migration part where files are handled.

$this->addFieldMapping('field_image', 'immagine'); //this field gets populated in prepareRow()
$this->addFieldMapping('field_image:file_class')
        ->defaultValue('MigrateFileUri');
$this->addFieldMapping('field_image:source_dir')
        ->defaultValue(SRC_IMG_PATH);
$this->addFieldMapping('field_image:file_replace')
        ->defaultValue(FILE_EXISTS_REPLACE);
0

It turns out that files are actually updated. So there's nothing to edit in my migration code.

Problem is that a flush on image styles is required.

I was triggering flush manually, but I could not see updated images in webpages.

Flushing was not working due to file permissions on resized images, so I still see the old "styled" images.

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.