需要做点二次开发 给段我写过的代码给你参考: //引用产品列表 www.lyecs.com
- $arr[$row['goods_id']]['attr_list'] = get_attr_list_ly($row['goods_id']);
复制代码 //引用产品列表 www.lyecs.com
- function get_attr_list_ly($goods_id)
- {
- $sql= "select p.*,ga.attr_value from ".$GLOBALS['ecs']->table('products')." AS p ".
- " LEFT JOIN ".$GLOBALS['ecs']->table('goods_attr'). " AS ga ON ga.goods_attr_id = p.goods_attr ".
- " WHERE p.goods_id='".$goods_id."'";
- $res = $GLOBALS['db']->getAll($sql);
- foreach($res AS $key => $row){
- $res[$key]['attr_ids']=explode("|",$row['goods_attr']);
- $res[$key]['values']='';
- foreach($res[$key]['attr_ids'] AS $val){
- $res[$key]['values'] .=' '.$GLOBALS['db']->getOne("select attr_value from ".$GLOBALS['ecs']->table('goods_attr')." where goods_attr_id='".$val."'");
- }
- }
- return $res;
- }
复制代码 |
|