微擎之人人商城 之修改申请退款库存不增加问题

来源:互联网 发布:windows ftp上传命令 编辑:程序博客网 时间:2024/04/27 19:38

问题描述:后台通过用户退款申请时库存不增加
修改文件目录:WWW\wq\addons\ewei_shop\core\web\order
修改代码:

  //更新商品库存信息查询数据库中商品库存更新goods_option表中的stock 和goods表total  //查询一条记录pdo_fetch($sql,$params=array())     $goodsinfo=array();     $goodsinfo=pdo_fetch("SELECT optionname,total, goodsid FROM ".tablename('ewei_shop_order_goods')." WHERE uniacid = :uniacid         and orderid=:orderid LIMIT 1", array(':uniacid' => $_W["uniacid"],':orderid'=>$zym_var_32["id"],));      //更新goods表中库存/*      $goodstotal=array();      $goodstotal=pdo_fetch("select total from".tablename("ewei_shop_goods")."where uniacid=:uniacid and id=:id",array(           ":uniacid"=>$_W["uniacid"],           ":id"=>$goodsinfo['goodsid']        ));       $goodstotals=$goodstotal['total']+$goodsinfo['total'];        pdo_update("ewei_shop_goods",            array(              "total"=>$goodstotals            ),            array(               "uniacid" => $_W["uniacid"],               "id"=>$goodsinfo['goodsid']            ));         //如果启用了规格则更新goods_option中的库存        if(!empty($goodsinfo['optionname'])){          $goods_option=array();          $goods_option=pdo_fetch("select stock from".tablename("ewei_shop_goods_option")."where uniacid=:uniacid and title=:title and goodsid=:goodsid ",           array(           ":uniacid"=>$_W["uniacid"],           ":title"=>$goodsinfo['optionname'],           ":goodsid"=>$goodsinfo['goodsid']        ));   $goodsoptiontotal=$goods_option['stock']+$goodsinfo['total'];         pdo_update("ewei_shop_goods_option",            array(              "stock"=>$goodsoptiontotal            ),            array(               "uniacid" => $_W["uniacid"],               "title"=>$goodsinfo['optionname'],               "goodsid"=>$goodsinfo['goodsid']            ));        }    //退款时更新库存结束
0 0
原创粉丝点击