开发交流

针对下架的商品,加入购物车后仍能购买的问题(原ecshop也存在此问题)修复

LYECS,LYECS+商城系统,多用户商城系统,开源商城系统 发布日期:2014-07-09   作者:老杨

修复效果如上:

另外结算时也会验证是否下架!


修改如下:

1、themes/shop/library/flow_cart.lbi

 找到:
<td class="ta-c"><input type="checkbox" name="goodsId" value="{$goods.rec_id}"></td>
修改为:
<td class="ta-c"><input type="checkbox"{if !$goods.is_on_sale}disabled="disabled" autocomplete="off" {else}checked="checked"{/if}  name="goodsId" value="{$goods.rec_id}"></td>

2、includes/lib_order.php

找到:
function cart_goods($type = CART_GENERAL_GOODS)
{
    $sql = "SELECT c.rec_id, c.user_id, c.goods_id, c.goods_name,g.goods_thumb,g.goods_name, c.goods_sn, c.goods_number, " .

修改为:


function cart_goods($type = CART_GENERAL_GOODS)
{
    $sql = "SELECT c.rec_id, c.user_id, c.goods_id,g.is_on_sale, c.goods_name,g.goods_thumb,g.goods_name, c.goods_sn, c.goods_number, " .


找到:


            $goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$row['goods_id']}'");
            $row['goods_thumb'] = get_image_path($row['goods_id'], $goods_thumb, true);

修改为:


            $goods_info=$GLOBALS['db']->getRow("SELECT `goods_thumb`,`is_on_sale` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$row['goods_id']}'");
            $goods_thumb =$goods_info['goods_thumb'];
            $row['is_on_sale']=$goods_info['is_on_sale'];
            $row['goods_thumb'] = get_image_path($row['goods_id'], $goods_thumb, true);


3、最后找到:flow.php


        /* 统计实体商品的个数 */
        if ($val['is_real'])
        {
            $is_real_good=1;
        }

在其上添加:


        if (!$val['is_on_sale'])
        {
            show_message('商品:'.$val['goods_name'].'已下架!', '返回购物车', 'flow.php', 'warning');
        } 

热门文章

分类标签