最近在做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的更多相关文章

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

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

  2. ECSHOP 商品页详情页 添加同类随机商品

    1,根目录下找到goods.php文件 找到代码  $smarty->assign('properties',          $properties['pro']);             ...

  3. ecshop编辑器FCKeditor修改成KindEditor编辑批量上传图片

    ecshop一直使用的编辑器是fck,这个不用多说,相信很多朋友用的很悲剧吧,特别是图片不能批量上传图片.     今天小编就分享一下怎么换掉fck,放上实用的kindeditor,最新ecshop版 ...

  4. Ecshop商品详情页显示当前会员等级价格

    会员登录状态下,在ECSHOP商品详情页的本店售价中显示当前登录会员对应的等级价格,在未登录状态下,则还默认显示原来的本店售价. 解决方法: 这个需要修改ECSHOP程序代码来实现. 打开文件 /in ...

  5. ECSHOP编辑器Fckeditor上传图片中文名称乱码的解决方法

    ECSHOP编辑器Fckeditor上传图片中文名称乱码的解决方法 ECSHOP教程/ ecshop教程网(www.ecshop119.com) 2015-02-11   中文名乱码是因为:FCKed ...

  6. ecshop编辑器fckeditor换百度ueditor编辑器教程

    1.下载uediter编辑器,解压上传目录uediter到根目录/includes/下   2.修改admin/includes/lib_main.php         /**   * 生成编辑器  ...

  7. 在ecshop商品详情页显示供货商

    好久没写文章了,隐约记得前几天有人问到这个问题:[如何在ecshop商品详情页面显示该商品的供货商?] 今天有时间整理下,分享给大家. 注:以下修改适用于ecshop2.7.2,其他版本未做测试. 1 ...

  8. 带着项目学PHP第九讲 - 如何给ecshop的wap版本首页和商品页添加商品图片

    ecshop的wap版本自身不带图片, 所以看起来光秃秃的,非常不讨人喜欢, 网络上关于wap的模板就不像pc版那么多,容易找到, 而且能找到的都是要花钱买的, 虽然这个小小的改动不能替代找个合适的模 ...

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

    在ecshop二次开发工作中,经常碰到一些ECSHOP高级使用者问我,如何给商品增加一个新字段,来录入一些新的内容. 下面我们结合ecshop后台“商品编辑”.“商品录入”来谈谈如何给ecshop商品 ...

随机推荐

  1. Elasticsearch 默认配置 IK 及 Java AnalyzeRequestBuilder 使用

    摘要: 原创出处 www.bysocket.com 「泥瓦匠BYSocket 」欢迎转载,保留摘要,谢谢!   『 春夏秋冬失去了你,我怎么过一年四季- 民谣歌词 』   本文提纲 一.什么是 Ela ...

  2. hdu4027线段树

    https://vjudge.net/contest/66989#problem/H 此题真是坑到爆!!说好的四舍五入害我改了一个多小时,不用四舍五入!!有好几个坑点,注意要交换l,r的位置,还有输出 ...

  3. 创建并发布npm包

    1.npm官网创建npm账户 npm网站地址:https://www.npmjs.com/ npm网站注册地址:https://www.npmjs.com/signup 2.命令行工具登录npm np ...

  4. php学习之重要内置函数

    1. require_once()函数 此函数在脚本执行期间包含并执行指定的文件,与require语句类似,唯一区别是如果该文件中的代码已经被包含了,则不会再次包含. require_once()函数 ...

  5. hdu1198 Farm Irrigation 并查集

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1198 简单并查集 分别合并竖直方向和水平方向即可 代码: #include<iostream&g ...

  6. hdu4463 Outlets 最小生成树

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4463 很裸的一道题目,稍微处理一下输入即可 代码: #include<iostream> ...

  7. [笔记]ACM笔记 - 组合数

    一.高中数学公式复习 , (好吧这个没学过但是既然看到了就一并抄过来了) 二.快速求组合数取模C(n, m)%p 当n和p大小不同时方法有不同. 1. n很小,p随意,p不需要为素数 1) 原理 使用 ...

  8. 每天一道Java题[4]

    问题 怎么将字符串转换为int? 解答 此题看似简单,但经常出现在笔试等地方,由于大家习惯了用IDE,有什么还真未必能写出来.通常都是parseInt()方法进行转换,如下: Int n = Inte ...

  9. iOS 关于UITableView的黑科技

      UITableView是我们最常用的控件了,今天我就来介绍一些关于UITableView的黑科技和一些注意的地方. 1.修改左滑删除按钮的高度   左滑删除这是iOS最先发明的,之后安卓开始模仿. ...

  10. 终端的CTRL+S 解说

    在很多类Unix 的系统上,Ctrl-S 都有特殊的含义:它会"冻结"终端(它曾 经被用来暂停快速滚动).因为"保存"一般也是用这个快捷键,所以经常 会有人不假 ...