织梦栏目列表按附加表自定义字段排序,不是主表字段排序
例如我在内容模型-普通文章模型里添加了个自定义字段 ,叫 【价格】【price】

在栏目列表模板里按价格高的排序显示
{dede:list pagesize='6' orderby='price' orderway='desc'}
orderby='price' 按价格排序
orderway='desc' 从高到低,如果想从低到高用 orderway='asc'
- 教程
打开/include/arc.listview.class.php
找到,大概在776行左右
$addtable = $this->ChannelUnit->ChannelInfos['addtable'];
复制剪贴到
//排序方式
上面
图

继续找到,大概在768行的
else if($orderby=="lastpost") {
在它上面加入排序字段
else if($orderby=="price") {$ordersql = " ORDER BY ({$addtable}.price + 0) $orderWay";}
如图,2个price改成你自己的字段名

最后找到,大概在812行左右
if(preg_match('/hot|click|lastpost/', $orderby))
改成
if(preg_match('/hot|click|lastpost|price/', $orderby))
price 改成你自己的字段,注意前面要有 | 竖线隔开

- 效果
