如何更新EngineContext.Current.Resolve <storeinformationsettings>()。升级到nopcommerce 3.9后,ResponsiveDesignSupported

时间:2017-07-28 08:07:20

标签: c# nopcommerce nopcommerce-3.90

我们尝试将现有的nopcommerce应用程序从3.40升级到3.90。

遵循http://docs.nopcommerce.com/display/en/Upgrading+nopCommerce的所有步骤。

来自自定义主题和自定义插件的所有web.config文件MVC版本已从System.Web.Mvc, Version=5.0.0.0,更新为System.Web.Mvc, Version=5.2.3.0

现在我们在自定义主题中收到了以下错误。

  

编译器错误消息:CS1061:'Nop.Core.Domain.StoreInformationSettings'不包含'ResponsiveDesignSupported'的定义,并且没有扩展方法'ResponsiveDesignSupported'接受类型'Nop.Core.Domain.StoreInformationSettings'的第一个参数可以找到(你错过了使用指令或汇编引用吗?)

StoreInformationSettings中似乎没有ResponsiveDesignSupported属性。

nopcommerce 3.90中是否有办法获得ResponsiveDesignSupported设置?

下面是一些代码

@model TopMenuModel
@using Nop.Core.Domain
@using Nop.Core.Infrastructure
@using Nop.Web.Models.Catalog;
@{
    var isRtl = this.ShouldUseRtlTheme();
    var supportResponsive = EngineContext.Current.Resolve<StoreInformationSettings>().ResponsiveDesignSupported;
}
@helper RenderCategoryLine(CategorySimpleModel category, int level, bool responsiveMobileMenu)
{
    <li>
        <a href="@Url.RouteUrl("Category", new { SeName = category.SeName    })">@category.Name
        @if (category.NumberOfProducts.HasValue)
        {
            <text> </text>@T("Categories.TotalProducts", category.NumberOfProducts.Value)
        }
        </a>
        @{
            var levelClass = "";
            if (level == 0)
            {
                levelClass = "firstLevel";
                <div class="top-menu-triangle"></div>
            }
            if (category.SubCategories.Count > 0)
            {
                if (responsiveMobileMenu)
                {
                    <span class="expand">&nbsp;</span>
                }
                <div class="sublist @levelClass">
                <ul>
                    @foreach (var subCategory in  category.SubCategories)
                    {
                        @RenderCategoryLine(subCategory, level + 1, responsiveMobileMenu)
                    }
                </ul>
                </div>
            }
        }
    </li>
}

<ul class="top-menu">
    @Html.Widget("header_menu_before")
    @if (Model.Categories.Count > 0)
    {
        <li><a href="@Url.RouteUrl("HomePage")"><i class="fa fa-home fa-lg"> </i></a></li>
        foreach (var category in Model.Categories)
        {
            @RenderCategoryLine(category, 0, false)
        }
    }
    else
    {
        //no categories to display? in this case let's diplay some default menu items (should we?)
        <li><a href="@Url.RouteUrl("HomePage")">@T("HomePage")</a></li>
        if (Model.RecentlyAddedProductsEnabled)
        {
            <li><a href="@Url.RouteUrl("RecentlyAddedProducts")">@T("Products.NewProducts")</a>
            </li>
        }
        <li><a href="@Url.RouteUrl("ProductSearch")">@T("Search")</a>         </li>
        <li><a href="@Url.RouteUrl("CustomerInfo")">@T("Account.MyAccount")</a></li>
        if (Model.BlogEnabled)
        {
            <li><a href="@Url.RouteUrl("Blog")">@T("Blog")</a></li>
        }
        if (Model.ForumEnabled)
        {
            <li><a href="@Url.RouteUrl("Boards")">@T("Forum.Forums")    </a></li>
        }
        <li><a href="@Url.RouteUrl("ContactUs")">@T("ContactUs")</a></li>
    }
    @Html.Widget("header_menu_after")
</ul>

<script type="text/javascript">
    $('li', '.top-menu').on('mouseenter', function () {
        $('a', $(this)).first().addClass('hover');
        if (!$(this).parent().hasClass('top-menu')) {
            var width = $(this).innerWidth();
            $('.sublist', $(this)).first().css('@(isRtl ? "right" : "left")', width + 15);
        }
        $('.sublist', $(this)).first().addClass('active');
        $('.top-menu-triangle', $(this)).addClass('active');
    });

    $('li', '.top-menu').on('mouseleave', function () {
        $('a', $(this)).first().removeClass('hover');
        $('.sublist', $(this)).first().removeClass('active');
        $('.top-menu-triangle', $(this)).removeClass('active');
    });

    </script>

@if (supportResponsive)
{
    <div id="mob-menu-button">
        <a href="">
            <span class="icon"><span class="line"></span><span class="line"></span><span class="line"></span></span>
            @{
                var responsiveMenuTitle = Model.Categories.Count > 0 ? T("Categories") : T("Menu");
            }
            <span>@responsiveMenuTitle</span>
        </a>
    </div>
    <ul class="mob-top-menu">
        @Html.Widget("mob_header_menu_before")
        @if (Model.Categories.Count > 0)
        {
            foreach (var category in Model.Categories)
            {
                @RenderCategoryLine(category, 0, true)
            }
        }
        else
        {
            //no categories to display? in this case let's diplay some default menu items (should we?)
            <li><a href="@Url.RouteUrl("HomePage")">@T("HomePage")</a></li>
            if (Model.RecentlyAddedProductsEnabled)
            {
                <li>
                    <a href="@Url.RouteUrl("RecentlyAddedProducts")">@T("Products.NewProducts")</a>
                </li>
            }
            <li><a href="@Url.RouteUrl("ProductSearch")">@T("Search")</a> </li>
            <li><a href="@Url.RouteUrl("CustomerInfo")">@T("Account.MyAccount")</a></li>
            if (Model.BlogEnabled)
            {
                <li><a href="@Url.RouteUrl("Blog")">@T("Blog")</a></li>
            }
            if (Model.ForumEnabled)
            {
                <li><a href="@Url.RouteUrl("Boards")">@T("Forum.Forums")    </a></li>
            }
            <li><a href="@Url.RouteUrl("ContactUs")">@T("ContactUs")</a></li>
        }
        @Html.Widget("mob_header_menu_after")
    </ul>
    <script type="text/javascript">
        $('a', $('#mob-menu-button')).toggle(function() {
                $('.mob-top-menu').addClass('show');
            },
            function() {
                $('.mob-top-menu').removeClass('show');
            }
        );

        $(function($) {
            $('.mob-top-menu .expand').click(function() {
                var parent = $(this).parent();
                if (parent.hasClass('active')) {
                    $(".sublist:first", parent).hide(300);
                    parent.removeClass('active');
                } else {
                    $(".sublist:first", parent).show(300);
                    parent.addClass('active');
                }
            });
        });
    </script>
}

2 个答案:

答案 0 :(得分:0)

从版本3.70开始,ResponsiveDesignSupported设置不再可用,并且nop支持开箱即用的响应式主题,如果你想关闭或打开主题中的响应式设计,它应该通过jquery在你的主题中完成,的CSS。

答案 1 :(得分:-2)

从nopCommerce 3.6开始删除了响应式设计支持的选项。

如果您从任何供应商处购买了自定义主题,请获取nopCommerce 3.9版本的主题。

相关问题