ecshop后台增加商品描述字段
注:如在后台添加商品为例子
1.在数据库中添加相应的字段名称(如:my_text).
2.修改后台中的编辑器FCKeditor.先到 admin/includes/lib_main.php 中参照 create_html_editor 函数添加一个新的函数用来生成后台编辑器.
- //原始的
- function create_html_editor($input_name, $input_value = '')
- {
- global $smarty;
- $editor = new FCKeditor($input_name);
- $editor->BasePath = '../includes/fckeditor/';
- $editor->ToolbarSet = 'Normal';
- $editor->Width = '100%';
- $editor->Height = '320';
- $editor->Value = $input_value;
- $FCKeditor = $editor->CreateHtml();
- $smarty->assign('FCKeditor', $FCKeditor);
- }
- //自己加的
- function pv_create_html_editor($input_name, $input_value = '', $i)
- {
- global $smarty;
- $editor = new FCKeditor($input_name);
- $editor->BasePath = '../includes/fckeditor/';
- $editor->ToolbarSet = 'Normal';
- $editor->Width = '100%';
- $editor->Height = '320';
- $editor->Value = $input_value;
- $FCKeditorx = $editor->CreateHtml();
- $smarty->assign('FCKeditor'.$i, $FCKeditorx);
- }
3.打开 admin/goods.php,查找 create_html_editor
- //原始的 create_html_editor('goods_desc', $goods['goods_desc']);
- //并在其后添加如下语句:
- //要自己加的 pv_create_html_editor(my_text, $goods[my_text],1);
继续在admin/goods.php中查找所有 goods_desc,相应新增 my_text.如: 'goods_desc' => ' ',后面加 'my_text' => ' ',(注意是所有的).
4.修改添加商品和修改商品的SQL语句,如下:
- $sql = "INSERT INTO " . $ecs->table('goods') . " (my_text) VALUES ('$_POST[my_text]')";//此处只是例子,请根据实际情况修改
5. 修改后台中相应的模版文件,添加/修改商品的模版是admin/templates/goods_info.htm
查找{$lang.tab_article},在后面加自己的内容,再在下面添加一个自己的表格,(注:如果要添加多个字段,请参照上面的修改,在此处FCKeditor后面修改数字).{$FCKeditor1}

