设置模板 排序调用,从 1 开始
1、admin\includes\lib_template.php
$i = 1; //by zuimoban
if ($result && $result > 0)
{
foreach ($lib_matches AS $k => $v)
2、includes\lib_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 zuimoban
/* 分类信息 */
$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 zuimoban
return $cat;
3、includes\lib_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 排序了 。
效果:
(责任编辑:好模板) |