ecshop二次开发商品下架购买处理
2010-03-16 10:51 来源:www.chinab4c.com 作者:admin
ecshop在早期的版本当中,ecshop商品下架购买的问题十分严重,我们通过ecshop二次开发购物车,可以在购物车里面将购买到的商品自动移出购物车,这样方便ecshop修改后的运营和销售.下面是ecshop修改后的购物车处理下架商品程序.
1:includes/lib_order.php的get_cart_goods()函数
$row['is_on_saled'] = $GLOBALS['db']->getOne("select is_on_sale from ".$GLOBALS['ecs']->table('goods')." where goods_id = '".$row['goods_id']."'");
2:flow.dwt
{if $goods.is_on_saled eq '0'}<img src="images/s.jpg" width="20" height="20">{else}{$goods.subtotal}{/if}
3:includes/lib_order.php cart_goods
$arr[$key]['is_on_sale'] = $GLOBALS['db']->getOne("select is_on_sale from ".$GLOBALS['ecs']->table('goods')." where goods_id = '".$value['goods_id']."'");
4:flow.php done
unset($_SESSION['count1']);
5:flow.php checkout
/* 对商品信息赋值 */
$cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计
$_SESSION['count1'] = 0;
if($cart_goods){
foreach($cart_goods as $k => $v){
if($v['is_on_sale'] == 0){
$_SESSION['count1'] = 1;
}
}
}
if($_SESSION['count1']){
$smarty-> assign('count',$_SESSION['count1']);
$cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计
if($cart_goods){
foreach($cart_goods as $k => $v){
if($v['is_on_sale'] == 0){
$db -> query("delete from ".$ecs->table('cart')." where session_id = '" . SESS_ID . "' and goods_id = '".$v['goods_id']."' AND rec_type = '$flow_type'");
}
}
}
}
5:flow.dwt checkout
{if $count}
<tr>
<td colspan="7"><font color="red">下架了的商品,将自动移出了购物车!</font></td>
</tr>
{/if}
来源:中国B4C电子商务
最近更新
常用插件
- ecshop分类树中统计商品数
最近忙于开发其他项目,在不少朋友不断要求和催促的情况下,做出了该小...
- ecshop红包修改成满多少减
我们在长期使用ecshop的时候,我们可以发现。ecshop的红包是一个非常强...
- ecshop购物车功能改进[插件
ecshop购物车功能改进[插件套餐]主要是我们最近开发工作和开发项目中。...
- ecshop通用红包编码
很多时候,为了结合促销,必须扩展一下ecshop的红包功能。ecshop的红包...
- ecshop降价通知登记插件
ecshop降价通知登记插件,主要是为了方便某些客户,对商品价格要求比...