ecshop中让某类促销产品不在促销商品列表里显示?

2025-05-09 07:08:45
推荐回答(1个)
回答1:

  这个可以通过所前台调用促销商品的地方加一个限制条件,过滤掉这个特殊分类的商品就可以了,可以改的她方比较多:
  例如需要改get_promote_goods
  把$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
  "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
  "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, " .
  "g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " .
  'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
  'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_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 g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ' .
  " AND g.is_promote = 1 AND promote_start_date <= '$time' AND promote_end_date >= '$time' ";
  增加 and g.cat_id <> 分类id 形如:
  $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
  "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
  "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, " .
  "g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " .
  'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
  'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_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 g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 and g.cat_id <> 6 ' .
  " AND g.is_promote = 1 AND promote_start_date <= '$time' AND promote_end_date >= '$time' ";