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);