使用代码调用指定分类新品,如何在这个新品里排除热销等

2016-07-07 15:14 来源:www.chinab4c.com 作者:ecshop专家

我在网上百度了一篇 ECSHOP指定分类调用的文章。

使用它成功调用了商城新品。

我想问问我要如何在这个代码里限制

只调用新品,并且不调用屏蔽带有热销、精品、信息类型的产品?

关键的一句代码如下:
  1. 我们再在/includes/lib_goods.php下增加如下代码:这个代码我加在了最底部:

  2. function index_get_cat_id_goods_best_list($cat_id = '', $num = '')
  3. {
  4. $sql = 'Select g.goods_id, g.cat_id,c.parent_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
  5. "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
  6. "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, " .
  7. "g.is_best, g.is_new, g.is_hot, g.is_promote " .
  8. 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
  9. 'LEFT JOIN ' . $GLOBALS['ecs']->table('category') . ' AS c ON c.cat_id = g.cat_id ' .
  10. "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
  11. "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
  12. "Where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ".
  13. $sql .= " AND (c.parent_id =" . $cat_id. " OR g.cat_id = " . $cat_id ." OR g.cat_id ". db_create_in(array_unique(array_merge(array($cat_id), array_keys(cat_list($cat_id, 0, false))))) .")";
  14. $sql .= " LIMIT $num";
  15. $res = $GLOBALS['db']->getAll($sql);
  16. $goods = array();
  17. foreach ($res AS $idx => $row)
  18. {
  19. $goods[$idx]['id'] = $row['article_id'];
  20. $goods[$idx]['id'] = $row['goods_id'];
  21. $goods[$idx]['name'] = $row['goods_name'];
  22. $goods[$idx]['brief'] = $row['goods_brief'];
  23. $goods[$idx]['brand_name'] = $row['brand_name'];
  24. $goods[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);
  25. $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ?
  26. sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
  27. $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'],$row['goods_name_style']);
  28. $goods[$idx]['market_price'] = price_format($row['market_price']);
  29. $goods[$idx]['shop_price'] = price_format($row['shop_price']);
  30. $goods[$idx]['thumb'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];
  31. $goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];
  32. $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
  33. }
  34. return $goods;
  35. }
复制代码
全文教程:http://hi.baidu.com/%D0%C2%D6%B8 ... 98d9898326acfe.html

麻烦会的大侠帮忙一下了。看看如何调用新品屏蔽热销、精品的信息类型的产品!!!

回答:
那么简单的事情,加个判断条件就可以了
在where后面加个is_new=1就可以了




菜鸟不懂啊。高手能不能 写出代码,复制出来给我看看。。我不太懂怎么加啊







我直接加你所说的代码,在
  1. "Where is_new=1 g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ".
复制代码
出错了

晕死你怎么连and都不加啊where g.is_new=1 and g.is_on_sale = 1 AND g.is_alone_sale = 1




谢谢啊非常感觉,但是我添加了这个判断后,首页没有变化。晕哦!

顶起,求教

顶起,求教

顶起,求教

顶起!

首页模板你是怎么调用的。发给我看下