logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
ray22901031  
#1 Posted : Tuesday, October 20, 2020 7:36:41 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 826

Thanks: 3 times
Was thanked: 13 time(s) in 13 post(s)
I just encountered a problem that I did not know existed, this is not a production site, but the site in development. The last time that I placed the order was on 09/21/2020 in the admin. There was one new controller that was added, but I reverted to the old code without the new controller. The good news is that has nothing to do with the new controller, the only changes that I have made have been to the themes and some CSHTML files. So no source code was altered. If someone can look at the following error below and make sense of it, I would appreciate.

Again, no code modification made.

Many Thanks

======
An error has occured at http://rfl01/Admin/Orders/ViewOrder/18 View less
Exception: Object reference not set to an instance of an object. Stack Trace: at AbleCommerce.Areas.Admin.Controllers.OrdersController.ViewOrder(Int32 orderNumber, String currentTab) at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.b__1c() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.b__1e(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) at System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

ray22901031  
#2 Posted : Tuesday, October 20, 2020 8:37:47 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 826

Thanks: 3 times
Was thanked: 13 time(s) in 13 post(s)
This problem was traced back to the database and the orders controller especially at this line:

OrderStatus cancelledStatus = AbleContext.Resolve<IOrderStatusTriggerRepository>().LoadForStoreEvent(StoreEvent.OrderCancelled);
ViewBag.CancelOrderStatusId = cancelledStatus.Id;
model.OrderNumber = orderNumber;

I did rearrange order statuses, but why would creating new order statuses and rearranging order statuses in the backend prevent me from going into viewing orders in the admin. This is definitely a problem in your code, please advise on the best way to fix this. I can restore the database from a week ago and everything works fine, but I have done a tremendous amount of work, including creating new categories, moving categories, adding product descriptions, adding product pictures. I cannot lose 10 days of work because there's a glitch in the system when you manipulate order statuses.

Please advise on the best way to fix this, if necessary I can delete the three orders that I have in the system, but this condition should not exist just because one goes into the backend and modifies order statuses.

I await your reply,

Many thanks
ray22901031  
#3 Posted : Tuesday, October 20, 2020 8:47:44 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 826

Thanks: 3 times
Was thanked: 13 time(s) in 13 post(s)
Please see the before and after the modification of the order status table, I hope this helps and please help me resolve this issue. Again modifying order statuses should not cause this, this could be considered a serious bug.


ac_OrderStatuses-before.zip (9kb) downloaded 2 time(s).
ray22901031  
#4 Posted : Wednesday, October 21, 2020 1:14:46 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 826

Thanks: 3 times
Was thanked: 13 time(s) in 13 post(s)
Dear Support,

I have been up all night trying to determine what has caused this and it is definitely 100% the manipulation, addition, and rearranging of the order statuses table values in the database that has created this problem . All this was done in the backend using the admin.

How I came to this conclusion:

I take a snapshot of my database every six hours, by restoring the snapshot dated 10/14/20 at 6:am - all works properly. I have determined that at this point the order status database was not altered or touched.

In the next six hours, I manipulated the order status database, this was determined by restoring snapshot dated on 10/14/20 at 12:pm. This is the only change that was done in the system.

This is definitely a serious bug and I would appreciate in trying to rectify this as quickly as possible. I think I have provided enough information, and I will be more than able to provide before and after copies of the database if necessary. None of those dates had any modifications to any of the source code whatsoever.

I try to restore just the order status table, but because it has a foreign key attached (store ID, I believe), I was not able to do so.


I am tired, I have been up all night, and I'm going to bed.

-Ray
shari  
#5 Posted : Wednesday, October 21, 2020 2:50:59 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 703

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Quote:
OrderStatus cancelledStatus = AbleContext.Resolve<IOrderStatusTriggerRepository>().LoadForStoreEvent(StoreEvent.OrderCancelled);
ViewBag.CancelOrderStatusId = cancelledStatus.Id;
model.OrderNumber = orderNumber;


You are right the problem seems to be at this section of the code. The code assumes that we should have at least one order status with the Order Cancelled store event trigger assigned.
For some reason, after your changes to the order statuses section, there is no order status left that has Order Cancelled store event trigger assigned to it.

Now the solution would be to assign Order Cancelled store event trigger to at least one order status. That would allow you to visit the View Order page without any error.

The original solution should be to handle the null exception in the code. I will register a bug.
If you want code change then follow the steps below.

1- Open OrdersController
2- Search for the line
Code:
ViewBag.CancelOrderStatusId = cancelledStatus.Id;

3- Replace it with
Code:
ViewBag.CancelOrderStatusId = cancelledStatus == null ? 0 : cancelledStatus.Id;
ray22901031  
#6 Posted : Wednesday, October 21, 2020 6:27:24 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 826

Thanks: 3 times
Was thanked: 13 time(s) in 13 post(s)
Thank you for your reply, I finally ended up using a program called "Data Compare" from dbForge to synchronize the following two tables, "ac_OrderStatuses" and "ac_OrderStatuTriggers" back to their previous versions on 10/14/20 at 6:00am.

After this everything worked, so I was able to maintain all the other database changes. Thank goodness, seven days of work would be a lot to try to redo. Two questions if I can?

#1. Why does the "ac_OrderStatuses" Table have a foreign key, especially when it comes to store ID? I know at one time ablecommerce had a multi-store version, so is this leftover old stuff?

#2. I'm assuming that this fix will be in the next release? - If so, I will wait to the end to change my order status again.

Thank you so much, I did get about three hours of sleep after all.

Edited by user Wednesday, October 21, 2020 6:50:27 AM(UTC)  | Reason: Not specified

shari  
#7 Posted : Wednesday, October 21, 2020 7:15:07 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 703

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Quote:
#1. Why does the "ac_OrderStatuses" Table have a foreign key, especially when it comes to store ID? I know at one time ablecommerce had a multi-store version, so is this leftover old stuff?


Yes, we didn't exclude this from our updated schema.

Quote:
#2. I'm assuming that this fix will be in the next release? - If so, I will wait to the end to change my order status again.


Yes, this bug report is currently in progress and will be available in the next release.
ray22901031  
#8 Posted : Wednesday, October 21, 2020 7:35:36 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 826

Thanks: 3 times
Was thanked: 13 time(s) in 13 post(s)
Any idea when the next release should be coming out?

Thanks
shari  
#9 Posted : Friday, October 23, 2020 5:47:52 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 703

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
It was 22nd of October.

Best of luck with the 9.0.3 release!

ray22901031  
#10 Posted : Saturday, October 24, 2020 12:51:26 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 826

Thanks: 3 times
Was thanked: 13 time(s) in 13 post(s)
Trying to learn, are these the same thing.

ViewBag.CancelOrderStatusId = cancelledStatus == null ? 0 : cancelledStatus.Id;

ViewBag.CancelOrderStatusId = cancelledStatus != null ? cancelledStatus.Id : 0;

Thanks
shari  
#11 Posted : Monday, October 26, 2020 1:48:02 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 703

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Yes, the two lines of code are similar.
ray22901031  
#12 Posted : Monday, October 26, 2020 1:51:22 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 826

Thanks: 3 times
Was thanked: 13 time(s) in 13 post(s)
Thanks
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.