后台增加一个商品描述编辑器,添加新商品出错!
2016-07-07 15:12 来源:www.chinab4c.com 作者:ecshop专家
| 我在后台增加一个商品描述编辑器,添加新商品出错了!但是编辑以前添加过的商品的时候没有出错,截图如下:   下面的图是报错的,添加了数据字段goods_desc2,goods_desc3 和原来的goods_desc是一个属性   | 
- 
QQ截图20130527112350.jpg (58.02 KB)   
回答:
| 商品属性原来没有的吧,你自己加的? | 
| 看下字段是否出问题了 | 
| 是的 我新添加的 | 
| - - 能看看问题所在吗? | 
| 先把解决步骤和代码贴下: 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]', " . 最后呢 就是在前台商品页模版调用就可以了 经测试成功 | 
| 你只要new一个编辑器的对象。就可以 | 
| new一个编辑器的对象 | 
 
        
					
						
					
					
						
                          
					
				 
      
      最近更新
常用插件
- ecshop2.7.2退换货申请插件
                                  ecshop2.7.2退换货申请插件,主要是在 ecshop 现在的基础上,对ecshop的订单处... 
- ecshop会员中心订单excel倒出
                                  ecshop会员中心订单excel倒出... 
- ecshop二次开发商品购买备
                                  ecshop销售统计 插件介绍:ecshop二次开发订单销售统计和商品购买备注服... 
- ecshop二次商品订购人信息
                                  ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的... 
- ecshop注册推荐送现金插件
                                  ecshop中的促销售功能还不是很完善,随着电子商务系统的发展和进步,... 
ecshop热门问答
ecshop热门资料
          
               
            ecshop实行 
                
            ecshopcloghing 
                
            ecshop注册时间 
                
            ecshop同事 
                
            ecshop兼职 
                
            ecshop向祖国献礼 
                
            ecshop购物车ajax动态刷新 
                
            ecshop组合商品 
                
            ecshopiis 
                
            ecshop认证 
                
            ecshop位数 
                
            ecshop密码重置 
                
            ecshop叩谢 
                
            ecshopNot 
                
            ecshopiteration 
                
            hdwiki的block 
                
            ecshop面包屑导航 
                
            ecshop购物指南 
                
            ecshop分成管理 
                
            ecshopFrame 
                
            ecshop人人 
                
            ecshop图片批量上传 
                
            ecshop图解 
                
            ecshop图片浏览 
                
            ecshop不一样的 
                
            ecshop过虑 
                
            ecshop报价单 
                
            ecshop白问题 
                
            ecshop求网站修改战略 
                
            ecshop服务 
             
        
      



