I believe we just struck a bug when trying to purchase a package using Commerce 11.2.6
First of all, if inventory is not tracked for an sku should the CheckInventoryActivity be run at all?
Now for the error, in GetNewLineItemQty there is a call to OrderGroupActivityBase.InventoryTrackingEnabled to check if inventory is tracked. That function assumes that the sku is of type VariationContent. PackageContent is not inheriting VariationContent so we get the exception below.
I believe Package is to be interpreted as an sku and should be buyable, correct? Or have we setup the packages in the wrong way?
By the way, what happened to the downloadable zip containing the episerver.commerce.website source code? I don't seem to find it anymore.
2017-11-15 22:13:09,191  ERROR EPiServer.Global: 1.2.5 Unhandled exception in ASP.NETSystem.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ApplicationException: Workflow generated an exception, please look at the previous error for more details. ---> EPiServer.Core.TypeMismatchException: Content with id '71494__CatalogContent' is of type 'Castle.Proxies.MultiPackageProxy' which does not inherit required type 'EPiServer.Commerce.Catalog.ContentTypes.VariationContent' at EPiServer.Core.Internal.DefaultContentLoader.Get[T](ContentReference contentLink, LoaderOptions loaderOptions) at Mediachase.Commerce.Workflow.Activities.OrderGroupActivityBase.InventoryTrackingEnabled(LineItem lineItem) at Mediachase.Commerce.Workflow.Activities.OrderGroupActivityBase.GetNewLineItemQty(LineItem lineItem, List`1 changeQtyReason, Shipment shipment) at Mediachase.Commerce.Workflow.Activities.CheckInventoryActivity.AdjustInventory(LineItem lineItem, Shipment shipment, List`1 deletedLineItems) at Mediachase.Commerce.Workflow.Activities.CheckInventoryActivity.ValidateItems() at Mediachase.Commerce.Workflow.Activities.CheckInventoryActivity.Execute(ActivityExecutionContext executionContext) at Mediachase.Commerce.WorkflowCompatibility.Activity.Execute() at Mediachase.Commerce.Engine.ActivityFlowRunner.<>c__DisplayClass15_0`1.b__0() at Mediachase.Commerce.Engine.ActivityFlowRunner.Execute() at Mediachase.Commerce.Engine.ActivityFlowRunner.Execute() at Mediachase.Commerce.Engine.ExecutionManager.ExecuteActivityFlow(String name, ActivityFlowContext context)>
Sounds like a bug in our side, and this one is probably related to me. I will file a bug report and work on it asap. Thanks for letting us know.
Regarding the source code, you should be able to download from here :
Thanks, was looking for it a wekk or two back but then the samples wheren't there. Or maybe I was blind.
Thanks for digging into it asap! I've been trying to find a workaround as it's affecting a production site but haven't found any yet. Now I at least have the source code so we can patch it up :)
No you were not blind. We realized the download section was in wrong place and corrected it recently.
Just noticed that one can replace a flow without dragging in the full workflow project. Howeverä I canät get it to work.
I've created my flow override ride as
[ActivityFlowConfiguration(Name = OrderGroupWorkflowManager.CartValidateWorkflowName, Priority = 1)]
public class CartValidateActivityFlow : ActivityFlow
/// <inheritdoc />
public override ActivityFlowRunner Configure(ActivityFlowRunner activityFlow)
But it's still the original CartValidate flow that runs. I've read the documentation a few times now and cant figure out if I've missed anything. Should this be sufficient?
If you downloaded the project and build it, changing InventoryTrackingEnabled method in OrderGroupActivityBase should fix the problem
protected bool InventoryTrackingEnabled(LineItem lineItem)
var sku = GetEntryContentForLineItem<EntryContentBase>(lineItem) as IStockPlacement;
return sku != null && sku.TrackInventory;
Found out why. We didn't have the WorkflowsVNext feature in ecf.app.config at all, and it got automatically added by Commerce 11.2.0 with state Disabled.
Apparently you can not override a flow as above if WorkflowsVNext is disabled :)
Thanks but I don't want to use the entire project. It was easier this way since the customer don't have any tracked inventory at all anyway :)
Prod env patched, case closed :)
Thanks Quan for your fast responses.
And thank you for letting us know. The bug fix is in review and will be released in an upcoming version - probably 11.5.0