Try our conversational search powered by Generative AI!

Anonymous baskets generate error?

Vote:
 

Hi,

on our site only authenticated users can add products to baskets. In commerce manager/Order management we still still see a number of orders belonging to customer Anonymous. When clicking on one of those, I get an error (see details below).

Has anyone else experienced this? Wonder if it is a programming error on our side or if anonymous orders are created by commerce manager at some stage.

Thanks for your input :-)
/ Markus

 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: ArgumentOutOfRange_Index Parameter name: index
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentOutOfRangeException: ArgumentOutOfRange_Index
Parameter name: index]
   Mediachase.Commerce.Storage.StorageCollectionBase.System.Collections.IList.get_Item(Int32 index) +196
   Mediachase.Commerce.Storage.MetaStorageCollectionBase`1.get_Item(Int32 index) +43
   Mediachase.Commerce.Manager.Apps.Order.Modules.<GetOrderLineItems>d__3b.MoveNext() +772
   Mediachase.Commerce.Manager.Apps.Order.Modules.RelatedEntityView.LoadDataAndDataBind() +357
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +189
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +243
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +243
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +243
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +243
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +243
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +243
   Mediachase.BusinessFoundation.XmlFormBuilder.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +89
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +72
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +147
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.Page_Load(Object sender, EventArgs e) +1236
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Control.LoadRecursive() +191
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
#61874
Oct 04, 2012 14:54
Vote:
 

Hmm, found no edit button.

Some extra info - checked the database and for anonymous orders there are items in OrderGroup but not the corresponding item in OrderForm. For real orders, both OrderGroup and OrderForm contain info.

#61875
Oct 04, 2012 15:06
Vote:
 

Hi Markus,

Can't really tell you why you have anonymous carts, but as you said it doesn't contain any OrderFrom and it's on OrderForm your line items are stored. This explains why it fails, it tries to get the line items but fails as there are none.

So to me it seems like this is not a real cart. It was created but somehow abandoned before any items were added to it. I haven't seen this issue before either, so it might in your code somewhere.

#61880
Oct 04, 2012 16:49
Vote:
 

Thanks, again, for your input, Toni :-)

If this isn't normal in a epi commerce site, then our code might be to blame.

 Since we only allow authenticated users to add stuff to their basket, maybe a empty order is created for all other visitors (non-authenticated), just surfing around. Wondering if this could be could be connected to a users session in some way - each new user gets a basket, but only the authenticated ones can use it? Have to check our code to see what happens when a new visitor enters the site!

 

#61882
Oct 04, 2012 20:57
Vote:
 

Checked some more of the code - we use this line in quite a few pages/controls to get access to the users cart:

   var cartHelper = new Mediachase.Commerce.Website.Helpers.CartHelper(Cart.DefaultName);

And the carthelper creates a chart, if there isn't one for the current user. And if the user is not authenticated, customer Anonymous is used. So we should not call this method unless a user is authenticated, if we don't want anonymous baskets.

#61886
Oct 05, 2012 9:30
Vote:
 
var cartHelper = new Mediachase.Commerce.Website.Helpers.CartHelper(Cart.DefaultName);

    

That is creating a cart even if the user is annoymnous.  The actual order form is not created until their a line item added to the cart.  You will probably just need to refactor the code in your header which is showing how many items are in the users cart to only run if the request is authtnenticated

#61966
Oct 09, 2012 2:18
Vote:
 

Thanks for clariying when the orderform is created, that explains the error message when clicking on an anonumous cart.
Found two user controls that created a cart in the constructor, if the usercontrol was hidden from non-authenticated users. Changed this and hope to see only real carts in the future.

#61981
Oct 09, 2012 11:42
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.