欢迎来到天天文库
浏览记录
ID:38218364
大小:35.50 KB
页数:3页
时间:2019-05-28
《ecshop商品详情页面属性价格显示其对应价格》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Ecshop商品详情页面属性价格显示其对应价格ECSHOP开发中心(68ecshop.com)ecshop默认的商品属性显示的是加多少钱第一步:在lib_goods.php中找到functionget_goods_properties 方法将下面的get_goods_properties方法覆盖掉原来的get_goods_properties方法/** *获得商品的属性和规格 * *@access public *@param integer$goods_id *@return array */ //yyy修改startfunctionget_
2、goods_properties($goods_id,$shop_price=0)//yyy修改end{ /*对属性进行重新排序和分组*/ $sql="SELECTattr_group". "FROM".$GLOBALS['ecs']->table('goods_type')."ASgt,".$GLOBALS['ecs']->table('goods')."ASg". "WHEREg.goods_id='$goods_id'ANDgt.cat_id=g.goods_type"; $grp=$GLO
3、BALS['db']->getOne($sql); if(!empty($grp)) { $groups=explode("",strtr($grp,"r",'')); } /*获得商品的规格*/ $sql="SELECTa.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[
4、'ecs']->table('goods_attr').'ASg'. 'LEFTJOIN'.$GLOBALS['ecs']->table('attribute').'ASaONa.attr_id=g.attr_id'. "WHEREg.goods_id='$goods_id'". 'ORDERBYa.sort_order,g.attr_price,g.goods_attr_id'; $res=$GLOBALS['db']->getAll($sql); $arr['pro']=arr
5、ay(); //属性 $arr['spe']=array(); //规格 $arr['lnk']=array(); //关联的属性foreach($resAS$row) { $row['attr_value']=str_replace("",'',$row['attr_value']); if($row['attr_type']==0) { $group=(isset($groups[$row['attr_group']]))?$groups[$ro
6、w['attr_group']]:$GLOBALS['_LANG']['goods_attr']; $arr['pro'][$group][$row['attr_id']]['name'] =$row['attr_name']; $arr['pro'][$group][$row['attr_id']]['value']=$row['attr_value']; } else { $arr['spe'][$row['attr_id']]['attr_type
7、']=$row['attr_type']; $arr['spe'][$row['attr_id']]['name'] =$row['attr_name']; //yyy修改start $arr['spe'][$row['attr_id']]['values'][]=array( 'label' =>$row['attr_value'],
8、 'price' =>$row['attr_pr
此文档下载收益归作者所有