Checkout Stopped Working

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 anni tempo fa
Hi Guys

I have edited with the [ OrderSummary.cshtml ] file to make it match my theme, but while doing so I have broke something, and I don't know what :(

Here is my code, can someone please tell me what do I need to add back to get the checkout to work as normal ?

As you can see I have removed many of the code block modules which I know for certain won't be used in my shop. But unfortunatley that has had cause on the check out.

Here is the original code for comparison.

I would greatly appreciate any help.

Thank You.
12 anni tempo fa
By the way, NopCommerce uses a ThemableViewEngine locating views per theme. I assume what you meant is that you edited the original file in /Views/ShoppingCart. Instead, copy the OrderSummary.cshtml file to /Themes/<your theme>/Views/ShoppingCart and edit the copy. This file will be loaded when your theme is active.

What I suggest you do is to take back the original file from codeplex, copy it as I described and modify it while testing that things keep working.
12 anni tempo fa
So the safe to theme would be to copy all the files & folders from one of the default themes, onto my new theme folder and do the edits there ?

Up to now .. I have been playing with the originals !! Let me try that.

Thanks
12 anni tempo fa
Yes you can do that or just copy the files you actually modify to make sure to use the latest version of the views you didn't modify if you reinstall a new version of Nop in the future.

The only files right now that can't be modified out of the box are the views used as Layout because they are not processed through the view engine.
12 anni tempo fa
Oh so like [ _Root.cshtml ] & [ _ColumnsThree ] ? << I can't edit those for my theme only ? If I edit them, they changes will effect all other themes ?

If that is the case, then I haven't benefited much, cause my themes are radically different, that I need to edit the Layout files ! :s
12 anni tempo fa
What I meant is that even if you copy _Root, _ColumnsThree, etc to your theme folder, that copied version won't be used. If you modify the original files, it will affect all themes.

What I did to be able to copy those files to my theme's shared folder and have that version used is to modify the base view page to force the Layout property to load the view using the view engine (instead of just locating the view by its path).

In Nop.Web.Framework.ViewEngines.Razor.WebViewPage, add this code. What it does is take the view name out of the path, use the view engine to find the view referenced by that name and set the view's path in Layout. Once you have that, you can override the views used as Layout.


public override string Layout
        {
            get
            {
                var layout = base.Layout;

                if (!string.IsNullOrEmpty(layout))
                {
                    var filename = System.IO.Path.GetFileNameWithoutExtension(layout);
                    ViewEngineResult viewResult = System.Web.Mvc.ViewEngines.Engines.FindView(ViewContext.Controller.ControllerContext, filename, "");

                    if (viewResult.View != null)
                    {
                        layout = (viewResult.View as RazorView).ViewPath;
                    }
                }

                return layout;
            }
            set
            {
                base.Layout = value;
            }
        }
12 anni tempo fa
Are there any limitations or undesired side effects to the above code ?

I'm just curious .. cause if only a few lines of code allows such good functionality, why didn't the development team behind nopCommerce use it !

Thanks

PS. I sorted out the checkout issue ! I still don't know what was wrong .. but I copied original code again, and once again started taking things away !
12 anni tempo fa
I wouldn't copy the whole folder. Copy only the view that you want to change the markup in.
12 anni tempo fa
Yep you're right, that would be better.

Has anyone tried and tested the code above ?
12 anni tempo fa
Asoares

Please help, I'm getting an error :(

http://i54.tinypic.com/ip1is2.jpg
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.