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商品 ...
随机推荐
- 博弈论(Game Theory) - 01 - 前传之占优战略均衡
博弈论(Game Theory) - 01 - 前传之占优战略均衡 开始 我们现在准备攀爬博弈论的几座高峰. 我们先看看在纳什均衡产生之前,博弈论的发展情况. 我们的第一座高峰是占优战略均衡. 囚徒困 ...
- 简单五子棋,没有电脑AI
刚学了C#委托,做了个五子棋练习,把前台绘制和后台逻辑分开,前台绘制方法用委托传给后台逻辑. 界面好简单... 先看类图 控制类控制整个游戏的逻辑,包括调用棋盘类的属性初始化棋盘.初始化两个棋手.轮流 ...
- PHP自定义函数
啊哈
- linux服务器远程链接排错
查看服务器是否能正常访问: xshell下本地shell操作: ping <ip> 关闭服务器iptables防火墙: 查看服务器端口是否正常开启: telnet <ip> & ...
- bootstrap 获得轮播中的索引或当前活动的焦点对象
今天用bootstrap做一个轮播,当轮播滚到每张图的时候,在页面下面就显示相对应的内容,那么问题来了:为了轮播图的可扩展性,我们肯定需要知道当前活动(显示图片)的索引号,查了bootstrap文档, ...
- Centos6.5静默安装Oracle11g
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/configsetenforce 0yum -y insta ...
- 超实用Java快捷键
超实用Java快捷键 Ctrl+1或F2快速修复 Ctrl+D快捷删除行 Shift+Enter 快速切换到下一行,在本行的任何位置都可 Ctrl+F11快速运行代码 Alt+上下键 快速移动行(可多 ...
- 每天一道Java题[4]
问题 怎么将字符串转换为int? 解答 此题看似简单,但经常出现在笔试等地方,由于大家习惯了用IDE,有什么还真未必能写出来.通常都是parseInt()方法进行转换,如下: Int n = Inte ...
- 【JavaScript OPP基础】---新手必备
今天和大家分享一下近期整理的有关JavaScriptOPP的基础知识~~~我们一起来学习一下-- JavaScriptOPP基础 一.面向对象编程OOP1.语言的分类:面向机器:汇编语言面向过程:C语 ...
- vue的双向绑定原理及实现
前言 使用vue也好有一段时间了,虽然对其双向绑定原理也有了解个大概,但也没好好探究下其原理实现,所以这次特意花了几晚时间查阅资料和阅读相关源码,自己也实现一个简单版vue的双向绑定版本,先上个成果图 ...