ecshop后台我的收藏显示收藏的商品图片和时间的方法
时间:2024年01月31日
/来源:网络
/编辑:佚名
1.打开includes/lib_clips.php的文件
找到下面的函数,红色部分为添加的内容
function get_collection_goods($user_id, $num = 10, $start = 0)
{
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_thumb, g.market_price, g.shop_price AS org_price, '.
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
'g.promote_price, g.promote_start_date,g.promote_end_date, c.rec_id, c.add_time, c.is_attention' .
' FROM ' . $GLOBALS['ecs']->table('collect_goods') . ' AS c' .
" LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ".
"ON g.goods_id = c.goods_id ".
" LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
" WHERE c.user_id = '$user_id' ORDER BY c.rec_id DESC";
$res = $GLOBALS['db'] -> selectLimit($sql, $num, $start);
$goods_list = array();
while ($row = $GLOBALS['db']->fetchRow($res))
{
if ($row['promote_price'] > 0)
{
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
}
else
{
$promote_price = 0;
}
$goods_list[$row['goods_id']]['rec_id'] = $row['rec_id'];
$goods_list[$row['goods_id']]['formated_add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
$goods_list[$row['goods_id']]['is_attention'] = $row['is_attention'];
$goods_list[$row['goods_id']]['goods_id'] = $row['goods_id'];
$goods_list[$row['goods_id']]['goods_name'] = $row['goods_name'];
$goods_list[$row['goods_id']]['goods_thumb'] = $row['goods_thumb'];
$goods_list[$row['goods_id']]['market_price'] = price_format($row['market_price']);
$goods_list[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
$goods_list[$row['goods_id']]['promote_price'] = ($promote_price > 0) ? price_format($promote_price) : '';
$goods_list[$row['goods_id']]['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);
}
return $goods_list;
}
2.然后打开它的模板文件user_clips.dwt
找到这一部分,收藏商品列表页面
样式根据自己的需求改动。
商品图片:<img src="{$goods.goods_thumb}" />
收藏时间:{$goods.formated_add_time}
找到下面的函数,红色部分为添加的内容
function get_collection_goods($user_id, $num = 10, $start = 0)
{
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_thumb, g.market_price, g.shop_price AS org_price, '.
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
'g.promote_price, g.promote_start_date,g.promote_end_date, c.rec_id, c.add_time, c.is_attention' .
' FROM ' . $GLOBALS['ecs']->table('collect_goods') . ' AS c' .
" LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ".
"ON g.goods_id = c.goods_id ".
" LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
" WHERE c.user_id = '$user_id' ORDER BY c.rec_id DESC";
$res = $GLOBALS['db'] -> selectLimit($sql, $num, $start);
$goods_list = array();
while ($row = $GLOBALS['db']->fetchRow($res))
{
if ($row['promote_price'] > 0)
{
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
}
else
{
$promote_price = 0;
}
$goods_list[$row['goods_id']]['rec_id'] = $row['rec_id'];
$goods_list[$row['goods_id']]['formated_add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
$goods_list[$row['goods_id']]['is_attention'] = $row['is_attention'];
$goods_list[$row['goods_id']]['goods_id'] = $row['goods_id'];
$goods_list[$row['goods_id']]['goods_name'] = $row['goods_name'];
$goods_list[$row['goods_id']]['goods_thumb'] = $row['goods_thumb'];
$goods_list[$row['goods_id']]['market_price'] = price_format($row['market_price']);
$goods_list[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
$goods_list[$row['goods_id']]['promote_price'] = ($promote_price > 0) ? price_format($promote_price) : '';
$goods_list[$row['goods_id']]['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);
}
return $goods_list;
}
2.然后打开它的模板文件user_clips.dwt
找到这一部分,收藏商品列表页面
样式根据自己的需求改动。
商品图片:<img src="{$goods.goods_thumb}" />
收藏时间:{$goods.formated_add_time}
新闻资讯 更多
热门文章
- 178Moban源码谈谈免费源码与收费源码的区别
- 2帝国CMS忘记后台登陆用户名、密码、认证码的解决方法
- 3帝国CMS(EmpireCMS) v7.5后台任意代码执行漏洞及具体修复方法
- 4帝国CMS和WordPress 哪个好?哪个适合建站?
- 5如何解决Discuz的密码错误次数过多请15分钟后登陆的问题
- 6帝国cms灵动标签取得内容和栏目链接地址
- 7emlog pro 注册码“开心”教程(如果有一天,emlog官方版 或者 emlog免费版 跑路了,那用户怎么办?)
- 8织梦CMS在nginx下设置伪静态方法(附nginx伪静态规则)
- 9帝国cms后台登录出现”您还未登录”怎么解决?
- 10帝国cms7.5忘记登录密码 和忘记登录认证码以及多次登录 失败被锁定解决办法