ECSHOP 商品字段增加新字段的方法
结合ecshop后台“商品编辑”、“商品录入”来谈谈如何给ecshop商品增加一个新字段,假设我们将这个新字段命名为 new_add
1、首先要修改数据表结构,给表 ecs_goods 增加新字段:new_add,
进入ECSHOP后台 》数据库管理 》SQL查询,输入下面SQL语句,提交。注意如果你的数据表前缀不是ecs_ 请自行修改之
alter table ecs_goods add column new_add varchar(64);
2、在ecshop后台的admin\templates\goods_info.htm中增加以下代码.
<tr>
<td class="label">自定义字段</td>
<td><input type="text" name="new_add" value="{$goods.new_add}" 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,new_add)" .
"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[new_add]')";
//下面这个为更新,在:
$sql = "UPDATE " . $ecs->table('goods') . " SET " .
"goods_name = '$_POST[goods_name]', " .
"goods_name_style = '$goods_name_style', " .
下面加
" new_add = '$_POST[new_add]', " .
这样我们就完成了在ECSHOP后台录入和修改新字段的功能了。
下面再来说一下前台调用的方法:
调用也很简单,直接在模板文件或者 lbi文件里 这么调用即可 {$goods.new_add}
ECSHOP 商品字段增加新字段的方法的更多相关文章
- ECSHOP 商品增加新字段的方法
在ecshop二次开发工作中,经常碰到一些ECSHOP高级使用者问我,如何给商品增加一个新字段,来录入一些新的内容. 下面我们结合ecshop后台“商品编辑”.“商品录入”来谈谈如何给ecshop商品 ...
- js给原型增加新属性和方法
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- mongodb增加新字段报错解决方法
今天想在项目的一个集合里增加一个新字段 db.article.update({},{$set:{status:0}},{multi:true}) multi : 可选,mongodb 默认是false ...
- ecshop增加新字段及相应编辑器
一.在数据库添加字段,会手写的就后台添加,不会就进入phpmyadmin默认的就行. 这是通用的写法:(这里是增加类似商品描述的字段,其他字段自行更改) ALTER TABLE `ecs_g ...
- ecshop商品页增加编辑器fckeditor
最近在做ecshop的项目,需要在商品单页中增加一项FCKEditor的文本编辑器,但在ecshop的论坛和百度里搜出的方法,试了好几个都没有用,终于找到一个可以正确使用的,和大家分享. ecshop ...
- ECSHOP商品属性调用到任意页面方法
看到标题有的人觉得这个很复杂,其实这个没那么复杂,直接用下面的方法,就可以在ECSHOP的任意页面调用商品属性. 一)打开includes\lib_insert.php文件,在最后面增加一个函数: f ...
- ecshop商品自定义销量(虚拟销量)实现方法
1.在sq执行语句 ALTER TABLE `ecs_goods` ADD `sales_volume_base` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' ...
- destoon实现商铺管理主页设置增加新菜单的方法
1.打开/lang/zh-cn/home.inc.php,找到9,10行替换如下: $HMENU = $DMENU = array('公司介绍', '供应产品', '采购清单', '新闻中心', '荣 ...
- 【总文档】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 ...
随机推荐
- linux基本知识
1.默认不写端口号就是80端口 127.0.0.1.localhost都代表本机 2.linux下的用户管理: id:可以查看当前用户whoami:查看当前的用户who:看当前已经登录的用户w:也 ...
- python list dict 去重的两种方式
def dedupe(items, key=None): seen = set() for item in items: val = item if key is None else key(item ...
- Would Your Work Habits Change if You Were Paid by the Job?
原文地址:http://success-sys.com/2016/09/26/would-your-work-habits-change-if-you-were-paid-by-the-job/ A ...
- [译]Thinking in React
编者按 使用React的思想来构建应用对我在实际项目中以及帮助他人解决实际问题时起到了很大作用,所以我翻译此文来向那些正在或即将陷入React或React-Native深坑的同胞们表示慰问.网上已经有 ...
- float4数据类型
GPU是以四维向量为基本单位来计算的.4个浮点数所组成的float4向量是GPU内置的最基本类型.使用GPU对两个float4向量进行计算,与CPU对两个整数或两个浮点数进行计算一样简单,都是只需要一 ...
- [LeetCode] Kth Smallest Element in a Sorted Matrix 有序矩阵中第K小的元素
Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth ...
- [LeetCode] Group Shifted Strings 群组偏移字符串
Given a string, we can "shift" each of its letter to its successive letter, for example: & ...
- [LeetCode] Jump Game 跳跃游戏
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- .NET跨平台之旅:增加文件日志功能遇到的挫折
在将我们的ASP.NET 5示例站点(about.cnblogs.com)升级至ASP.NET 5 RC1的时候,我们增加了控制台日志功能. 在ASP.NET 5添加日志功能很简单,只需在projec ...
- MongoDB的备份和恢复
1.导出数据库/备份: @echo off F: cd F:\software1\mongdb\mongodb-win32-x86_64-\bin start mongodump.exe -h -d ...