属性的排序有三个方式:sort_order, attr_price, goods_attr_id
如果要修改的话,修改 includes/lib_goods.php文件的 get_goods_properties()函数。
找到 ORDER BY a.sort_order, g.attr_price, g.goods_attr_id 这里,改为:
ORDER BY g.goods_attr_id 这样就是以你的输入顺序来显示了。
情况一:添加新产品时,让属性按照添加的顺序(属性id)排列
修改/inclues/lib_goods.php
/* 获得商品的规格 */
$sql = "SELECT a.attr_id, a.attr_name, a.attr_group, a.is_linked, a.attr_type, ".
"g.goods_attr_id, g.attr_value, g.attr_price " .
'FROM ' . $GLOBALS['ecs']->table('goods_attr') . ' AS g ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('attribute') . ' AS a ON a.attr_id = g.attr_id ' .
"WHERE g.goods_id = '$goods_id' " .
'ORDER BY g.goods_attr_id, a.sort_order, g.attr_price';
$res = $GLOBALS['db']->getAll($sql);