Home > php教程 > php手册 > body text

ecshop 批量上传(加入自定义属性)

WBOY
Release: 2016-06-13 12:01:30
Original
1071 people have browsed it

下面是实现批量上传(加入自定义属性)思路以及实现的过程。

1.加入属性
之所以只能上传特定的属性,应该是批量上传的固定属性都来自于一张表。esc_goods表.
所以我们想假如自己的属性,必须要在esc_goods中加入自己的属性.比如这次加入的字段加
规格: goods_guige
代码:sql语句:alter table ecs_goods add goods_guige varchar(255) not null after goods_desc;

2.页面修改
位置: admin/templates/goods_info.htm按照其形式加入自定义字段
我这里是174行插入的:



3.添加读取和更新商品表的字段 (和批量上传无关但是便于查看)
位置:admin/goods.php
在更新位置上加入:
$sql="update ecs_goods set goods_guige='".$_POST['goods_guige']."' where goods_id= ".$_REQUEST['goods_id'];
$db->query($sql);
到此商品的属性就可以被更新掉了

4.批量上传添加字段
language/admin/goods_batch.php
添加字段:
//自定义批量上传字段
$_LANG['upload_goods']['goods_guige']='规格';

OK!至此,只要将商品的cvs导出,即可实现批量上传自定义的属性.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!