I had some Nuget bumps where it was complaining about Vendr.Core being installed in the other projects but I worked out the order.
Now when the site starts up (after adding the extra methods to the ProductAdaptor) everything seems to work except on my product detail page.
The exception is thrown in the VendrProductVariantComp generated model class.
Has something been changed on the composite for the variant (stock data type?). Or have I failed to implement one of the new methods on the ProductAdaptor? I'll be honest I can't really get my head around if I need these anyhow.
I've seen another bug report where the stock updates weren't being saved - I've just tried changing these and they aren't storing on publish for me either.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "9.4.1+037580b305d0b0771dbe7f5e0f40dfdceeae62ec")]
[ImplementPropertyType("stock")]
public virtual global::System.Nullable
Sorry, I'm struggling to read your code snippet. It looks partially like a models builder definition and partially a stack trace (with no exception info) and partially a variable delcaration.
Can you restructure these a little more to explain what each one is and also provide the actual exception?
Urgh - a late night paste and smash into the Umbraco Forums - sorry.
Let me try to clear this up.
I'm picking back up a Vendr project I started for a client. In the time I started dabbling to come up with an estimate and now I've forgotten what's my custom stuff and what I followed in documentation so there's a very real risk here it's my stuff / customisations breaking.
I want the product variants to be stored on the same node as the product (client has many different variations of the same products that are sold in different weights) - so to do that I've added a Block List editor to the product page and created an Element doc type called VendrProductVariantComp (why Comp - can't remember!) - I have a ProductAdapator and I "explode" out the block list to make my product variants. Worked really nicely in 2.0.4 (or at least I hadn't spotted errors yet!).
The element type contains a Vendr stock property (which to be honest will almost always be set to -1 or an extra flag set to ignore stock control) but this is what's blowing up when I try to use the stock value on the front end.
Now when I load my product details page, since the upgrade, an exception is thrown.
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Vendr.Umbraco
StackTrace:
at Vendr.Umbraco.ValueConverters.StockPropertyValueConverter.ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel cacheLevel, Object source, Boolean preview)
at Umbraco.Cms.Core.Models.PublishedContent.PublishedPropertyType.ConvertInterToObject(IPublishedElement owner, PropertyCacheLevel referenceCacheLevel, Object inter, Boolean preview)
at Umbraco.Cms.Core.PublishedCache.PublishedElementPropertyBase.GetValue(String culture, String segment)
at Umbraco.Extensions.PublishedPropertyExtension.Value[T](IPublishedProperty property, IPublishedValueFallback publishedValueFallback, String culture, String segment, Fallback fallback, T defaultValue)
at Umbraco.Extensions.PublishedElementExtensions.Value[T](IPublishedElement content, IPublishedValueFallback publishedValueFallback, String alias, String culture, String segment, Fallback fallback, T defaultValue)
at Umbraco.Cms.Web.Common.PublishedModels.VendrProductVariantComp.get_Stock() in C:\data\repos\soapmakers_v9\Umbraco.Cms.Web.Common.PublishedModels\VendrProductVariantComp.generated.cs:line 97
Hmm I’ve not really tried that setup. For this kind of scenario you’d really be better off using the variants property editor that ships with Vendr. It’s this kind of setup that it’s meant for.
I can see what the variants editor is trying to do but this isn't going to work for this client.
They have thousands of products and each product can be sold in a varying amount of weights. Each weight needs it's own price, SKU and a shipping weight (which I need in the shipping calculator) which won't be the same as sold weight.
Correct me if I'm wrong but the complex variants editor requires me to preload the possible values of the "weights" into the commerce section. I can't do that as they are possibly infinite. This I need to be configurable in the CMS - hence why I've gone down the block editor route.
I've got almost everything working except this stock - I don't even think the client does stock control so I can probably just remove the stock and change it to a boolean in stock / out of stock flag for my front end logic.
But before I do this and import their product catalogue any pointers where I'm missing the point very welcome!
Unfortunately though I think our current stock management is geared to either a node with a stock value or a variant in the variants editor with a stock value so a stock value in a random block list isn't something it knows how to handle.
The main reason for this is we can't store the stock on the umbraco node as it's volatile, meaning it changes over time and isn't just a published constant and so whilst you enter it in the back office, we have an event handler which syncs the value entered into a custom stock table. That event handler knows how to handle content nodes and nodes with the variants editor and that's it. So this will be why it's not working for you.
It might be something we could "open up" and allow any block list based property editor to be capable of being a product variant source, but I'd need to review what that would mean on the whole.
If in/out of stock would suffice for your needs, that might be the simplest option right now.
I guess if you really wanted to make it work you could implement your own event handler to sync the stock values. I don't think our sync code uses anything other than our public API and the handler basically reads the entered stock value, saves it to the stock service and then resets the stock on the node to -1 (so that we can know it's been processed).
Vendr Updated from 2.04 -> 2,1,2
Hi.
I've just updated an in progress site to 2.1.2
I had some Nuget bumps where it was complaining about Vendr.Core being installed in the other projects but I worked out the order.
Now when the site starts up (after adding the extra methods to the ProductAdaptor) everything seems to work except on my product detail page.
The exception is thrown in the VendrProductVariantComp generated model class.
Has something been changed on the composite for the variant (stock data type?). Or have I failed to implement one of the new methods on the ProductAdaptor? I'll be honest I can't really get my head around if I need these anyhow.
I've seen another bug report where the stock updates weren't being saved - I've just tried changing these and they aren't storing on publish for me either. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "9.4.1+037580b305d0b0771dbe7f5e0f40dfdceeae62ec")] [ImplementPropertyType("stock")] public virtual global::System.Nullable
Hey Steve,
Sorry, I'm struggling to read your code snippet. It looks partially like a models builder definition and partially a stack trace (with no exception info) and partially a variable delcaration.
Can you restructure these a little more to explain what each one is and also provide the actual exception?
Urgh - a late night paste and smash into the Umbraco Forums - sorry.
Let me try to clear this up.
I'm picking back up a Vendr project I started for a client. In the time I started dabbling to come up with an estimate and now I've forgotten what's my custom stuff and what I followed in documentation so there's a very real risk here it's my stuff / customisations breaking.
I want the product variants to be stored on the same node as the product (client has many different variations of the same products that are sold in different weights) - so to do that I've added a Block List editor to the product page and created an Element doc type called VendrProductVariantComp (why Comp - can't remember!) - I have a ProductAdapator and I "explode" out the block list to make my product variants. Worked really nicely in 2.0.4 (or at least I hadn't spotted errors yet!).
The element type contains a Vendr stock property (which to be honest will almost always be set to -1 or an extra flag set to ignore stock control) but this is what's blowing up when I try to use the stock value on the front end.
Now when I load my product details page, since the upgrade, an exception is thrown.
This is in the models builder built class :
On save and publish I've since noticed the changes to the stock value aren't being saved.
Hey Steve,
Hmm I’ve not really tried that setup. For this kind of scenario you’d really be better off using the variants property editor that ships with Vendr. It’s this kind of setup that it’s meant for.
Hi Matt - thanks for the reply.
I can see what the variants editor is trying to do but this isn't going to work for this client.
They have thousands of products and each product can be sold in a varying amount of weights. Each weight needs it's own price, SKU and a shipping weight (which I need in the shipping calculator) which won't be the same as sold weight.
Correct me if I'm wrong but the complex variants editor requires me to preload the possible values of the "weights" into the commerce section. I can't do that as they are possibly infinite. This I need to be configurable in the CMS - hence why I've gone down the block editor route.
I've got almost everything working except this stock - I don't even think the client does stock control so I can probably just remove the stock and change it to a boolean in stock / out of stock flag for my front end logic.
But before I do this and import their product catalogue any pointers where I'm missing the point very welcome!
Steve
Hi Steve,
Ahh, I see what you mean.
Unfortunately though I think our current stock management is geared to either a node with a stock value or a variant in the variants editor with a stock value so a stock value in a random block list isn't something it knows how to handle.
The main reason for this is we can't store the stock on the umbraco node as it's volatile, meaning it changes over time and isn't just a published constant and so whilst you enter it in the back office, we have an event handler which syncs the value entered into a custom stock table. That event handler knows how to handle content nodes and nodes with the variants editor and that's it. So this will be why it's not working for you.
It might be something we could "open up" and allow any block list based property editor to be capable of being a product variant source, but I'd need to review what that would mean on the whole.
If in/out of stock would suffice for your needs, that might be the simplest option right now.
I guess if you really wanted to make it work you could implement your own event handler to sync the stock values. I don't think our sync code uses anything other than our public API and the handler basically reads the entered stock value, saves it to the stock service and then resets the stock on the node to -1 (so that we can know it's been processed).
That sounds like the perfect solution.
I'll do the switch for now - and let them know that I've not completely cut off being able to use the stock control in the future.
Thanks Matt.
is working on a reply...