1,数据库添加规格图片字段 alter table ecs_goods_attr add attr_image varchar(255) Null; 2,后台商品编辑添加图片属性 位于 admin/includes/lib_goods.php 找到 function build_attr_html($cat_id, $goods_id = 0) 函数 在sql语句中添加attr_image字段 $sql = . .$GLOBALS[]->table(). . .$GLOBALS[]->table(). . . . ($cat_id) .. ; 在(大概734行) $html .= '</td></tr>'; 前添加 $html .= .$val[].;
3,添加规格图片上传处理 同样位于 lib_goods.php文件 任意位置插入
function handle_attr_image($goods_id,$image_files,$key){
$upload = (
=> $image_files[][$key],
=> $image_files[][$key],
=> $image_files[][$key],
=> $image_files[][$key],
);
$img_original = $GLOBALS[]->upload_image($upload);
if ($img_original === false){
sys_msg($GLOBALS[]->error_msg(), , (), false);
}
$img_url = $img_original;
$img_url;
}
4,添加商品详情保存中的规格图片处理 位于 admin/goods.php 找到(大概982行)
$attr_price = $_POST['attr_price_list'][$key]
if (!empty($attr_value))
{
下方插入
$imgSrc = false;
if($_FILES[]){
$imgSrc = handle_attr_image($goods_id, $_FILES[],$key);
}
在往下几行
if (($goods_attr_list[$attr_id][$attr_value]))
{
$goods_attr_list[$attr_id][$attr_value][] = ;
$goods_attr_list[$attr_id][$attr_value][] = $attr_price;
if($imgSrc){
$goods_attr_list[$attr_id][$attr_value][] = $imgSrc;
}else{
$goods_attr_list[$attr_id][$attr_value][] = $_POST[][$key];
}
}
else
{
$goods_attr_list[$attr_id][$attr_value][] = ;
$goods_attr_list[$attr_id][$attr_value][] = $attr_price;
if($imgSrc){
$goods_attr_list[$attr_id][$attr_value][] = $imgSrc;
}else{
$goods_attr_list[$attr_id][$attr_value][] = $_POST[][$key];
}
}
5,上一步继续往下找 找到sql插入语句与修改语句 添加attr_image字段
if ($info[] == )
{
$sql = .$ecs->table(). .
;
}
elseif ($info[] == )
{
$sql = .$ecs->table(). ;
}
6,修改前端商品详情页查询规格属性 位于 icludes/lib_goods.php 找到sql语句(大概632行) $sql = "SELECT a.attr_id, a.attr_name, a.attr_group, a.is_linked, a.attr_type, ". 添加attr_image字段 $sql = . . . $GLOBALS[]->table() . . . $GLOBALS[]->table() . . . ; 找到(大概659行) $arr['spe'][$row['attr_id']]['values'][] = array( 'label' => $row['attr_value'], 下方添加 'image' => $row['attr_image'],
7,在模板页面调用 goods.dwt 找到
{$value.label}
上方插入
<img src="{$value.image}" width="30" height="30" style="float:left;padding:5px;"/>
(责任编辑:最模板) |

麦考林ecshop模板 M18模板
人气:796
zencart仿focalprice外贸英文
人气:4029
红色钻石ecshop模板
人气:691
dedecms汽车公司黑简模板
人气:696
大气经典红色全静态企业
人气:455
家居用品商城系统|ecshop家
人气:898