Open jakelapan opened 11 months ago
I'm having the same (or similar) issue but I believe even on older versions (since 4.6.2?). I'm updating a commerce site from craft v3 to the latest version.
It seems that when you select "Variant SKU" as unique identifier, parseAttribute
function in base/Element.php tries to fetchSimpleValue
but should in this case use fetchArrayValue
instead?
In the ugly code below in parseAttribute
I try to do that and it seems to help in my case but I would not trust it on production server so I'm waiting for official fix too.
// Set a default handler for non-specific attribute classes
if (!method_exists($this, $name)) {
// ugly part to check exactly for variants/sku
if ($fieldInfo['node'] === 'variants/sku') {
return $this->fetchArrayValue($feedData, $fieldInfo);
}
else {
return $this->fetchSimpleValue($feedData, $fieldInfo);
}
}
Also running into this issue
Hi, thanks for getting in touch! Can you please provide a bit more info about this? A screenshot of the mapping screen and a snippet of the feed (e.g. json file) would be particularly helpful. Also, are you importing a product that has one variant or multiple variants?
I upgraded my dev install to latest craft v5/commerce v5/ feed me v6.3.0 and still have the same issue. We have products defined with variants (some products have just one some have many variants).
Log shows errors for all products:
Mapping:
JSON example:
{
"sku": "95800",
"title": "ASCAN KOMPLETNI PRO RIG",
"enota": "SET",
"splet_sifra": "25",
"splet_naziv": "JADRA",
"splet_skupina": "6",
"splet_nivo": "3",
"b2c": "",
"tax": "22%",
"enabled": 1,
"variants": [
{
"sku": "95825",
"enabled": 1,
"title": "ASCAN PRO RIGG 2.5M2",
"title2": "",
"price": 236.885,
"zaloga": 0,
"enota": "SET",
"barva": "",
"velikost": "",
"splet_sifra": "25",
"splet_naziv": "JADRA",
"splet_skupina": "6",
"splet_nivo": "3",
"b2c": "",
"tax": "22%"
},
{
"sku": "95845",
"enabled": 1,
"title": "ASCAN PRO RIGG 4,5",
"title2": "",
"price": 261.475,
"zaloga": 0,
"enota": "SET",
"barva": "",
"velikost": "",
"splet_sifra": "25",
"splet_naziv": "JADRA",
"splet_skupina": "6",
"splet_nivo": "3",
"b2c": "",
"tax": "22%"
},
{
"sku": "95840",
"enabled": 1,
"title": "ASCAN PRO RIGG 4.0",
"title2": "",
"price": 245.082,
"zaloga": 0,
"enota": "SET",
"barva": "",
"velikost": "",
"splet_sifra": "25",
"splet_naziv": "JADRA",
"splet_skupina": "6",
"splet_nivo": "3",
"b2c": "",
"tax": "22%"
},
{
"sku": "95950",
"enabled": 1,
"title": "ASCAN PRO RIGG 5,0",
"title2": "",
"price": 277.869,
"zaloga": 0,
"enota": "SET",
"barva": "",
"velikost": "",
"splet_sifra": "25",
"splet_naziv": "JADRA",
"splet_skupina": "6",
"splet_nivo": "3",
"b2c": "",
"tax": "22%"
}
]
},
Description
Exception thrown: "Unable to match an existing element. Have you set a unique identifier for ["variant-sku"]? Make sure you are also mapping this in your feed and it has a value." I am using an existing feed and just upgraded from 5.1.4 and am now encountering this issue. I have double-checked that the variant-sku is mapped properly. This issue seemed to occur after updating to 5.2.0.
I also noticed that the map template has two section headings for "Variants Fields" (see screenshot), which seems off.
Steps to reproduce
Additional info