Hi,
I am testing out Vendr and multi variants, looks great by the way.
But I am trying to figure out if and how fallback fram variants to parent is working. From the blog post it's says that sku, price should fallback to it's parent. I haven't got that working. Should it work?
For other properties that I have put in a composition like productName I try to manually fallback to parent node by doing
var variants = Model.Variant //Get's the list of all variants
var variant = variants[1].Content;
var productName = variant.Value<string>("productName",null,null,Fallback.ToAncestors);
On the last line I got an exception
System.NotSupportedException: 'Fallback PublishedValueFallback does not support fallback code '3' at element level.'
How can I get a property on a variant, not set, to fallback to it's parent?
The "fallback" behavior we mention only occurs within the product adapter when creating a vendr product snapshot, so when you ask for a snapshot of a product variant from Vendr's API, it will attempt to find the details from the variant node and if one isn't present, it will then fall back to the parent node.
What you have in the code example is pure umbraco property access and unfortunately that doesn't support fallbacks in this way (ie, you can't do this with nested content or any other block list editor either). If you need fallbacks in this type of code, then unfortunately it would need to be manual as far as I am aware.
Fallback on Variants
Hi, I am testing out Vendr and multi variants, looks great by the way. But I am trying to figure out if and how fallback fram variants to parent is working. From the blog post it's says that sku, price should fallback to it's parent. I haven't got that working. Should it work?
For other properties that I have put in a composition like productName I try to manually fallback to parent node by doing
On the last line I got an exception System.NotSupportedException: 'Fallback PublishedValueFallback does not support fallback code '3' at element level.'
How can I get a property on a variant, not set, to fallback to it's parent?
Best regards,
Jonas Jäderberg
Hi Jonas,
The "fallback" behavior we mention only occurs within the product adapter when creating a vendr product snapshot, so when you ask for a snapshot of a product variant from Vendr's API, it will attempt to find the details from the variant node and if one isn't present, it will then fall back to the parent node.
What you have in the code example is pure umbraco property access and unfortunately that doesn't support fallbacks in this way (ie, you can't do this with nested content or any other block list editor either). If you need fallbacks in this type of code, then unfortunately it would need to be manual as far as I am aware.
Hi,
Thanks, for swift response.
Yes, if I accessed the product via Vendr API e.g. by using variant.AsVendrProduct(parent) It fallbacks to the parent if missing.
For other cases I will do it manually.
is working on a reply...