瀏覽代碼

购物车总数

lizhen_gitee 3 月之前
父節點
當前提交
b65000d14f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      addons/unishop/controller/Product.php

+ 1 - 1
addons/unishop/controller/Product.php

@@ -99,7 +99,7 @@ class Product extends Base
             }
 
             // 购物车数量
-            $data->cart_num = (new \addons\unishop\model\Cart)->where(['user_id' => $this->auth->id])->count();
+            $data->cart_num = (new \addons\unishop\model\Cart)->where(['user_id' => $this->auth->id])->sum('number');
 
             // 评价信息
             $data->evaluate_list = [];