ecshop在收藏夹中显示产品图片
2009-06-22 09:26 来源:www.chinab4c.com 作者:ecshop专家
在B4C电子商务中,收藏夹的功能非常重要,收藏夹可以方便购买过程,你在购买过程中,如果感觉产品目前有收藏价值,你可以使用收藏夹功能。ecshop的收藏夹功能却不是非常完美,你可以在产品详细信息通过"收藏"按扭录入收藏.
收藏夹中如何显示产品的图片?
首先.打开includes/lib_clips.php中找到
function get_collection_goods($user_id, $num = 10, $start = 0)
{
$sql = 'SELECT g.goods_id,g.goods_thumb,g.goods_img, g.goods_name, 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.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']]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);;
$goods_list[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$goods_list[$row['goods_id']]['rec_id'] = $row['rec_id'];
$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']]['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;
}
在sql语句中加入g.goods_thumb,g.goods_img,查询产品图片。
然后在flow.dwt中.修改<!-- {foreach from=$collection_goods item=goods} -->
<tr>
<td><a href="{$goods.url}"><img src="{$goods.thumb}" title="{$goods.name}" width="40" height="40"></a></td>
<td class="textleft"><a href="goods.php?id={$goods.goods_id}" title="{$goods.name}">{$goods.goods_name}</a></td>
<td>{if $goods.promote_price}[促销价]{$goods.promote_price}{else}[本店售价]{$goods.shop_price}{/if}</td>
<td><span class="btnBlue"><a href="javascript:collect_to_flow({$goods.goods_id})">{$lang.btn_add_to_cart}</a></span></td>
</tr>
<!-- {/foreach} -->
假如src="{$goods.thumb}"来显示产品图片。大小可以自由控制.
以上就实现了ecshop收藏夹显示产品图片的问题.
相关文章:
来源:中国B4C电子商务
最近更新
常用插件
- ecshop购物车功能改进[插件
ecshop购物车功能改进[插件套餐]主要是我们最近开发工作和开发项目中。...
- ecshop分类树中统计商品数
最近忙于开发其他项目,在不少朋友不断要求和催促的情况下,做出了该小...
- ecshop降价通知登记插件
ecshop降价通知登记插件,主要是为了方便某些客户,对商品价格要求比...
- ecshop红包修改成满多少减
我们在长期使用ecshop的时候,我们可以发现。ecshop的红包是一个非常强...
- ecshop通用红包编码
很多时候,为了结合促销,必须扩展一下ecshop的红包功能。ecshop的红包...