ecshop属性规格添加小图标
2016-09-07 22:02 来源:www.chinab4c.com 作者:ecshop专家
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;"/>
(责任编辑:chinab4c) |
最近更新
常用插件
- ecshop二次开发商品购买增
图片1香...
- ecshop最小购买数量控制插
ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便...
- ecshop2.7.2生成虚拟订单2.
以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生...
- ecshop2.7.1邮件发送插件
ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统...
- ecshop没登陆情况下订单查
ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下...



