Error when creating product variants - Value cannot be null. (Parameter 'value')
Hi
I am trying to create product variants with 2 attributes, size and colour.
I click "Create Product Variants", select my attributes and it creates the list.
However when i try and save the list with the default values, I get an error every time:
Value cannot be null. (Parameter 'value')
I can save the list with no errors if i go into each variant and set and SKU.
Any help would be much appreciated.
Thanks
at Newtonsoft.Json.Linq.Extensions.Value[T,U](IEnumerable1 value)
at Vendr.Umbraco.PropertyEditors.Stock.UmbracoStockSynchronizer.Synchronize(IContent content, SynchronizeAttempt attempt)
at Vendr.Umbraco.Events.Notification.Handlers.SynchronizeUmbracoStockOnSaving.Handle(ContentSavingNotification notification)
at Umbraco.Cms.Core.Events.EventAggregator.PublishCore(IEnumerable1 allHandlers, INotification notification)
at Umbraco.Cms.Core.Events.NotificationHandlerWrapperImpl1.Handle(INotification notification, ServiceFactory serviceFactory, Action2 publish)
at Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification](TNotification notification)
at Umbraco.Cms.Core.Events.ScopedNotificationPublisher.PublishCancelable(ICancelableNotification notification)
at Umbraco.Cms.Core.Services.Implement.ContentService.SaveAndPublish(IContent content, String culture, Int32 userId)
at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PublishInternal(ContentItemSave contentItem, String defaultCulture, String cultureForInvariantErrors, Boolean& wasCancelled, String[]& successfulCultures)
at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PostSaveInternal(ContentItemSave contentItem, Func2 saveMethod, Func2 mapToDisplay)
at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PostSave(ContentItemSave contentItem)
at lambdamethod2737(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
Whilst we shouldn't be displaying an error, it is expected behaviour that you would need to give all your varients an SKU (and this is the reason it's erroring if you don't).
The create variants button is there to help create all the combinations for you, but you would still be required to go through each and setup the SKU and potentially price as well as any variant related product data.
Hi, thanks for your quick reply.
I understand what you're saying, however I dont seem to get this error on the vendr demo store, where i can create the variants grid and save without any SKUs!
I would prefer this behaviour so they can add SKUs at leisure, so just wondering if I am not set up the same or missing something.
Given the error is coming from Vendr's UmbracoStockSynchronizer my guess is that you have a stock field on your varients where the demo store doesn't so I think it's this that is causing the problem.
When saving a product Vendr syncs the stock levels entered into a custom DB table so this is what that class is for.
Looking at the error though, I think the actual issue is that it falls over if there is no content at all in the variants editor yet, so saving any value into any varient will likely let it work.
I've pushed a fix for this to our unstable nuget feed so if you want to test this to see if it resolves your issue you can add our feed https://nuget.outfield.digital/unstable/vendr/v3/index.json to Visual Studio and install the Vendr v2.3.3-beta002 build (please only install this express version as there are multiple unstable builds on that feed)
Hi again, sorry didn't get chance to try this until now. I noticed that version 2.3.3 is out now (08/08/2022) and have upgraded to this but still get the error. Did this fix make it into version 2.3.3?
Thanks
Ok, there should be a new 2.3.4-beta001 build on our unstable feed with a few more checks in it. Do you want to try that and see if this resolves the issue for you?
Matt, I can confirm that 2.3.4-beta0001 works beautifully!
I can save my variants with no errors and add the price/sku etc afterwards.
I will keep an eye out for when this gets released properly or if you could let me know that would be great.
Thank-you
Great stuff. I'll probably give it a week (incase any other issues come up that can go in the patch release) but you are fine to run on the beta build in the mean time as it should upgrade to the full 2.3.4 when it is released no problem.
Error when creating product variants - Value cannot be null. (Parameter 'value')
Hi I am trying to create product variants with 2 attributes, size and colour. I click "Create Product Variants", select my attributes and it creates the list. However when i try and save the list with the default values, I get an error every time: Value cannot be null. (Parameter 'value')
I can save the list with no errors if i go into each variant and set and SKU. Any help would be much appreciated. Thanks
at Newtonsoft.Json.Linq.Extensions.Value[T,U](IEnumerable
1 value) at Vendr.Umbraco.PropertyEditors.Stock.UmbracoStockSynchronizer.Synchronize(IContent content, SynchronizeAttempt attempt) at Vendr.Umbraco.Events.Notification.Handlers.SynchronizeUmbracoStockOnSaving.Handle(ContentSavingNotification notification) at Umbraco.Cms.Core.Events.EventAggregator.PublishCore(IEnumerable
1 allHandlers, INotification notification) at Umbraco.Cms.Core.Events.NotificationHandlerWrapperImpl1.Handle(INotification notification, ServiceFactory serviceFactory, Action
2 publish) at Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification](TNotification notification) at Umbraco.Cms.Core.Events.ScopedNotificationPublisher.PublishCancelable(ICancelableNotification notification) at Umbraco.Cms.Core.Services.Implement.ContentService.SaveAndPublish(IContent content, String culture, Int32 userId) at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PublishInternal(ContentItemSave contentItem, String defaultCulture, String cultureForInvariantErrors, Boolean& wasCancelled, String[]& successfulCultures) at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PostSaveInternal(ContentItemSave contentItem, Func2 saveMethod, Func
2 mapToDisplay) at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PostSave(ContentItemSave contentItem) at lambdamethod2737(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Hi Sue,
Whilst we shouldn't be displaying an error, it is expected behaviour that you would need to give all your varients an SKU (and this is the reason it's erroring if you don't).
The create variants button is there to help create all the combinations for you, but you would still be required to go through each and setup the SKU and potentially price as well as any variant related product data.
PS I've created an issue on our issure tracker to resolve the problem of showing an exception https://github.com/vendrhub/vendr/issues/380
Hi, thanks for your quick reply. I understand what you're saying, however I dont seem to get this error on the vendr demo store, where i can create the variants grid and save without any SKUs! I would prefer this behaviour so they can add SKUs at leisure, so just wondering if I am not set up the same or missing something.
Hi Sue,
Given the error is coming from Vendr's
UmbracoStockSynchronizer
my guess is that you have a stock field on your varients where the demo store doesn't so I think it's this that is causing the problem.When saving a product Vendr syncs the stock levels entered into a custom DB table so this is what that class is for.
Looking at the error though, I think the actual issue is that it falls over if there is no content at all in the variants editor yet, so saving any value into any varient will likely let it work.
I've pushed a fix for this to our unstable nuget feed so if you want to test this to see if it resolves your issue you can add our feed https://nuget.outfield.digital/unstable/vendr/v3/index.json to Visual Studio and install the Vendr v2.3.3-beta002 build (please only install this express version as there are multiple unstable builds on that feed)
Matt
Hi again, sorry didn't get chance to try this until now. I noticed that version 2.3.3 is out now (08/08/2022) and have upgraded to this but still get the error. Did this fix make it into version 2.3.3? Thanks
Hey Sue,
It did yea but I guess that didn’t resolve it. I’ll have to take another look at this.
Are you seeing the EXACT same error (please read the stack trace carefully to ensure it is the same or not)?
Matt
Pretty sure I've upgraded and its the exact same error
at Newtonsoft.Json.Linq.Extensions.Value[T,U](IEnumerable
1 value) at Vendr.Umbraco.PropertyEditors.Stock.UmbracoStockSynchronizer.Synchronize(IContent content, SynchronizeAttempt attempt) at Vendr.Umbraco.Events.Notification.Handlers.SynchronizeUmbracoStockOnSaving.Handle(ContentSavingNotification notification) at Umbraco.Cms.Core.Events.EventAggregator.PublishCore(IEnumerable
1 allHandlers, INotification notification) at Umbraco.Cms.Core.Events.NotificationHandlerWrapperImpl1.Handle(INotification notification, ServiceFactory serviceFactory, Action
2 publish) at Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification](TNotification notification) at Umbraco.Cms.Core.Events.ScopedNotificationPublisher.PublishCancelable(ICancelableNotification notification) at Umbraco.Cms.Core.Services.Implement.ContentService.SaveAndPublish(IContent content, String culture, Int32 userId) at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PublishInternal(ContentItemSave contentItem, String defaultCulture, String cultureForInvariantErrors, Boolean& wasCancelled, String[]& successfulCultures) at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PostSaveInternal(ContentItemSave contentItem, Func2 saveMethod, Func
2 mapToDisplay) at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.PostSave(ContentItemSave contentItem) at lambdamethod16813(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Hi Sue,
Ok, there should be a new 2.3.4-beta001 build on our unstable feed with a few more checks in it. Do you want to try that and see if this resolves the issue for you?
Matt, I can confirm that 2.3.4-beta0001 works beautifully! I can save my variants with no errors and add the price/sku etc afterwards. I will keep an eye out for when this gets released properly or if you could let me know that would be great. Thank-you
Hey Sue,
Great stuff. I'll probably give it a week (incase any other issues come up that can go in the patch release) but you are fine to run on the beta build in the mean time as it should upgrade to the full 2.3.4 when it is released no problem.
I'll keep you posted 👍
is working on a reply...