ecshop后台设置,模板排序调用$i

设置模板 排序调用,从 1 开始
1、adminincludeslib_template.php
$i = 1;    //by neo
if ($result && $result > 0)
{
foreach ($lib_matches AS $k => $v)

2、includeslib_goods.php
function assign_cat_goods($cat_id, $num = 0, $from = 'web', $order_rule = '')
改成
function assign_cat_goods($cat_id, $num = 0, $from = 'web', $order_rule = '', $sort_order = 0)    //by neo

/* 分类信息 */
$sql = 'SELECT cat_name FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '$cat_id'";
$cat['name'] = $GLOBALS['db']->getOne($sql);
$cat['url']  = build_uri('category', array('cid' => $cat_id), $cat['name']);
$cat['id']   = $cat_id;
$cat['i']   = $sort_order;    //by neo

return $cat;

3、includeslib_main.php
查找
function assign_dynamic($tmp)
找到里面的
$sql = 'SELECT id, number, type FROM
改成
$sql = 'SELECT id, number, type, sort_order FROM

继续找到
/* 分类下的商品 */
$GLOBALS['smarty']->assign('goods_cat_' . $row['id'], assign_cat_goods($row['id'], $row['number']));
改成
/* 分类下的商品 */

$GLOBALS['smarty']->assign('goods_cat_' . $row['id'], assign_cat_goods($row['id'], $row['number'], $from = 'web', $order_rule = '', $row['sort_order']));

这样 cat_goods.lbi 里面能使用 $goods_cat.i 排序了 。

效果:

阅读剩余
THE END