查询某分类下的商品,为什么不正确

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



顶顶
顶顶
顶顶

回答:
dingdingdingding

顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶

如果只是路径不对,建议查查get_image_path()函数看看



如果我将
  1. $arr[$row['goods_id']]['goods_id']= $row['goods_id'];
  2. $arr[$row['goods_id']]['goods_brief']= $row['goods_brief'];
  3. $arr[$row['goods_id']]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);
  4. $arr[$row['goods_id']]['market_price']= price_format($row['market_price']);
  5. $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
  6. $arr[$row['goods_id']]['type'] = $row['goods_type'];
  7. $arr[$row['goods_id']]['promote_price'] = ($promote_price > 0) ? price_format($promote_price) : '';
  8. $arr[$row['goods_id']]['goods_thumb']= get_image_path($row['goods_id'], $row['goods_thumb'], true);
  9. $arr[$row['goods_id']]['goods_img']= get_image_path($row['goods_id'], $row['goods_img']);
  10. $arr[$row['goods_id']]['url']= build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);////错在哪了???
复制代码

改为



改为
  1. $goods[$idx]['id']= $row['goods_id'];
  2. $goods[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);
  3. $goods[$idx]['name']= $row['goods_name'];
  4. $goods[$idx]['brief']= $row['goods_brief'];
  5. $goods[$idx]['short_name']= $GLOBALS['_CFG']['goods_name_length'] > 0 ?
  6. sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
  7. $goods[$idx]['market_price'] = price_format($row['market_price']);
  8. $goods[$idx]['shop_price']= price_format($row['shop_price']);
  9. $goods[$idx]['thumb']= get_image_path($row['goods_id'], $row['goods_thumb'], true);
  10. $goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
  11. $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);

  12. $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
  13. $idx++;
复制代码
就正确了
输出
SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, IFNULL(mp.user_price, g.shop_price * '1') AS shop_price, g.promote_price, g.goods_type, g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img FROM `ecshop1`.`ecs_goods` AS g LEFT JOIN `ecshop1`.`ecs_member_price` AS mp ON mp.goods_id = g.goods_id AND mp.user_rank = '0' WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND (g.cat_idIN ('55','77','131','130','129','60','128','59','127','58','92','94','90','91','57','56')OR g.goods_id IN ('') ) limit 10Array
(
[] => Array
(
[promote_price] => 0
[id] => 492
[goods_style_name] => 124234
[name] => 124234
[brief] =>
[short_name] => 124234
[market_price] => ¥4410元
[shop_price] => ¥342元
[thumb] => images/200808/thumb_img/492_thumb_G_1219734377814.jpg
[goods_img] => images/200808/goods_img/492_G_1219734377995.jpg
[url] => goods.php?id=492
[short_style_name] => 124234
)

[1] => Array
(
[promote_price] =>
[id] => 143
[goods_style_name] => 玉兰油1
[name] => 玉兰油1
[brief] =>
[short_name] => 玉兰油1
[market_price] => ¥0元
[shop_price] => ¥20元
[thumb] => images/200808/thumb_img/143_thumb_G_1219732807166.jpg
[goods_img] => images/200808/goods_img/143_G_1219732807465.jpg
[url] => goods.php?id=143
[short_style_name] => 玉兰油1
)



这是为什么? 是语句错了吗?这是为什么呢?

顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶