bleroy / Nwazet.Commerce

Idiomatic commerce module for Orchard CMS.
BSD 3-Clause "New" or "Revised" License
26 stars 21 forks source link

Error on ShoppingCart.cshtml #11

Closed bleroy closed 8 years ago

bleroy commented 11 years ago

Originally reported by: nduarte (Bitbucket: nduarte, GitHub: nduarte)


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: Line 109: 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.b15(DisplayContext displayContext) +160 Orchard.DisplayManagement.Descriptors.<>cDisplayClass5.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.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.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.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.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.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.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.b19() +71 System.Web.Mvc.Async.<>cDisplayClass1.b0() +44 System.Web.Mvc.Async.<>cDisplayClass8`1.b7(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.<>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.Controller.EndExecute(IAsyncResult asyncResult) +65 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39 System.Web.Mvc.<>cDisplayClass8.b3(IAsyncResult asyncResult) +45 System.Web.Mvc.Async.<>cDisplayClass4.b3(IAsyncResult ar) +47 System.Web.Mvc.Async.WrappedAsyncResult`1.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


bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


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

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


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.

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


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?

bleroy commented 11 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


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.

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


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: @T("In order for us to estimate your shipping costs, please let us know where your package should be sent.") 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.

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


I'll do that asap. I' m going to have some dinner , in an hour and half i'll give it a try and feedback.thank's

bleroy commented 11 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


OK, I'll try those on a new instance. In the meantime, you can override the shape in your theme and add some explicit null checks.

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


bleroy commented 11 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


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)

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


you are using orchard 1.7? is it stable enough for production?

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


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.

bleroy commented 11 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


What are your exact repro steps?

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


Yes i have have shipping methods defined

bleroy commented 11 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


Do you have shipping methods defined?

bleroy commented 11 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


I'm using the latest on the site. What are your exact repro steps?

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


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

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


Ok, i´ll do that

bleroy commented 11 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


Seems like a completely different issue. Please file a separate bug for that, specifying the version of IE you're using.

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


By the way, i also tried Internet explorer, when i click add to cart button, i get this error : Error: 'JSON' is undefined

bleroy commented 11 years ago

Original comment by nduarte (Bitbucket: nduarte, GitHub: nduarte):


I did that already. I´m using orchard v.1.6.1.0 and Nwazet.Commerce changeset 35ef4e256360. Thanks

bleroy commented 11 years ago

Original comment by Bertrand Le Roy (Bitbucket: bleroy, GitHub: bleroy):


Please clear your browser cache and local storage. What version are you using?