如何在商品的详情页获取商品所属的上级分类的分类ID呢?
下面由68ecshop的技术来为您解答!
在根目录goods.php中找到
$smarty->assign(‘goods_rank’, get_goods_rank($goods_id));
在这段下面加入
/*获得当前栏目id*/
$sql= "select cat_id from ".$GLOBALS[‘ecs’]->table(‘goods’)."where goods_id =’".$goods_id."’";
$thiscat_id = $GLOBALS[‘db’]->getOne($sql);
/*获得当前栏目id end*/
好啦,$thiscat_id 就是我们所想要的分类的ID啦。
,为你的难过而快乐的是敌人,