ecshop二次开发工作中,经常碰到一些ECSHOP高级使用者问我,如何给商品增加一个新字段,来录入一些新的内容。

下面我们结合ecshop后台“商品编辑”、“商品录入”来谈谈如何给ecshop商品增加一个新字段,假设我们将这个新字段命名为 other_col
 
1、首先要修改数据表结构,给表 ecs_goods 增加新字段:other_col,
       进入ECSHOP后台 》数据库管理 》SQL查询,输入下面SQL语句,提交。注意如果你的数据表前缀不是ecs_ 请自行修改之
 
     alter table ecs_goods add column other_col varchar(64);
 
2、在ecshop后台的admin\templates\goods_info.htm中增加以下代码.
 
    <tr>
            <td class="label">自定义字段</td>
            <td><input type="text" name="other_col" value="{$goods.other_col}" size="20"/>
            </td>
          </tr>
 
3、在admin/goods.php的elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update')里面增加以下程序
 
     $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name, goods_name_style, goods_sn, " .
                    "cat_id, brand_id, shop_price, market_price, is_promote, promote_price, " .
                    "promote_start_date, promote_end_date, goods_img, goods_thumb, original_img, keywords, goods_brief, " .
                    "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, " .
                    "is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, rank_integral, suppliers_id,other_col)" .
                "VALUES ('$_POST[goods_name]', '$goods_name_style', '$goods_sn', '$catgory_id', " .
                    "'$brand_id', '$shop_price', '$market_price', '$is_promote','$promote_price', ".
                    "'$promote_start_date', '$promote_end_date', '$goods_img', '$goods_thumb', '$original_img', ".
                    "'$_POST[keywords]', '$_POST[goods_brief]', '$_POST[seller_note]', '$goods_weight', '$goods_number',".
                    " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_on_sale', '$is_alone_sale', $is_shipping, ".
                    " '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$rank_integral', '$suppliers_id','$_POST[other_col]')";
 
。。。。。。。。
。。。。。。。。
 
" other_col = '$_POST[other_col]', " .
 
      这样我们就完成了在ECSHOP后台录入和修改新字段的功能了。
 
下面再来说一下前台调用的方法:
     
调用也很简单,直接在模板文件或者  lbi文件里 这么调用即可 {$goods.other_col}

ECSHOP 商品增加新字段的方法的更多相关文章

  1. ECSHOP 商品字段增加新字段的方法

    结合ecshop后台“商品编辑”.“商品录入”来谈谈如何给ecshop商品增加一个新字段,假设我们将这个新字段命名为 new_add 1.首先要修改数据表结构,给表 ecs_goods 增加新字段:n ...

  2. js给原型增加新属性和方法

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. mongodb增加新字段报错解决方法

    今天想在项目的一个集合里增加一个新字段 db.article.update({},{$set:{status:0}},{multi:true}) multi : 可选,mongodb 默认是false ...

  4. ecshop增加新字段及相应编辑器

    一.在数据库添加字段,会手写的就后台添加,不会就进入phpmyadmin默认的就行.      这是通用的写法:(这里是增加类似商品描述的字段,其他字段自行更改) ALTER TABLE `ecs_g ...

  5. ecshop后台增加模板页的方法

    CShop的动态模板机制是一个非常灵活的系统,管理员可以在后台根据自己的要求调整模板模块的显示位置.本文详细讲解了如何修改ECSHOP内部结构使得用户可以添加自己的模板页从而方便灵活的使用系统自带的模 ...

  6. ecshop新建增加独立页面的方法

    ecshop是通过php文件来指向dwt文件的,比如index.php是程序文件,那么其模板文件就是index.dwt 那么如果新建一个php文件来单独做其他作用呢?其实很简单 第一步: 将index ...

  7. destoon实现商铺管理主页设置增加新菜单的方法

    1.打开/lang/zh-cn/home.inc.php,找到9,10行替换如下: $HMENU = $DMENU = array('公司介绍', '供应产品', '采购清单', '新闻中心', '荣 ...

  8. 【总文档】rac增加新节点的方法步骤 How to Add Node/Instance or Remove Node/Instance in 10gR2, 11gR1, 11gR2 and 12c Oracle Clusterware and RAC

    [总文档]How to Add Node/Instance or Remove Node/Instance in 10gR2, 11gR1, 11gR2 and 12c Oracle Clusterw ...

  9. Ecshop商品浏览历史样式修改方法

    想要修改ECSHOP的浏览历史样式,发现 history.lbi 中不能修改. 需要修改的文件:includes\lib_insert.php,找到函数:function insert_history ...

随机推荐

  1. The specified named connection is either not found in the configuration, not intended to be used

    今天用EF遇到一个问题, The specified named connection is either not found in the configuration, not intended t ...

  2. XmlSerialize error: There was an error generating the XML document.

    今天遇到一个很火的问题, 一个c#的class 序列化成xml后抛出异常, 信息为: XmlSerialize error: There was an error generating the XML ...

  3. Lagom学习(一)

    Lagom是JAVA系下响应式 微服务框架,其特性包括: 目前,大多数已有的微服务框架关注于简化单个微服务的构建,Lagom将其扩展到了微服务所构成的系统,分布式系统的复杂性. 同步通信使用HTTP, ...

  4. CF-816A

    A. Karen and Morning time limit per test 2 seconds memory limit per test 512 megabytes input standar ...

  5. 连接Oracle数据库的Hibernate配置…

    连接Oracle数据库的Hibernate配置文件 连接Oracle的Hibernate配置文件有两种格式,一种是xml格式的,另一种是Java属性文件格式的.下面分别给出这两种格式配置文件的代码. ...

  6. 阿里云 centos7.2 云安装mysql

    [root@iZ28gvqe4biZ ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm获取h ...

  7. 原生js实现一个侧滑删除取消组件(item slide)

    组件,本质上是解决某个问题封装的类,在此记录原生js实现侧滑删除 先上效果图 实现思路 1. 确定渲染的数据结构 2. 思考划分布局,总的有两个主要的模块:内容区域和按钮区域 2.1 内容区域保持宽度 ...

  8. cf813C(bfs)

    题目链接:http://codeforces.com/problemset/problem/813/C 题意:给出一颗树,开始时两个人 Alice 和 Bob 分别站在 1(树根)和 x 处.此后每一 ...

  9. shell常用正则表达式

    转载自: http://www.cnblogs.com/linhaifeng/p/6596660.html 和 http://www.blogjava.net/jasmine214--love/arc ...

  10. ES6入门教程---解构赋值和字符串扩展

    解构赋值: ES6允许按照一定模式,从数组和对象中提取值,对变量进行赋值,这被称为解构(Destructuring). 数组的解构赋值: 按照对应的顺序解构. var arr = [1,[2,3]]; ...