关于在商品详情页面显示同一品牌的商品列表 的解决方式
2016-07-07 15:04 来源:www.chinab4c.com 作者:ecshop专家
[url=http://bbs.ecshop.com/thread-95640-1-1.html]http://bbs.ecshop.com/thread-95640-1-1.html 这个帖子的解决方法 是个笨方法来的,但总归是有点用 /** * 获得指定商品id的同品牌商品 * * @paraminteger$goods_id * @paramarray $attr * * @returnvoid */ function get_brand_goodslist($goods_id) { $brand_id=$GLOBALS['db']->getOne("select brand_id from ". $GLOBALS['ecs']->table('goods') . " where goods_id=$goods_id"); $sql=" select * from ". $GLOBALS['ecs']->table('goods'). " where brand_id in($brand_id) limit 5"; $res = $GLOBALS['db']->query($sql); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $arr[$row['goods_id']]['goods_id']= $row['goods_id']; $arr[$row['goods_id']]['goods_name']= $row['goods_name']; $arr[$row['goods_id']]['short_name']= $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; $arr[$row['goods_id']]['goods_thumb']= get_image_path($row['goods_id'], $row['goods_thumb'], true); $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']); $arr[$row['goods_id']]['shop_price']= price_format($row['shop_price']); $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']); if ($row['promote_price'] > 0) { $arr[$row['goods_id']]['promote_price'] = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); $arr[$row['goods_id']]['formated_promote_price'] = price_format($arr[$row['goods_id']]['promote_price']); } else { $arr[$row['goods_id']]['promote_price'] = 0; } } return $arr; } 在goods.php 中加这样一个方法,然后调用就可以啦~~~ 大家多提意见哦~~~ [/url] |
回答:
支持一个! |
支持一下, 很好的功能, 收藏了 |
請問版主大大,該如何"調用"呢?? |
很好,支持 |
最近更新
常用插件
- ecshop分类批量扩展插件
ecshop分类批量扩展插件,这个插件是ecshop插件里面比较核心的插件。我们...
- ecshop商品分类名称增加样
ecshop插件介绍:本插件可以方便在后台管理,为ecshop商品分类名称增加样...
- ecshop二次开发详细页面生
插件介绍: ECSHOP系统,在很多时候,很多商品没有人购买,不但购买的人...
- ecshop2.7.1打印发货单插件
ecshop2.7.1打印发货单插件介绍:ecshop2.7.1和以前的ecshop版本不一样,ecs...
- ecshop二次商品订购人信息
ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的...
ecshop热门问答
ecshop热门资料
ecshop重头
ecshop在线等
ecshop放回购物车
ecshop中心
ecshop模板绑定!
ecshop插件
ecshopredis
ecshop电子邮件
ecshop导航条
ecshop相簿
ecshop三给分类
ecshop身份证号码
ecshop童鞋
ecshop改版
PutCookie
ecshop北京市
ecshopEC
ecshop得不到
ecshop订购
ecshop会员导出
ecshopnormal
qq联合登陆接口
ecshop动态
ecshop时间戳
ecshop用户名称
ecshop模板教程
ecshopPRIVILEGE
ecshop凡客
ecshop最好
ecshop按比例