shopex转ecshop后商品相册图片重复问题

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

成功转成ecshop了,可是商品相册图片重复很严重,怎么解决啊?

回答:
方便提供您pm过来你的后台和ftp吗,我们看下

Shopex转到Ecshop后,商品相册图片数据重复的解决办法
<?php

define('IN_ECS', true);

require(dirname(__FILE__) . '/includes/init.php');
$q = $db->getAll("SELECT DISTINCT `img_url` FROM ". $ecs->table('goods_gallery'));
foreach($q as $key => $val){
$c = intval($db->getOne("SELECT count(0) FROM ". $ecs->table('goods_gallery') ." WHERE img_url='". $val['img_url'] ."'"));
if($c>1){
$c = intval($db->getOne("SELECT img_id FROM ". $ecs->table('goods_gallery') ." WHERE img_url='". $val['img_url'] ."' ORDER BY img_id LIMIT 0,1"));
if($c>0){
$sql = "DELETE FROM " . $ecs->table('goods_gallery') . " WHERE img_id <> ". $c ." and img_url='". $val['img_url'] ."'";
$db->query($sql);
}
}
}
?>

将以上内容保存成为一个php文件 FTP上传到网站根目录,用浏览器访问此文件即可
http://www.cnblogs.com/imbin/archive/2010/07/06/1772333.html