webstermobile
Fork me on GitHub
个人博客

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

  1 在做商产品详情的时候,经常会有选项卡类似的几个产品说明,如:商品详情,商品规格,参数列表,售后服务等。
  2 Ecshop后台里面默认只有一个编辑框(器),那么我们还得自己添加几个,以下是ecshop如何增加产品描述编辑器个数的步骤:
  3 
  4 1)在数据库的表esc_goods里增加二个text的字段用来存储新增的二个编辑框的内容,
  5 
  6 如:goods_desc2,goods_desc3(可以用phpmyadmin)
  7 
  8 2)修改生成编辑器的函数 找到 /admin/includes/lib_main.php 文件
  9 
 10  11 function create_html_editor($input_name, $input_value = '')
 12 修改为
 13 function create_html_editor($input_name, $input_value = '',$fckid=0)
 14 继续向下找到
 15 $smarty->assign('FCKeditor', $FCKeditor);
 16 将它修改为
 17 if ($fckid)
 18 {
 19 $smarty->assign('FCKeditor'.$fckid, $FCKeditor);
 20 }
 21 else
 22 {
 23 $smarty->assign('FCKeditor', $FCKeditor);
 24 }
 25 3)接下来要修改后台商品处理页 /admin/goods.php 文件
 26 
 27 找到 create_html_editor('goods_desc', $goods['goods_desc']);
 28 在它下面另添加2行
 29 create_html_editor('goods_desc2', $goods['goods_desc2'],2);
 30 create_html_editor('goods_desc3', $goods['goods_desc3'],3);
 31 
 32 4)最后修改一下对应的后台显示文件 /admin/templates/goods_info.htm
 33 
 34 找到下面这些代码
 35 <table width="90%" id="detail-table" style="display:none">
 36 <tr>
 37 <td>{$FCKeditor}</td>
 38 </tr>
 39 </table>
 40 在下面复制粘贴2个并把(包括原来一个)这三个表格代码修改为
 41 <table width="90%" id="detail-table" style="display:none">
 42 <tr>
 43 <td width="80" align="right">商品详情:</td>
 44 <td>{$FCKeditor}</td>
 45 </tr>
 46 </table>
 47 <table width="90%" id="desc2-table" style="display:none">
 48 <tr>
 49 <td width="80" align="right">售后服务:</td>
 50 <td>{$FCKeditor2}</td>
 51 </tr>
 52 </table>
 53 <table width="90%" id="desc3-table" style="display:none">
 54 <tr>
 55 <td width="80" align="right">买家必读:</td>
 56 <td>{$FCKeditor3}</td>
 57 </tr>
 58 
 59 </table>
 60 修改顶部的导航:
 61 找到<span class="tab-back" id="detail-tab">{$lang.tab_detail}</span>
 62 后面加入
 63 <span class="tab-back" id="desc2-tab">desc2</span>
 64 <span class="tab-back" id="desc3-tab">desc3</span>
 65 
 66 5)最后修改内容存储进数据库的文件,打开 /admin/goods.php
 67 
 68 1> 找到如下代码:
 69 $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name,goods_model, goods_name_style, goods_sn, " .
 70 "cat_id, brand_id, shop_price, market_price, is_promote, promote_price, " .
 71 "promote_start_date, promote_end_date, goods_img, goods_thumb, original_img, keywords, goods_brief, " .
 72 "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, " .
 73 "is_home, is_on_sale, is_alone_sale, is_shipping, goods_desc
 74 在后面加上 ,goods_desc2 ,goods_desc3 即如下代码 $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name,goods_model, goods_name_style, goods_sn, " .
 75 "cat_id, brand_id, shop_price, market_price, is_promote, promote_price, " .
 76 "promote_start_date, promote_end_date, goods_img, goods_thumb, original_img, keywords, goods_brief, " .
 77 "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, " .
 78 "is_home, is_on_sale, is_alone_sale, is_shipping, goods_desc,goods_desc2 ,goods_desc3
 79 在下面几行,同理找到
 80 "VALUES ('$_POST[goods_name]','$_POST[goods_model]', '$goods_name_style', '$goods_sn', '$catgory_id', " .
 81 "'$brand_id', '$shop_price', '$market_price', '$is_promote','$promote_price', ".
 82 "'$promote_start_date', '$promote_end_date', '$goods_img', '$goods_thumb', '$original_img', ".
 83 "'$_POST[keywords]', '$_POST[goods_brief]', '$_POST[seller_note]', '$goods_weight', '$goods_number',".
 84 " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_home', '$is_on_sale', '$is_alone_sale', $is_shipping, ".
 85 " '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$rank_integral', '$suppliers_id')"
 86 改为: "VALUES ('$_POST[goods_name]','$_POST[goods_model]', '$goods_name_style', '$goods_sn', '$catgory_id', " .
 87 "'$brand_id', '$shop_price', '$market_price', '$is_promote','$promote_price', ".
 88 "'$promote_start_date', '$promote_end_date', '$goods_img', '$goods_thumb', '$original_img', ".
 89 "'$_POST[keywords]', '$_POST[goods_brief]', '$_POST[seller_note]', '$goods_weight', '$goods_number',".
 90 " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_home', '$is_on_sale', '$is_alone_sale', $is_shipping, ".
 91 " '$_POST[goods_desc]', '$_POST[goods_desc2]', '$_POST[goods_desc3]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$rank_integral', '$suppliers_id')"
 92 同理,又下面几行
 93 else
 94 {
 95 $sql =$sql = "INSERT INTO. $ecs->table('goods')
 96 这一段中,作上面相同修改如下: $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name,goods_model, goods_name_style, goods_sn, " .
 97 "cat_id, brand_id, shop_price, market_price, is_promote, promote_price, " .
 98 "promote_start_date, promote_end_date, goods_img, goods_thumb, original_img, keywords, goods_brief, " .
 99 "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, is_home, is_real, " .
100 "is_on_sale, is_alone_sale, is_shipping, goods_desc, goods_desc2, goods_desc3, add_time, last_update, goods_type, extension_code, rank_integral)" .
101 "VALUES ('$_POST[goods_name]','$_POST[goods_model]', '$goods_name_style', '$goods_sn', '$catgory_id', " .
102 "'$brand_id', '$shop_price', '$market_price', '$is_promote','$promote_price', ".
103 "'$promote_start_date', '$promote_end_date', '$goods_img', '$goods_thumb', '$original_img', ".
104 "'$_POST[keywords]', '$_POST[goods_brief]', '$_POST[seller_note]', '$goods_weight', '$goods_number',".
105 " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_home', 0, '$is_on_sale', '$is_alone_sale', $is_shipping, ".
106 " '$_POST[goods_desc]', '$_POST[goods_desc2]', '$_POST[goods_desc3]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$code', '$rank_integral')";
107 
108 2 > 再往下几十行,找到"goods_desc = '$_POST[goods_desc]', " .在其下方再添加二行 ,改成如下 "goods_desc = '$_POST[goods_desc]', " .
109 
110 "goods_desc2 = '$_POST[goods_desc2]', " .
111 
112 "goods_desc3 = '$_POST[goods_desc3]', " . 

 

posted @ 2015-01-15 12:43  wpindesign  阅读(305)  评论(0编辑  收藏  举报