//获取分类下面商品是数量
function get_child_tree_goods_number($cat_id)
{
//调用小分类的商品数量
//$sql = 'SELECT count(goods_id) as number FROM ' . $GLOBALS['ecs']->table('goods') . " as g WHERE is_on_sale = is_alone_sale AND is_delete = 0 AND (g.cat_id IN (select cat_id from ". $GLOBALS['ecs']->table('category') ." where parent_id = $cat_id or cat_id = $cat_id ) OR " . get_extension_goods($cat_id) . ')';
$sql = 'select count(goods_id) as number FROM ' . $GLOBALS['ecs']->table('goods') . " as g right join ". $GLOBALS['ecs']->table('category') ." as c on g.cat_id = c.cat_id where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND (c.parent_id = $cat_id or c.cat_id = $cat_id)";
//只调用当前分类的商品数量
//$sql = 'SELECT count(*) as number FROM ' . $GLOBALS['ecs']->table('goods') . " as g WHERE is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 AND g.cat_id = $cat_id ";
return $GLOBALS['db']->getOne($sql);
}