配送区域选择(地方站)功能

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

根据用户选择的城市帅选有货的商品


样式不是很美观,这个可以找前端程序设计下,呵呵
在search.php 中大概236行加下面的代码
  1. /* 增加根据用户选择的热门城市筛选是否有货 liangfang add */
  2. $region_id= !empty($_REQUEST['region_id']) ? intval($_REQUEST['region_id']): 0;
  3. if($region_id>0)
  4. {
  5. $agency_goods_sql="SELECT ag.goods_id ".
  6. "FROM ".$ecs->table('agency_goods')." AS ag ".
  7. "WHERE ag.`agency_id` = ( ".
  8. "SELECT r.`agency_id` ".
  9. "FROM ".$ecs->table('region')." AS r, ".$ecs->table('region')." AS rp ".
  10. "WHERE rp.`parent_id` = r.`region_id` ".
  11. "AND rp.`region_id` = ".$region_id .
  12. " AND rp.region_type=2 ".
  13. " LIMIT 1 )";
  14. //echo $agency_goods_sql;
  15. $agency_goods=$db->getCol($agency_goods_sql);
  16. //echo implode(",",$agency_goods);
  17. $ship="AND g.goods_id IN (".implode(",",$agency_goods).") ";
  18. //echo $ship;
  19. }
  20. else
  21. {
  22. $ship="";
  23. }
  24. /* 热门城市筛选结束 */
复制代码

在409行加上这个条件

  1. /* 查询商品 */
  2. /* 查询商品 */
  3. $sql = "SELECT g.goods_id, g.goods_name, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ".
  4. "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
  5. "g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".
  6. "FROM " .$ecs->table('goods'). " AS g ".
  7. "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
  8. "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
  9. "WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".
  10. "AND (( 1 " . $categories .$ship. $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .
  11. "ORDER BY $sort $order";
复制代码

回答:
我加了好像是不能用的

可能少一个表ecs_agency_goods

这个表怎么做呀

这个还是得需要懂代码的人来操刀啊