ECSHOP后台设置模板排序让商品分类排序按数字大小排序

2016-06-13 13:05 来源:www.chinab4c.com 作者:ecshop专家

设置模板 排序调用,从 1 开始1、admin\includes\lib_template.php$i = 1;    //by neoif ($result && $result > 0){    foreach ($lib_matches AS $k => $v)     2、includes\lib_goods.phpfunction 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 neoreturn $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 排序了 。 效果: