〓〓〓让人烦恼的ECshop商品相册问题,请各位好心人帮忙〓〓〓

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

最近发现商品相册发生了比较严重的问题.

1.后台根据商品图顺序上传,结果后台商品相册内显示的商品图顺序并不是根据上传顺序显示。

2.显示顺序是混乱的.

3.如何调整商品相册内商品图顺序呢?(各位好心人不要跟我说重传,小弟我已经针对一件商品重复上传了几百遍了,顺序还是错误)

请各位好心人指点一下,如何调整顺序,是不是给各个商品图编号就可以了?系统会按照商品名称的编号自动按顺序排列?

注:本人使用的是ECshop最新版本的商城!

回答:
如果您对代码比价了解的话可以修改"includes\lib_goods.php"function get_goods_gallery 这个函数,可以按商品相册的发布时间或是id号来取数据。

本人是新手,请问管理员能帮修改下吗??

$sql = 'SELECT img_id, img_url, thumb_url, img_desc' .
' FROM ' . $GLOBALS['ecs']->table('goods_gallery') .
" WHERE goods_id = '$goods_id' LIMIT " . $GLOBALS['_CFG']['goods_gallery_number']." ORDER BY image_id DESC ;
根据id。

$sql = 'SELECT img_id, img_url, thumb_url, img_desc' .
' FROM ' . $GLOBALS['ecs']->table('goods_gallery') .
" WHERE goods_id = '$goods_id' LIMIT " . $GLOBALS['_CFG']['goods_gallery_number'];
$row = $GLOBALS['db']->getAll($sql);



请问是不是把上面的这一段代码修改成下面的代码


$sql = 'SELECT img_id, img_url, thumb_url, img_desc' .
' FROM ' . $GLOBALS['ecs']->table('goods_gallery') .
" WHERE goods_id = '$goods_id' LIMIT " . $GLOBALS['_CFG']['goods_gallery_number']." ORDER BY image_id DESC ;
根据id。

请问是这样吗??管理员

是的。要善于自己动手尝试操作。可能有时您能更快得到答案。

ORDER BY image_id DESC ;???不是img_id吗

修改后出错呀

$sql = 'SELECT img_id, img_url, thumb_url, img_desc' .
' FROM ' . $GLOBALS['ecs']->table('goods_gallery') .
" WHERE goods_id = '$goods_id' LIMIT " . $GLOBALS['_CFG']['goods_gallery_number']." ORDER BY image_id DESC ;
注意红色部分呢,对应修改

我在学习了!!

学习了!!

按照上面的修改 会报错的

7# 桔子
请大侠能否再指明些呢?谢谢!!!

$sql = 'SELECT img_id, img_url, thumb_url, img_desc' .
' FROM ' . $GLOBALS['ecs']->table('goods_gallery') .
" WHERE goods_id = '$goods_id' LIMIT " . $GLOBALS['_CFG']['goods_gallery_number']." ORDER BY img_id DESC ;

order by img_id DESC 是安降序排列,但它不能放在limit的后面.所以会报错,应该改成:

$sql = 'SELECT img_id, img_url, thumb_url, img_desc' .
' FROM ' . $GLOBALS['ecs']->table('goods_gallery') .
" WHERE goods_id = '$goods_id'ORDER BY img_id DESC LIMIT " . $GLOBALS['_CFG']['goods_gallery_number'];

(includes\lib_goods.phpfunction get_goods_gallery函数)

这样就不会报错了.如果不想安降序排列把DESC去掉就行了.

有通过上述方法修改成功的吗?我怎么试都不行啊!!