ecshop 分类树统计显示商品数量
includes/lib_goods.php 下找到这两个函数
function get_categories_tree
function get_child_tree
在它们2个函数里面找到
foreach ($res AS $row)
function get_categories_tree 的里面加入
/*获得分类下商品总数*/ $children = get_children($row['cat_id']); $sql = 'SELECT count(*)' . "FROM " . $GLOBALS['ecs']->table('goods') . ' AS g '. 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND '. 'g.is_delete = 0 AND (' . $children . 'OR ' . get_extension_goods($children) . ') '; $cat_goods_num=$GLOBALS['db']->getOne($sql); $cat_arr[$row['cat_id']]['goods_num'] = $cat_goods_num == '' ? 0 : $cat_goods_num;
function get_child_tree 的里面加入
/*获得分类下商品总数*/ $children = get_children($row['cat_id']); $sql = 'SELECT count(*)' . "FROM " . $GLOBALS['ecs']->table('goods') . ' AS g '. 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND '. 'g.is_delete = 0 AND (' . $children . 'OR ' . get_extension_goods($children) . ') '; $cat_goods_num=$GLOBALS['db']->getOne($sql); $three_arr[$row['cat_id']]['goods_num'] = $cat_goods_num == '' ? 0 : $cat_goods_num;
End!
阅读剩余
版权声明:
作者:z1988
链接:https://www.z1988.com/338.html
文章版权归作者所有,未经允许请勿转载。
作者:z1988
链接:https://www.z1988.com/338.html
文章版权归作者所有,未经允许请勿转载。
THE END