北京网店建设
网站地图
RSS订阅
匿名投稿
开网店送空间和顶级域名
您的位置:北京网店建设 > 网店建设 > ecshop模板开发

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 函数替换以下内容就可以了
  1. /**
  2. * 检查单个商品是否存在规格
  3. *
  4. * @param   int        $goods_id          商品id
  5. * @return  bool                          true,存在;false,不存在
  6. */
  7. function check_goods_specifications_exist($goods_id)
  8. {
  9.     $goods_id = intval($goods_id);

  10.     $sql = "SELECT a.attr_id
  11.             FROM " .$GLOBALS['ecs']->table('attribute'). " AS a, " .$GLOBALS['ecs']->table('goods'). " AS g
  12.             WHERE a.cat_id = g.goods_type
  13.             AND g.goods_id = '$goods_id'
  14.             AND a.attr_type='1'";

  15.     $a = $GLOBALS['db']->getAll($sql);
  16.     foreach ($a as $val)
  17.     {
  18.         $att[]=$val['attr_id'];
  19.     }
  20.     $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);
  21.     $count=$GLOBALS['db']->getOne($sql);
  22.     if ($count > 0)
  23.     {
  24.         return true;    //存在
  25.     }
  26.     else
  27.     {
  28.         return false;    //不存在
  29.     }
  30. }
复制代码
如果是 使用了规格,那么会正常跳转货品列表中,如果未使用规格,则跳转到添加新商品页面
本文连接地址:http://www.511sj.com/html/wangdianjianshe/ecshop_mobankaifa/1313.Html

编辑整理:北京网店建设 ecshop模板 ecshop模板

共有:条评论信息评论信息
发表评论
姓 名:
验证码: