您现在的位置是:首页 > cms教程 > ecshop商城教程ecshop商城教程
ecshop商品页增加编辑器fckeditor的实现方法
章学共2025-01-06ecshop商城教程已有13人查阅
导读最近在做ecshop的项目,需要在商品单页中增加一项FCKEditor的文本编辑器,但在ecshop的论坛和百度里搜出的方法,试了好几个都没有用,终于找到一个可以正确使用的,和大家分享。
ecsh
最近在做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 找到下面这些代码
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如何增加一个产品描述编辑(框)器
在做商产品详情的时候,经常会有选项卡类似的几个产品说明,如:商品详情,商品规格,参数列表,售后服务等。
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 找到下面这些代码
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。当然,这点有些前端经验的人都应该知道。
本文标签:
很赞哦! (2)
暂无内容 |
暂无内容 |
相关教程
相关源码
-
pbootcms网站网络公司个人作品展示类网站源码(自适应)为网站建设公司、网络服务企业打造的响应式门户解决方案,基于PbootCMS内核深度开发。采用前沿自适应架构,无缝适配手机端交互与PC端展示需求。查看源码
-
工商注册财务代理记账类自适应pbootcms网站工商注册、财务代理记账企业打造的数字化门户模板,基于PbootCMS内核深度开发。采用前沿响应式架构,无缝适配手机端触控交互与PC端展示需求查看源码
-
响应式HTML5家居建材办公家具桌椅pbootcms模板为家居建材、办公家具企业打造的响应式网站模板,同时支持多行业快速适配通过替换文字图片即可转型为其他行业官网,大幅降低开发成本。查看源码
-
(PC+WAP)铝合金门窗定制pbootcms网站模板源码为铝合金门窗、定制门窗企业打造的高性能网站模板,基于PbootCMS开源内核开发,采用HTML5自适应架构,PC与手机端数据实时同步,覆盖全终端用户交互场景。查看源码
-
pbootcms模板(PC+WAP)火锅加盟餐饮美食类带留言源码基于PbootCMS内核深度开发,为火锅、餐饮品牌打造的营销型解决方案。采用红色主题传递行业活力,实现PC与WAP端适配。查看源码
-
(PC+WAP)绿色产品环保设备垃圾桶厂家公司网站pbootcms模板为垃圾桶生产商、环保设备企业打造的高端响应式门户模板,基于PbootCMS开源内核深度开发。采用HTML5自适应架构,无缝实现PC与手机端数据实时同步与交互优化查看源码
暂无内容 |
暂无内容 |
图文教程
ecshop的insert用法介绍
控制语句是在 /includes/lib_insert.php 文件。这个文件是ecshop动态内容函数库。里面定义各个函数的格式都是 function insert_***() ,每个函数都是一个功能控制模块删除ecshop顶部标题栏"Powered by Ecshop"的方法
ECSHOP2.7.2 本来是个不错的网店程序,但由于版权多出加密,有些需要去除版权的朋友会碰到一些困难,本人特整理分享新版ecshop去处版权方法给大家分享:ecshop分页类assign_pager分析和扩展
ecshop分页类assign_pager分析和扩展,我们前面的文章中介绍过ecshop ajax分页,他的基础都是简单单一的分页。如果我们要在ecshop分页里面传入自己的参数ecshop实现不同文章分类下的文章详情页使用不同的详情页模板
ECSHOP实现不同文章分类下的文章详情页使用不同的详情页模板使用ECSHOP系统做网站时,文章系统功能比较单一
分享笔记 (共有 0 篇笔记) |