找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1025|回复: 0
打印 上一主题 下一主题

ecshop增加多个产品详细描述编辑器的方法

[复制链接]

2487

主题

2487

帖子

7391

积分

论坛元老

Rank: 8Rank: 8

积分
7391
跳转到指定楼层
楼主
发表于 2018-2-13 20:44:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

在做商产品详情的时候,经常会有选项卡类似的几个产品说明,如:商品详情,商品规格,参数列表,售后服务等。
Ecshop后台里面默认只有一个编辑框(器),那么我们还得自己添加几个,以下是ecshop如何增加产品描述编辑器个数的步骤:
1)在数据库的表esc_goods里增加二个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);
4)最后修改一下对应的后台显示文件 /admin/templates/goods_info.htm
找到下面这些代码
{$FCKeditor}

在下面复制粘贴2个并把(包括原来一个)这三个表格代码修改为
商品详情:{$FCKeditor}

售后服务:{$FCKeditor2}

买家必读:{$FCKeditor3}

修改顶部的导航:
找到{$lang.tab_detail}
后面加入
desc2
desc3
5)最后修改内容存储进数据库的文件,打开 /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_desc2 ,goods_desc3 即如下代码 $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_desc2 ,goods_desc3
在下面几行,同理找到
"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]', " .

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

用户反馈
客户端