关于通用信息修改的方法(适合初学者 大侠就滤过吧~)

2016-07-07 15:03 来源:www.chinab4c.com 作者:ecshop专家

如果想修改后台,主要修改的是模版文件夹中的.htm文件(即位置为:/admin/templates)
今天主要修改的是:
商品管理中心---à添加单个商品和修改单个商品信息


主要实现在通用信息中添加一个属性条形码


1
首先找到/admin/templates/good_info.htm


添加



<tr>


<td class="label">{
$lang.lab_goods_barcode}</td>

<td><input type="text" name="goods_barcode" value="{$goods.goods_barcode|escape}" size="30" /></td>


</tr>


增加一个内容框,如下:



2
语言包里添加 :languages/zh_ch/admin/goods.php



3.
修改/admin/goods.php

找到 /* 处理商品数据 */

a
.获取good_info.htm 传过来的goods_barcode 变量;


b.修改sql语句;

/*
入库 */


/*
添加了条形码字段goods_barcode */

在其下的insert语句添加相应的变量


在其下的update也加上;

4.然后在数据库中的goods表中添加相应的字段就OK 了

回答:
http://bbs.ecshop.com/viewthread ... mp;page=1#pid492844

看我这个详细一点吧,希望大家做教程尽量的详细,这样才方便新手来学习。

很详细 顶了~~ 2# l0ss

支持下~

这个很好啊

不错
支持下

应人需要补充如下:
3.修改/admin/goods.php
找到 /* 处理商品数据 */
a
.获取good_info.htm 传过来的goods_barcode 变量;


b.修改sql语句;
1)在其下的insert语句添加相应的变量,找到如下sql语句:
/* 入库 */

if ($is_insert)

{


if ($code == '')


{



$sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name, 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, goods_barcode,is_best, is_new, is_hot, " .


"is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, rank_integral, suppliers_id)" .


"VALUES ('$_POST[goods_name]', '$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','$goods_barcode', '$is_best', '$is_new', '$is_hot', '$is_on_sale', '$is_alone_sale', $is_shipping, ".


" '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$rank_integral', '$suppliers_id')";


}


else


{


$sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name, 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_real, " .


"is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, extension_code, rank_integral)" .


"VALUES ('$_POST[goods_name]', '$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', 0, '$is_on_sale', '$is_alone_sale', $is_shipping, ".


" '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$code', '$rank_integral')";


}

2
)在其下的update也加上;
查找
@unlink(ROOT_PATH . $row['goods_thumb']);
添加字段goods_barcode
$sql = "UPDATE " . $ecs->table('goods') . " SET " .

"goods_name = '$_POST[goods_name]', " .


"goods_name_style = '$goods_name_style', " .


"goods_sn = '$goods_sn', " .


"cat_id = '$catgory_id', " .


"brand_id = '$brand_id', " .


"shop_price = '$shop_price', " .



"goods_barcode= '$goods_barcode', ".


"market_price = '$market_price', " .


"is_promote = '$is_promote', " .


"promote_price = '$promote_price', " .


"promote_start_date = '$promote_start_date', " .


"suppliers_id = '$suppliers_id', " .


"promote_end_date = '$promote_end_date', "
;
4.
然后在数据库中的goods表中添加相应的字段就OK 了

添加字段看你用什么了,
可以用sql,也可以工具直接添加。,

要是前台是条码图象状态显示,那就更拽了