craftcms / feed-me

Craft CMS plugin for importing entry data from XML, RSS or ATOM feeds—routine task or on-demand.
Other
288 stars 139 forks source link

Painfully slow import with assets #1317

Closed sunscreem closed 1 year ago

sunscreem commented 1 year ago

Description

I'm not entirely sure if this is a bug or just my lack of understanding.

image

The two images are being imported here on update on a commerce product. But the images do already exist. They are in my S3 bucket. Could someone explain how the asset updating/importing works so I can work out if there is a problem?

i-just commented 1 year ago

Hi, thanks for getting in touch.

The two images are being imported here on update on a commerce product. But the images do already exist. They are in my S3 bucket.

They’re in your S3 bucket, but do they exist as Asset elements too? Can you see them in Control Panel > Assets?

Could you please share a snippet of your feed that matches the screenshot you posted? And a screenshot of the mapping screen would also be appreciated.

sunscreem commented 1 year ago

Hi @i-just, Sorry for the very slow reply.

Can you see them in Control Panel > Assets?

Yes.

Could you please share a snippet of your feed that matches the screenshot you posted?

Sure (urls slightly altered for the image to somewhat redact them)

{
"product": [
{
"status": "enabled",
"product-title": "Platinum 0.42ct D SI1 Oval Cut Solitaire ring",
"product-description": "Platinum Skye Classic Oval Solitaire ring set with a Oval Cut 0.42ct D SI1 diamond and diamond shoulders. Total diamond weight:0.56ct",
"sku": "1121825",
"price": "2150.0000",
"quantity": "1",
"length": null,
"width": null,
"height": null,
"weight": null,
"stock-status": "in stock",
"tax-class": "taxable goods",
"category-id": [
{
"Category": 34
},
{
"Category": 5428
}
],
"gender": "5518",
"metal": {
"Category": 5524
},
"postage-weight": "100",
"can-reserve": "1",
"is-engraveable": "0",
"ring-size-reqd": "1",
"coming-soon": null,
"out-of-stock-reorder-applicable": null,
"Image": [
{
"Title": "Skye Classic Oval",
"URL": "https://x.azureedge.net/images/1000/jamieson-carry/stock/123550i_050?background=white",
"Caption": "Skye Classic Oval"
},
{
"Title": "Skye Classic Oval hand",
"URL": "https://x.azureedge.net/images/1000/jamieson-carry/handcrop/140780_h.jpg",
"Caption": "Skye Classic Oval hand"
}
],
"video": "https://x.azureedge.net/videos/jamieson-carry/123550.mp4",
"can-be-financed": "1",
"clearance": "0",
"Engagement Ring Style": {
"Category": 51656
},
"E R Diamond Cut": {
"Category": 55476
}
},
....etc (256 products)
}

And a screenshot of the mapping screen would also be appreciated. image image image

i-just commented 1 year ago

Thanks for the additional info, @sunscreem!

The file will be downloaded, and a new asset will be created if Feed Me can’t find the existing asset that matches the search criteria. Search criteria include, most importantly, the filename, file kind and folder id. For example, if the asset URL in your feed is: https://www.mydomain.com/folder/my-first-image.jpg, Feed Me will look for an asset of the kind: image (because “jpg” files are classified as image file kind), filename: my-first-image.jpg and it will look in the folder assigned to the field you’re importing to. If the assets field you’re importing to has “Default Upload Location”, - it will be used. If it restricts uploads to a single location, that “Asset Location” will be used. (Subfolders are also searched through.)

This means that if your CMS already has an image file with the filename of my-first-image.jpg and it is located in the folder the field is supposed to upload to - the existing image should be found and used.

The logs you posted suggest that the existing asset cannot be found. On line 4 in the logs screenshot, you can see the criteria used to search for the existing image and on line 5, you can see that no match was found.

So, as a first step, I’d double check if the filename is exactly the same in the feed and the CMS and that the file is in the “Default Upload Location”/“Asset Location” specified by the productImages Assets field.

sunscreem commented 1 year ago

Thanks @i-just - go ahead and close this one just now and I'll come back to you once I get a few mins to check it :)