没有合适的资源?快使用搜索试试~ 我知道了~
首页ecshop 颜色属性添加图片 用图片替换颜色 只用图片替换颜色其他单选属性不变
资源详情
资源评论
资源推荐

ecshop 颜色属性添加图片 用图片替换颜色
总共改三个文件 admin/goods.php ,admin/inculdes/lib_goods.php, 模板目录下的 goods.dwt
1.打开 admin/goods.php 找到 $attr_price = $_POST['attr_price_list'][$key]; 在下行添加
//更多购物信息天猫最便宜(www.tmzsh.com)
$attr_images = array('name' => $_FILES['attr_images_list']['name'][$key] , 'type' =>
$_FILES['attr_images_list']['type'][$key] , 'tmp_name' => $_FILES['attr_images_list']
['tmp_name'][$key] , 'error' => $_FILES['attr_images_list']['error'][$key], 'size' =>
$_FILES['attr_images_list']['size'][$key] );
//更多购物信息天猫最便宜(www.tmzsh.com)
2.找到 $goods_attr_list[$attr_id][$attr_value]['attr_price'] = $attr_price; 有两处 分别另起一行添加
//更多购物信息天猫最便宜(www.tmzsh.com)
$goods_attr_list[$attr_id][$attr_value]['attr_images'] = $attr_images;
//更多购物信息天猫最便宜(www.tmzsh.com)
3. 找 到 $sql = "DELETE FROM " .$ecs->table('goods_attr'). " WHERE goods_attr_id =
'$info[goods_attr_id]' LIMIT 1"; 在下面 $db->query($sql);
下添加
//更多购物信息天猫最便宜(www.tmzsh.com)
$goods_attr_id = $info['sign'] == 'insert' ? $db->insert_id() : $info['goods_attr_id'];
if( $info['sign'] == 'insert' || $info['sign'] == 'update' )
{
if( $info['attr_images']['tmp_name'] != '' )
{
$attr_images_dir = 'color/'.$goods_id;
$attr_images_scoure_name = "0-0-$goods_attr_id.jpg";
$color_scoure_images = $image->upload_image($info['attr_images'] , $attr_images_dir ,
$attr_images_scoure_name ); // 原始图片
}
}
else
{
$attr_color_images_dir = ROOT_PATH.DATA_DIR.'/color/'.$goods_id."/0-0-".
$info[goods_attr_id].".jpg";
Ble_exists($attr_color_images_dir) && unlink( $attr_color_images_dir );
}












安全验证
文档复制为VIP权益,开通VIP直接复制

评论13