common\models\CartGoods::tableName PHP Method

tableName() public static method

public static tableName ( )
    public static function tableName()
    {
        return '{{%cart_goods}}';
    }

Usage Example

コード例 #1
0
ファイル: User.php プロジェクト: daixianceng/xiaoego.com
 /**
  * 获取购物车中有效商品总价
  * 
  * @param string $storeId
  * @return string
  */
 public function getCartGoodsRealVolume($storeId)
 {
     $sql = 'SELECT sum(t0.count * t1.price) FROM ' . CartGoods::tableName() . ' AS t0 LEFT JOIN ' . Goods::tableName() . ' AS t1 ON t0.goods_id = t1.id WHERE t0.user_id=:user_id AND t0.store_id=:store_id AND t1.status=:status;';
     $volume = Yii::$app->db->createCommand($sql, [':user_id' => $this->id, ':store_id' => $storeId, ':status' => Goods::STATUS_NORMAL])->queryScalar();
     return bcadd($volume, '0', 2);
 }