Checkout Stopped Working

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 12 ans
The property must be overridden in a class. In your capture, it seems to be directly in a namespace.

You need to have


public abstract class ExtendedWebViewPage<TModel> : Nop.Web.Framework.ViewEngines.Razor.WebViewPage<TModel>
{
      <put the property override here>
}
Il y a 12 ans
Thanks Asoarea.

Am I suppose to put anything instead of TModel ?

Cause right now, it is not working ! The Dark Orange and nopClassic themes work fine (like they did before) .. but the Theme00 (my custom theme) is not working.

I get the following:

http://i55.tinypic.com/jsj76x.png

Here's my code:

http://pastebin.com/6yhuyfbG

I would greatly appreciate any help.

Thanks
Il y a 12 ans
Copy that into any file inside a namespace scope (later refered to as <your namespace>:


public abstract class ExtendedWebViewPage<TModel> : Nop.Web.Framework.ViewEngines.Razor.WebViewPage<TModel>
    {
        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;
            }
        }
    }

    public abstract class ExtendedWebViewPage : ExtendedWebViewPage<dynamic>
    {
    }


Then, you need to assign that page as the default page for all views. To do that, in your web project folder, in Views/Web.config change:


<pages pageBaseType="Nop.Web.Framework.ViewEngines.Razor.WebViewPage">

to

<pages pageBaseType="<your namespace>.ExtendedWebViewPage">


Make the same modification in Themes/<your theme>/Views/Web.config

Then make sure to restart your app.
Il y a 12 ans
Hi Asoares

Not working again :( Here's the code for my WebViewPage.cs

I also made the edits to the Views/Web.config in both locations. But still my custom theme doesn't render as it should.

From the provided code, my namespace would be { Nop.Web.Framework.ViewEngines.Razor } right ?

please help, this is of major importance to me. since my shop is all about themeing.
Il y a 12 ans
Ciwan if you view the source can you see if there are parts missing? Maybe that will help narrow the scope to solution the problem.
Il y a 12 ans
Put a breakpoint in the Layout override and run the app in debug in vs2010 and . Check if it called and for what views. If it is not called, then either the web.config has not been properly edited or you didn't restart the app. Let me know if the break point is hit.
Il y a 12 ans
Hi Asoares

I did as you suggest, and yes it does get hit, but the layout is null ! here's a screenshot:

http://i56.tinypic.com/2i23qbm.jpg

And here's the code for:

1) Nop.Web/Views/Web.config

2) Nop.Web/Themes/Theme00/Views/Web.config

What am I doing wrong ? I've followed your exact steps :( Could it be because of the code below in { Nop.Web/Themes/Theme00/Views/_ViewStart.cshtml }

@{
    Layout = "~/Views/Shared/_ColumnsFluid.cshtml";
}

Thanks
Il y a 12 ans
If you're running in vs2010, make sure to manually stop any instance of the asp.net development server and restart visual studio.

When the breakpoint was hit, was the layout null at the beginning of the call? That might be the case if the code is called for a partial view (that has no layout).
Il y a 12 ans
Yep, it is null at the begining of the call, here's a screenshot:

http://i51.tinypic.com/140w679.jpg

In the Browser, the URL is:

http://localhost:port/

So it isn't for a PartialView :( Also, yes I manually stopped the server instance.

When I tell Visual Studio, it again Hits the breakpoint ! is that normal ?

:(
Il y a 12 ans
Even tough you hit localhost:<port>/, it can be hit for a partial view if your main view has Html.Action or Html.RenderAction in it. The only reason I can see its not working as it should is if you didn't modify both web.config (in your theme's view folder and in the main app's view folder) or that you didn't restart visual studio.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.