ecshop模板新添商品 此商品不存在规格,请为其添加规格 的解决方法
作者:admin 来源:未知 日期:2010-8-9 13:37:10 人气:
标签:
ecshop模板开发
导读:admin/includes/lib_goods.php里面的check_goods_specifications_exist 函数替换以下内容就可以了 /*** 检查单个商品是否存在规格** @param int $goods
admin/includes/lib_goods.php 里面的 check_goods_specifications_exist 函数替换以下内容就可以了
- /**
- * 检查单个商品是否存在规格
- *
- * @param int $goods_id 商品id
- * @return bool true,存在;false,不存在
- */
- function check_goods_specifications_exist($goods_id)
- {
- $goods_id = intval($goods_id);
- $sql = "SELECT a.attr_id
- FROM " .$GLOBALS['ecs']->table('attribute'). " AS a, " .$GLOBALS['ecs']->table('goods'). " AS g
- WHERE a.cat_id = g.goods_type
- AND g.goods_id = '$goods_id'
- AND a.attr_type='1'";
- $a = $GLOBALS['db']->getAll($sql);
- foreach ($a as $val)
- {
- $att[]=$val['attr_id'];
- }
- $sql= "SELECT count(goods_attr_id ) FROM ".$GLOBALS['ecs']->table('goods_attr')."as a WHERE a.goods_id ='$goods_id' AND a.attr_id ".db_create_in($att);
- $count=$GLOBALS['db']->getOne($sql);
- if ($count > 0)
- {
- return true; //存在
- }
- else
- {
- return false; //不存在
- }
- }
复制代码 如果是 使用了规格,那么会正常跳转货品列表中,如果未使用规格,则跳转到添加新商品页面 |
| 本文连接地址:http://www.511sj.com/html/wangdianjianshe/ecshop_mobankaifa/1313.Html |
|