1. Bertrand Le Roy
  2. Nwazet.Commerce
Issue #11 resolved

Error on ShoppingCart.cshtml

nduarte
created an issue

Hello Bertrand and Sipke , I´m starting to use your module a i get this error when trying to view the cart or on checkout, can you give me any clues on what can i do do fix this. Thanks, Nuno.

Server Error in '/' Application.

The best overloaded method match for 'string.IsNullOrWhiteSpace(string)' has some invalid arguments

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: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'string.IsNullOrWhiteSpace(string)' has some invalid arguments

Source Error:

Line 108: </tfoot> Line 109: </table> Line 110: if (String.IsNullOrWhiteSpace(Model.Country) && Line 111: String.IsNullOrWhiteSpace(Model.ZipCode)) { Line 112: @Display.ShippingInfoForm()

Source File: e:\VS Projects\Orchard_Nwazet\src\Orchard.Web\Modules\Nwazet.Commerce\Views\ShoppingCart.cshtml Line: 110

Stack Trace:

[RuntimeBinderException: The best overloaded method match for 'string.IsNullOrWhiteSpace(string)' has some invalid arguments] CallSite.Target(Closure , CallSite , Type , Object ) +202 System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +685 ASP._Page_Modules_Nwazet_Commerce_Views_ShoppingCart_cshtml.Execute() in e:\VS Projects\Orchard_Nwazet\src\Orchard.Web\Modules\Nwazet.Commerce\Views\ShoppingCart.cshtml:110 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +119 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +759 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +382 System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +470 System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +155 System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model) +93 Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) +267 Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.<>cDisplayClass28.<Discover>b15(DisplayContext displayContext) +160 Orchard.DisplayManagement.Descriptors.<>cDisplayClass5.<BoundAs>b2(DisplayContext displayContext) +134 Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) +220 Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) +1817 Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) +204 Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable1 parameters) +205 Orchard.DisplayManagement.Implementation.DisplayHelperBehavior.InvokeMember(Func1 proceed, Object target, String name, INamedEnumerable1 args) +99 ClaySharp.<>c__DisplayClass16.<InvokeMember>b__13() in C:\Users\sebros\My Projects\Clay\src\ClaySharp\ClayBehaviorCollection.cs:29 ClaySharp.ClayBehaviorCollection.Execute(Func1 proceed, Func3 linker) in C:\Users\sebros\My Projects\Clay\src\ClaySharp\ClayBehaviorCollection.cs:13 ClaySharp.ClayBehaviorCollection.InvokeMember(Func1 proceed, Object self, String name, INamedEnumerable1 args) in C:\Users\sebros\My Projects\Clay\src\ClaySharp\ClayBehaviorCollection.cs:29 ASP._Page_Core_Shapes_Views_ShapeResult_Display_cshtml.Execute() in e:\VS Projects\Orchard_Nwazet\src\Orchard.Web\Core\Shapes\Views\ShapeResult\Display.cshtml:1 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +119 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +759 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +382 Orchard.Mvc.ViewEngines.ThemeAwareness.<>c__DisplayClass7.<FindView>b__5(ViewContext viewContext, TextWriter writer, IViewDataContainer viewDataContainer) +238 Orchard.Mvc.ViewEngines.ThemeAwareness.LayoutView.Render(ViewContext viewContext, TextWriter writer) +99 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +429 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +39 System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +74 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>cDisplayClass1c.<InvokeActionResultWithFilters>b19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>cDisplayClass1c.<InvokeActionResultWithFilters>b19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>cDisplayClass1c.<InvokeActionResultWithFilters>b19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>cDisplayClass1c.<InvokeActionResultWithFilters>b19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>cDisplayClass1c.<InvokeActionResultWithFilters>b19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>cDisplayClass1c.<InvokeActionResultWithFilters>b19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +388 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +72 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +303 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +844 System.Web.Mvc.<>cDisplayClass1d.<BeginExecuteCore>b19() +71 System.Web.Mvc.Async.<>cDisplayClass1.<MakeVoidDelegate>b0() +44 System.Web.Mvc.Async.<>cDisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +42 System.Web.Mvc.Async.WrappedAsyncResult1.End() +151 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +68 System.Web.Mvc.Async.<>cDisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47 System.Web.Mvc.Async.WrappedAsyncResult1.End() +151 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +65 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +45 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +47 System.Web.Mvc.Async.WrappedAsyncResult1.End() +151 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +66 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38 Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) +47 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9628700 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Comments (22)

  1. nduarte reporter

    Hi Bertrand, I've been debugging the code and i found a problem in ShoppingCartController.cs in the method BuildCartShape, you are only setting on the shape the Country and ZipCode if its not null, or if the country is United States. I Hardcoded the values on the method for testing purposes and the error disapeared, the cart form is shown, but the shippingMethods is returning 0, so i cannot see or access the shipping options.

    I see that you have this working well on your website nwazet.com, what version of the module are you using there?

    Thank´s

    Nuno

  2. nduarte reporter

    The first problem is that when you never assign the properties Country an ZipCode to the shape unless the variables country and zipCode passes the validation of Country.UnitedStates or Country not null, when the user goes for the cart page for the first time these are not set, so there is no way for those properties to be set on the shape.

  3. Bertrand Le Roy repo owner

    The problem is that I cannot reproduce your problem. Please provide exact repro steps. (yes, I am using 1.7 on my dev box, and 1.6.1 in production for the moment)

  4. nduarte reporter
    • Downloaded the module from bitbucket and put it in modules folder of a clean orchard instalation.
    • on the dasboard i enabled nwazet.commerce, shipping, attributes, and checkout. *on the dashboard create a shipping provider based on weight.
    • on the dasboard create a product (put a value on the weight property).
    • on dashboard assigned the shopping cart widget to the asidesecond zone.
    • on the front end i go to the product url
    • on the product page added the product to cart.
    • on the the cart widget going for checkout or viewcart link the error comes in shoppingcart.cshtml.
  5. nduarte reporter

    Hello Bertrand, I override the the shape and checked for nulls on Model.Country and Model.ZipCode, then i had another error on ShippingInfoForm.cshtml :

    Operator '==' cannot be applied to operands of type 'string' and 'ClaySharp.Clay'

    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: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Operator '==' cannot be applied to operands of type 'string' and 'ClaySharp.Clay'

    Source Error:

    Line 12: <legend>t("In order for us to estimate your shipping costs, please let us know where your package should be sent.")</legend> Line 13: @Html.Label("Country", T("Destination country")) Line 14: @Html.DropDownList("Country", Country.List.Select(c => new SelectListItem { Line 15: Text = c, Line 16: Selected = c == Model.Country

    I override this shape as well, checking for nulls, and casting Model.Country to string, it worked with no errors, now i can select country and assign a zipcode and the values are stored in localstorage (they display on the form, and i also checked localstorage on Chrome developer tools), but it doesn´t list the shipping methods neither the shipping calculations.

    Nuno.

  6. Bertrand Le Roy repo owner

    Clay isn't in Orchard anymore. With 1.7 so close, I won't invest time in fixing this, sorry. Not sure what you mean by "shipping calculations". If shipping methods are not listed, maybe they don't apply to what's in the cart.

  7. nduarte reporter

    So you are saying i should upgrade to orchard 1.7 or keep orchard 1.6.1 and use the latest version of your module? By the way, does the latest version of your module work on orchard 1.6.1?

  8. nduarte reporter

    About the shipping calculations: I create Weight Based Shipping Method on the dashboard and chose all destination areas availables. I created a product on the dashboard and put a value on the weight. Shouldn´t the cart show the estimate shipping price after choosing the country and zip code? I checked on your site nwazet.com and it does that.

  9. nduarte reporter

    Aha, I found the bloody mouse :) On the dashboard when creating a weight base shipping methods you have to put a value on the Maximum Weight. After doing that and overriding the shapes everything works now. Thank´s for your help. You can close this one. Nuno

  10. Log in to comment