zoukankan      html  css  js  c++  java
  • NopCommerce 在Category 显示 Store List列表

    实现效果如下:

    1.在前台Web的Category Menu显示 Store;

    2.点击 Store 显示 Store List列表;

    3.点击 列表Store 的 Company Name 进入该Store的单页查看;

    主要调整步骤: 

    代码层面Nop.Web 项目

    1.路由

             Infrastructure 的RouteProvider.cs

      仿照VendorList 增添路由配置

    //stores
    
    routes.MapLocalizedRoute("StoreList",
    
                                         "store-all/",
    
                                         new { controller = "Catalog", action = "StoreAll" },
    
                                         new[] { "Nop.Web.Controllers" });
    
     
    
    //store
    
    routes.MapLocalizedRoute("Store",
    
                       "store/{storeId}",
    
                       new { controller = "Catalog", action = "Store" },
    
                       new { storeId = @"d+" },
    
                       new[] { "Nop.Web.Controllers" });

    2.Model

      Nop.Web Models/Catalog 增加 StoreModel

    3.Controller Action

      Nop.Web Controllers/Catalog 仿照VendorAll,增加StoreAll

      同时增添相应的 _storeServices等

    4.View

      Nop.Web Views/Catalog 仿照VendorAll,增加StoreAll

    @model IList<StoreModel>
    @{
        Layout = "~/Views/Shared/_ColumnsTwo.cshtml";
    
        //title
        Html.AddTitleParts(T("PageTitle.Stores").Text);
        //page class
        Html.AppendPageCssClassParts("html-store-list-page");
    }
    @using Nop.Web.Models.Catalog;
    <div class="page store-list-page">
        <div class="page-title">
            <h1>@T("Stores.List")</h1>
        </div>
        <div class="page-body">
            <div class="store-grid">
                <div class="item-grid">
                        @foreach (var item in Model)
                        {
                                <div class="item-box">
                                    <h2 class="title">
                                        <a href="@item.Url" title="@item.Url">
                                            @item.Name
                                        </a>
                                    </h2>
    
    
                                        <div>
                                            <a href="@Url.RouteUrl("Store", new { storeId = item.Id })" title="@item.CompanyName">
                                                @item.CompanyName
                                            </a>
                                        </div>
                                        <div>
                                            @item.CompanyPhoneNumber
                                        </div>
    
                                    <div>
                                        @item.CompanyAddress
                                    </div>
                                   
                                </div>
                        }
                </div>
            </div>
    
        </div>
    </div>

    5.css

      样式调整

    6.运行网站 Admin 后台

      Categorys 增加 Store ,  并配置其SEO 如Store-all

      Language 配置相应的文字显示;

    7.运行网站 查看效果

  • 相关阅读:
    一个随机数生成函数
    HTTP Post请求过程详解
    md5加密算法c语言版
    android popupwindow 自定义视图
    android 获取顶部状态栏的高度
    android 显示和隐藏输入框
    android tablayout + recycleview 简单使用
    jetpack paging使用
    android 自定义控件 属性配置
    vueLazyload 图片懒加载
  • 原文地址:https://www.cnblogs.com/freeliver54/p/6214224.html
Copyright © 2011-2022 走看看