青岛网站建设新闻资讯

ECSHOP二次开发之给商品增加新字段

时间:2014-07-09 已阅读:608次 | 作者:青岛网站建设

首页>新闻资讯>建站知识

ECSHOP二次开发工作之如何给商品增加一个新字段,来录入一些新的内容。

下面我们结合ecshop后台“商品编辑”、“商品录入”来谈谈如何给ecshop商品增加一个新字段,假设我们将这个新字段命名为 other_col

1、首先要修改数据表结构,给表 ecs_goods 增加新字段:other_col,

       进入ECSHOP后台 》数据库管理 》SQL查询,输入下面SQL语句,提交。注意如果你的数据表前缀不是ecs_ 请自行修改之

     alter table ecs_goods add column other_col varchar(64);

2、在ecshop后台的admin emplatesgoods_info.htm中增加以下代码.

------------------------------------------------------------------------------------------------

   


            自定义字段


           


           


   

------------------------------------------------------------------------------------------------

 

 

3、在admin/goods.php的elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update')里面增加以下程序

 

------------------------------------------------------------------------------------------------

     $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_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, rank_integral, suppliers_id,other_col)" .


                "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', '$is_on_sale', '$is_alone_sale', $is_shipping, ".


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



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

------------------------------------------------------------------------------------------------

      这样就完成了在ECSHOP后台录入和修改新字段的功能了。

      下面再来说一下前台调用的方法:

      直接在模板文件或者  lbi文件里 这么调用即可 {$goods.other_col}


二维码
扫描二维码手机查看该文章

文章引用:https://www.qinghuahulian.com/news/webzhishi/748.html

相关资讯

Copyright © 2011-2024 青华互联-青岛青华锐思网络科技有限公司 www.qinghuahulian.com All Rights Reserved
鲁公网安备37020202000800号 鲁ICP备14020555号-4 网站地图 百度地图