PageAdmin网站内容管理系统(CMS)交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

想要在首页添加热门产品推荐 [复制链接]

1#
<div class="container margin-top-20">
    <p class="ma-title">RECOMMENDATION</p>
    <ul class="categortes imgae-same-size">
        @foreach (var item in Html.InfoDataList(new { ColumnId = 223, ShowNumber = 8, OrderBy = "isGood" }))
        {
            string url = Html.InfoDataUrl((int)item.ColumnId, (int)item.Id);
            <li class="col-sm-3 text-center margin-bottom-20">
                <a href="@url" class="margin-bottom-20" style="display:block;">
                    <img src="@item.Thumbnail" alt="@item.Title" />
                </a>
                <a href="@url" class="margin-top-10 home-jtan-title font-size-12">@(item.Title)</a>
            </li>
        }
    </ul>
</div>
但是出来的页面不是指定热门产品,怎么修改?
分享 转发
TOP
2#

OrderBy是排序

@foreach (var item in Html.InfoDataList(new { ColumnId = 223, ShowNumber = 8, isGood=1,OrderBy="thedate desc"}))

这个就是调用一级推荐的信息
TOP
3#

明白了,我想调用isGood的指定热门产品,请问怎么调用?
TOP
4#

编辑页面可以设置信息的推荐级别,总共10个级别
TOP
5#

我想调用整个products栏目中所有的热门推荐,不想只调用某个ID里的热门,请问怎么调用?

<div class="container margin-top-20">
    <p class="ma-title">MAIN CATEGORIES</p>
    <ul class="categortes imgae-same-size">
        @foreach (var item in Html.InfoDataList(new { ColumnId = 243, ShowNumber = 8, IsGood = "1" }))
        {
            string url = Html.InfoDataUrl((int)item.ColumnId, (int)item.Id);
            <li class="col-sm-3 text-center margin-bottom-20">
                <a href="@url" class="margin-bottom-20" style="display:block;">
                    <img src="@item.Thumbnail" alt="@item.Title" />
                </a>
                <a href="@url" class="margin-top-10 home-jtan-title font-size-12">@(item.Title)</a>
            </li>
        }
    </ul>
</div>

将ColumnId = 243改成ColumnId = “products”  好像没用
TOP
6#

改成:Table = “products”
ColumnId这个参数删除掉
TOP
7#

<div class="container margin-top-20">
    <p class="ma-title">MAIN CATEGORIES</p>
    <ul class="categortes imgae-same-size">
        @foreach (var item in Html.InfoDataList(new { Table="productS", ShowNumber = 8, IsGood = "1" }))
        {
            string url = Html.InfoDataUrl((int)item.ColumnId, (int)item.Id);
            <li class="col-sm-3 text-center margin-bottom-20">
                <a href="@url" class="margin-bottom-20" style="display:block;">
                    <img src="@item.Thumbnail" alt="@item.Title" />
                </a>
                <a href="@url" class="margin-top-10 home-jtan-title font-size-12">@(item.Title)</a>
            </li>
        }
    </ul>
</div>

是这样吗?这样调不出数据
TOP
8#

<div class="container margin-top-20">
    <p class="ma-title">MAIN CATEGORIES</p>
    <ul class="categortes imgae-same-size">
        @foreach (var item in Html.InfoDataList(new { ColumnIds="243,247",ShowNumber = 8, IsGood = "1" }))
        {
            string url = Html.InfoDataUrl((int)item.ColumnId, (int)item.Id);
            <li class="col-sm-3 text-center margin-bottom-20">
                <a href="@url" class="margin-bottom-20" style="display:block;">
                    <img src="@item.Thumbnail" alt="@item.Title" />
                </a>
                <a href="@url" class="margin-top-10 home-jtan-title font-size-12">@(item.Title)</a>
            </li>
        }
    </ul>
</div>

换成ColumnIds的方式也不行,不知道哪错了?
TOP
9#

可以了,是我错了,IsGood = "1" 是推荐,记成热门的了
TOP
发新话题 回复该主题