ECSHOP的商品属性不够全面,在需要给商品增加副标题的时候怎么办呢?本文主要参考了网络上的解决方法,结合自身实践,可以解决问题。
假设我们要增加一个subtitle的副标题字段。
1.在SQL查询里增加如下语句:
1 | alter table ecs_goods add column subtitle varchar(64); |
2.修改admin/good.php
1 | $shop_price = !empty($_POST['shop_price']) ? $_POST['shop_price'] : 0; |
在下面添加
1 | $goods_profit = !empty($_POST['goods_subtitle']) ? $_POST['goods_subtitle'] : 0; |
3.然后查找 if ($is_insert),可以选择在“goods_weight”后增加“goods_subtitle”,一共需要改4个地方。
4.查找查找
1 | "goods_weight = '$goods_weight'," . |
在下面增加:
1 | "goods_subtitle = '$goods_subtitle',". |
5.找到admin\templates\goods_info.htm,在商品名称的表格下增加一段:
1 2 3 4 5 | <tr> <td class="label">副标题:</td> <td><input type="text" name="goods_subtitle" value="{$goods.goods_subtitle}" size="20" /> </td> </tr> |
这样就可以在goods.dwt中用“{$goods.goods_subtitle}”调用了。
经过了以上的过程,可能依旧调用不出来。登录服务器打开管理MYSQL的小海豚或通过phpmyadmin管理数据库,打开ecs_goods,在“Field”中找到刚才添加的“goods_subtitle”字段,选择“Indices”,还要添加“goods_subtitle”字段才可以。
哥们儿、、好几处有BUG alter table ecs_goods add column subtitle varchar(64);应该是alter table ecs_goods add column goods_subtitle varchar(64);$goods_profit = !empty($_POST[‘goods_subtitle’]) ?应该是$goods_subtitle = !empty($_POST[‘goods_subtitle’]) ?
谢谢这位朋友的提醒