ecshop商品页增加编辑器fckeditor
最近在做ecshop的项目,需要在商品单页中增加一项FCKEditor的文本编辑器,但在ecshop的论坛和百度里搜出的方法,试了好几个都没有用,终于找到一个可以正确使用的,和大家分享。
ecshop如何增加一个产品描述编辑(框)器
在做商产品详情的时候,经常会有选项卡类似的几个产品说明,如:商品详情,商品规格,参数列表,售后服务等。
Ecshop后台里面默认只有一个编辑框(器),那么我们还得自己添加几个,以下是ecshop如何增加产品描述编辑器个数的步骤:
1)、在数据库里增加二个text的字段用来存储新增的二个编辑框的内容,
如:goods_desc2,goods_desc3(可以用phpmyadmin)
2)、修改 生成编辑器的函数 找到 /admin/includes/lib_main.php 文件 将 function create_html_editor($input_name, $input_value = '') 修改为 function create_html_editor($input_name, $input_value = '',$fckid=0)
继续向下找到 $smarty->assign('FCKeditor', $FCKeditor); 将它修改为
if ($fckid) { $smarty->assign('FCKeditor'.$fckid, $FCKeditor); } else { $smarty->assign('FCKeditor', $FCKeditor); }
3)、接下来要修改后台商品处理页 /admin/goods.php 文件 找到 create_html_editor('goods_desc', $goods['goods_desc']); 在它下面另添加2行 create_html_editor('goods_desc2', $goods['goods_desc2'],2); create_html_editor('goods_desc3', $goods['goods_desc3'],3);
3)、最后修改一下对应的后台显示文件 /admin/templates/goods_info.htm 找到下面这些代码
<table width="90%" id="detail-table" style="display:none"> <tr> <td>{$FCKeditor}</td> </tr> </table> 在下面复制粘贴2个并把(包括原来一个)这三个表格代码修改为 <table width="90%" id="detail-table" style="display:none"> <tr> <td width="80" align="right">商品详情:</td> <td>{$FCKeditor}</td> </tr> </table> <table width="90%" id="detail-table" style="display:none"> <tr> <td width="80" align="right">售后服务:</td> <td>{$FCKeditor2}</td> </tr> </table> <table width="90%" id="detail-table" style="display:none"> <tr> <td width="80" align="right">买家必读:</td> <td>{$FCKeditor3}</td> </tr> </table>
4)、最后修改内容存储进数据库的文件,打开 /admin/goods.php 1> 找到如下代码: $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name,goods_model, 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_home, is_on_sale, is_alone_sale, is_shipping, goods_desc 在后面加上 ,goods_desc ,goods_desc (注:英文状态下的逗号) 即如下代码 $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name,goods_model, 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_home, is_on_sale, is_alone_sale, is_shipping, goods_desc,goods_desc ,goods_desc
在下面几行,同理找到
"VALUES ('$_POST[goods_name]','$_POST[goods_model]', '$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_home', '$is_on_sale', '$is_alone_sale', $is_shipping, ". " '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$rank_integral', '$suppliers_id')" 改为: "VALUES ('$_POST[goods_name]','$_POST[goods_model]', '$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_home', '$is_on_sale', '$is_alone_sale', $is_shipping, ". " '$_POST[goods_desc]', '$_POST[goods_desc2]', '$_POST[goods_desc3]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$rank_integral', '$suppliers_id')"
同理,又下面几行 else { $sql =$sql = "INSERT INTO. $ecs->table('goods') 这一段中,作上面相同修改如下: $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name,goods_model, 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_home, is_real, " . "is_on_sale, is_alone_sale, is_shipping, goods_desc, goods_desc2, goods_desc3, add_time, last_update, goods_type, extension_code, rank_integral)" . "VALUES ('$_POST[goods_name]','$_POST[goods_model]', '$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_home', 0, '$is_on_sale', '$is_alone_sale', $is_shipping, ". " '$_POST[goods_desc]', '$_POST[goods_desc2]', '$_POST[goods_desc3]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$code', '$rank_integral')";
2 > 再往下几十行,找到"goods_desc = '$_POST[goods_desc]', " .在其下方再添加二行 ,改成如下 "goods_desc = '$_POST[goods_desc]', " . "goods_desc2 = '$_POST[goods_desc2]', " . "goods_desc3 = '$_POST[goods_desc3]', " .
总结:有很多文章都是新建了个create_html_editor函数,但是结果是第一个编辑器也会调用新写的这个函数,所以出现了错误,在本文中,在传参时直接加了个判断,这样更加方便以及有效,而且如果还需再添加编辑器,只需调用这个函数即可。
我想补充一下,在htm文件中添加表格的时候,页面使用的是标签效果,tabbar-div中的span和下面tabbody-div里的table是对应的,两者的id格式要对应才能在添加的标签中找到新增的编辑器,我们在tab.js这个文件中可以找到命名规则,比如我要新加一个叫“专家介绍”的标签,在头部的tabbar-div里span的id为expert-tab,下面tabbody-div里table的id应为expert-table。当然,这点有些前端经验的人都应该知道。
ecshop商品页增加编辑器fckeditor的更多相关文章
- ECSHOP 商品字段增加新字段的方法
结合ecshop后台“商品编辑”.“商品录入”来谈谈如何给ecshop商品增加一个新字段,假设我们将这个新字段命名为 new_add 1.首先要修改数据表结构,给表 ecs_goods 增加新字段:n ...
- ECSHOP 商品页详情页 添加同类随机商品
1,根目录下找到goods.php文件 找到代码 $smarty->assign('properties', $properties['pro']); ...
- ecshop编辑器FCKeditor修改成KindEditor编辑批量上传图片
ecshop一直使用的编辑器是fck,这个不用多说,相信很多朋友用的很悲剧吧,特别是图片不能批量上传图片. 今天小编就分享一下怎么换掉fck,放上实用的kindeditor,最新ecshop版 ...
- Ecshop商品详情页显示当前会员等级价格
会员登录状态下,在ECSHOP商品详情页的本店售价中显示当前登录会员对应的等级价格,在未登录状态下,则还默认显示原来的本店售价. 解决方法: 这个需要修改ECSHOP程序代码来实现. 打开文件 /in ...
- ECSHOP编辑器Fckeditor上传图片中文名称乱码的解决方法
ECSHOP编辑器Fckeditor上传图片中文名称乱码的解决方法 ECSHOP教程/ ecshop教程网(www.ecshop119.com) 2015-02-11 中文名乱码是因为:FCKed ...
- ecshop编辑器fckeditor换百度ueditor编辑器教程
1.下载uediter编辑器,解压上传目录uediter到根目录/includes/下 2.修改admin/includes/lib_main.php /** * 生成编辑器 ...
- 在ecshop商品详情页显示供货商
好久没写文章了,隐约记得前几天有人问到这个问题:[如何在ecshop商品详情页面显示该商品的供货商?] 今天有时间整理下,分享给大家. 注:以下修改适用于ecshop2.7.2,其他版本未做测试. 1 ...
- 带着项目学PHP第九讲 - 如何给ecshop的wap版本首页和商品页添加商品图片
ecshop的wap版本自身不带图片, 所以看起来光秃秃的,非常不讨人喜欢, 网络上关于wap的模板就不像pc版那么多,容易找到, 而且能找到的都是要花钱买的, 虽然这个小小的改动不能替代找个合适的模 ...
- ECSHOP 商品增加新字段的方法
在ecshop二次开发工作中,经常碰到一些ECSHOP高级使用者问我,如何给商品增加一个新字段,来录入一些新的内容. 下面我们结合ecshop后台“商品编辑”.“商品录入”来谈谈如何给ecshop商品 ...
随机推荐
- [瞎玩儿系列] 使用SQL实现Logistic回归
本来想发在知乎专栏的,但是文章死活提交不了,我也是醉了,于是乎我就干脆提交到CNBLOGS了. 前言 前段时间我们介绍了Logistic的数学原理和C语言实现,而我呢?其实还是习惯使用Matlab进行 ...
- Play学习 - 体验网页模板
在经过无数个尝试后,最终用sbt把play所依赖的所有包都下载下来了,现在可以非常快速编译运行了.今天体验了下网页模板,觉得非常不错,在这里做个简单的介绍. 原文说明: A Play Scala te ...
- html部署到tomcat
首先电脑上应该装好java和Tomcat,并设置好它们的环境变量. 设置完成后,启动Tomcat ,点击\bin\tomcat6,打开浏览器输入网址:http://localhost:8080,如果出 ...
- C# Redis学习系列三:Redis配置主从
Redis配置主从 主IP :端口 192.168.0.103 6666 从IP:端口 192.168.0.108 3333 配置从库 (1)安装服务: redis-server ...
- R语言分析(二)——薛毅R语言第二章后面习题解析
包括2.2—2.6中间的习题,2.2的习题中第三问和第四问,应该有其他的解答方法,但我看他的题目,似乎是在A和B的基础上进行,所以就选择了使用for循环的方法 做着习题,又不断查着书,这样,书籍也熟悉 ...
- .Net程序员学用Oracle系列(25):触发器详解
1.触发器理论 1.1.触发器的应用场景 1.2.触发器的类型 1.3.DML 触发器的触发顺序 2.触发器实战 2.1.创建触发器 2.1.1.创建 DML 触发器 2.1.2.创建 DDL 触发器 ...
- Mybatis中的like查询
今天要做一个模糊查询 用的Mybatis 开始写的是: select id,bookName,author,publisher,donor,status,createDate,lastUpdate f ...
- /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTIFFIsTiled@LIBTIFF_4.0'
今天编译caffe ,本来编译过无数次caffe了,基本坑都能解决的.但这次惹恼我了.一直搞不定. 错误信息是这样的: /usr/lib/x86_64-linux-gnu/libopencv_high ...
- 高性能mysql(一)
1.连接和管理安全性 当客服端连接mysql服务器时,这个客户端就会在服务器端拥有一个线程,这个连接的查询就会在这单独的线程中执行.服务器会负责缓存线程,因此不需要为每一个连接都创建一个线程或者销毁一 ...
- 使用Linux的alternatives命令替换选择软件的版本
上周在安装搜索引擎Elasticsearch时,要求安装比较新的java 版本,我选择了java 1.8.0,安装java 成功后使用java -version 发现使用的版本仍旧是1.6.0, 查询 ...