在复制商品的时候有一段处理图片路径的代码

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

if (isset($GLOBALS['shop_id']) && ($GLOBALS['shop_id'] > 10) && !empty($goods['original_img']))
{


$goods['goods_img'] = get_image_path($_REQUEST['goods_id'], $goods['goods_img']);
$goods['goods_thumb'] = get_image_path($_REQUEST['goods_id'], $goods['goods_thumb'], true);

}

/* 图片列表 */
$sql = "SELECT * FROM " . $ecs->table('goods_gallery') . " WHERE goods_id = '$goods[goods_id]'";


$img_list = $db->getAll($sql);


/* 格式化相册图片路径 */
if (isset($GLOBALS['shop_id']) && ($GLOBALS['shop_id'] > 0))
{
foreach ($img_list as $key => $gallery_img)
{
$gallery_img[$key]['img_url'] = get_image_path($gallery_img['goods_id'], $gallery_img['img_original'], false, 'gallery');
$gallery_img[$key]['thumb_url'] = get_image_path($gallery_img['goods_id'], $gallery_img['img_original'], true, 'gallery');
}
}
else
{
foreach ($img_list as $key => $gallery_img)
{
$gallery_img[$key]['thumb_url'] = '../' . (empty($gallery_img['thumb_url']) ? $gallery_img['img_url'] : $gallery_img['thumb_url']);
}
}
}


而复制的时候已经把goods[goods_id]赋值为0,貌似这段代码不起什么作用,因为$img_list永远都是空的,不知道为什么要加这段代码