客服热线:189-2701-5231
登录注册

ecshop商品相册增加排序的修改(原商品无法排序选择主图,后上传的排在最后)

发布日期:2017-08-30

1、后台sql查询执行下行数据
ALTER TABLE `ecs_goods_gallery`ADD`img_order`SMALLINT(4)UNSIGNED NOT NULL DEFAULT '50'AFTER`img_original`;

2、修改文件 admin/templates/goods_info.htm 找到以下代码
下一行增加下代码


3、修改文件 admin/goods.php
/* 不保留商品原图的时候删除原图 */ 的上面加以下代码 /* 增加商品相册排序 */
if (!$is_insert && isset($_POST['img_order']))
{
foreach ($_POST['img_order'] AS $img_id => $img_order)
{
$sql = "UPDATE " . $ecs->table('goods_gallery') . " SET img_order = '$img_order' WHERE img_id = '$img_id' LIMIT 1";
$db->query($sql);
}
}
在找到 $sql = "SELECT * FROM " . $ecs->table('goods_gallery') . " WHERE goods_id = '$goods[goods_id]'"; 修改为:
$sql = "SELECT * FROM ".$ecs->table('goods_gallery')." WHERE goods_id = '$goods[goods_id]' ORDER BY img_order ASC";

4、修改文件 includes/lib_goods.php 找到 " WHERE goods_id = '$goods_id' LIMIT "
修改为:" WHERE goods_id = '$goods_id' ORDER BY img_order ASC LIMIT "

工作时间:早9:00—晚上21:00   24H售后:13829351575  服务QQ:292480793  392478192  售后技术QQ:156461982
地址:广东河源市龙川新城开发区5号小区 龙川商耀网络科技有限公司 备案号:粤ICP备15012952号-1
Copyright © 2005-2015 (www.shopsy.cn) All Rights Reserved
在线时间
9:00-22:00