Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckoutController -> LoadCheckoutModel: Redirect not working if CurrentCart == null #354

Open
Navilois opened this issue Apr 6, 2021 · 1 comment

Comments

@Navilois
Copy link
Contributor

Navilois commented Apr 6, 2021

Describe the bug

Checkout crashes with an exception if CurrentCart == null.

Software Versions

  • DNN: 09.08.01
  • Hotcakes: 03.05.00

To Reproduce

Steps to reproduce the behavior:

  1. Go to the checkout page in a clean browser window, e.g. https://www.sierzega.com/en-us/products/checkout
  2. See error

Expected behavior

The visitor should be redirected to the shopping cart -

if (CurrentCart == null || CurrentCart.Items == null || CurrentCart.Items.Count == 0)

Actual behavior

The Redirect doesn't work (no error) and the code continues to execute causing to crash on null references due to the empty CheckoutViewModel

Screenshots

If applicable, add screenshots to help explain your problem.

Error log

Note: Debug DLL's
Please replace the current extension DLL's with the debug DLL's (if these are available with the release) and reproduce the error with the debug DLL's before pasting the error log.

Paste the error log that is related to this issue.
2021-04-06 13:35:44.362+02:00 [Vertrieb5][D:5][T:113][ERROR] DotNetNuke.Services.Exceptions.Exceptions - FriendlyMessage="Error: Checkout is currently unavailable." ctrl="ASP.desktopmodules_hotcakes_checkout_checkoutview_ascx" exc="System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at ASP._Page_Portals__default_HotcakesViews_MyViewSet_Views_Checkout__Login_cshtml.Execute() in d:\websites\sierzega.com\Portals_default\HotcakesViews\MyViewSet\Views\Checkout_Login.cshtml:line 72
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at ASP._Page_Portals__default_HotcakesViews_MyViewSet_Views_Checkout_Index_cshtml.Execute() in d:\websites\sierzega.com\Portals_default\HotcakesViews\MyViewSet\Views\Checkout\Index.cshtml:line 43
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.b__3()
at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage)
at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm)
at System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter)
at System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues)
at Hotcakes.Commerce.Dnn.Mvc.MvcRenderingEngine.Render(String controllerName, String actionName, String viewName, Object routeValues) in D:__dev\hotcakes-commerce-nav-fork\Libraries\Hotcakes.Commerce.Dnn\Mvc\MvcRenderingEngine.cs:line 90
at Hotcakes.Modules.Checkout.CheckoutView.RenderView() in D:__dev\hotcakes-commerce-nav-fork\Website\DesktopModules\Hotcakes\Checkout\CheckoutView.ascx.cs:line 53
at Hotcakes.Commerce.Dnn.Web.HotcakesModuleBase.OnLoad(EventArgs e) in D:__dev\hotcakes-commerce-nav-fork\Libraries\Hotcakes.Commerce.Dnn\Web\HotcakesModuleBase.cs:line 116"

Additional context

Add any other context about the problem here.

I've debugged the entire thing extensively - honestly, I have no idea why it doesn't work. I have followed the path to

public HccRedirectResult(string url, bool permanent)

Seems to be all good except that it doesn't redirect? Am I missing something?

@Navilois
Copy link
Contributor Author

Navilois commented Apr 8, 2021

Found the problem:
PR #307 changed the Redirect from HttpResponseBase Controller to BaseAppController

I don't know why exactly, but the BaseAppController doesn't pull off the Redirect. It works with the HttpResponseBase Controller, PR reverting those changes coming soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant