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

首页 » PageAdmin使用区 » 安装及使用交流 » 想要在首页添加热门产品推荐
netxm - 2020/4/8 9:40:38
<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>
但是出来的页面不是指定热门产品,怎么修改?
xiyou - 2020/4/8 10:51:04
:LOrderBy是排序

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

这个就是调用一级推荐的信息
netxm - 2020/4/8 10:54:35
明白了,我想调用isGood的指定热门产品,请问怎么调用?
xiyou - 2020/4/8 11:17:26
编辑页面可以设置信息的推荐级别,总共10个级别
netxm - 2020/4/8 11:26:25
我想调用整个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”  好像没用
xiyou - 2020/4/8 15:10:01
改成:Table = “products”
ColumnId这个参数删除掉
netxm - 2020/4/8 15:23:20
<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>

是这样吗?这样调不出数据
netxm - 2020/4/8 16:13:34
<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的方式也不行,不知道哪错了?
netxm - 2020/4/8 16:49:05
可以了,是我错了,IsGood = "1" 是推荐,记成热门的了
1
查看完整版本: 想要在首页添加热门产品推荐