puntable
puntable

Reputation: 337

Magmi import images with different file extension

I am using Magmi to import products into Magento.

I upload all images to local folder (media/import) where files are either .jpg or .gif.

Images are named:

[sku.jpg] OR [sku.gif]

I have now configured Magmi so it imports all jpg images and this works fine.

This is how my CSV looks (only image columns):

image,small_image,thumbnail
sku,sku,sku

I am then using "value replacer" plugin to insert .jpg behind every sku in image columns. This also works fine. enter image description here

Is it possible to also search for .gif in same import, so it either finds a sku with file extension .jpg or .gif ?

Upvotes: 2

Views: 274

Answers (1)

Karl
Karl

Reputation: 5463

This is untested, but I'm sure you'd be able to do something like this:

+{{ (file_exists({item.sku} . '.gif') ? {item.sku} . '.gif' : {item.sku} . '.jpg') }}

I don't know the full location of the images, so it might need tweaking a bit, but the idea behind it should be correct.

Upvotes: 1

Related Questions