common/components/CartFunctionality.php
/*
     * This function check if the user is guest
     * if guest return session_id otherwise return user_id
     */
This function check if the user is guest
if guest return session_id otherwise return user_id
This function check if the user is guest if guest return session_id otherwise return user_id
public function UserCheck() {
        if (isset(Yii::$app->user->identity->id)) {
            $user_id = Yii::$app->user->identity->id;
            $condition = ['user_id' => $user_id];
        } else {
            if (!isset(Yii::$app->session['temp_user'])) {
                $milliseconds = round(microtime(true) * 1000);
                Yii::$app->session['temp_user'] = $milliseconds;
            }
            $sessonid = Yii::$app->session['temp_user'];
            $condition = ['session_id' => $sessonid];
        }
        return $condition;
    }
public function UserCheck ( ) { if ( isset ( Yii :: $ app -> user -> identity -> id ) ) { $ user_id = Yii :: $ app -> user -> identity -> id ; $ condition = [ 'user_id' => $ user_id ] ; } else { if ( ! isset ( Yii :: $ app -> session [ 'temp_user' ] ) ) { $ milliseconds = round ( microtime ( true ) * 1000 ) ; Yii :: $ app -> session [ 'temp_user' ] = $ milliseconds ; } $ sessonid = Yii :: $ app -> session [ 'temp_user' ] ; $ condition = [ 'session_id' => $ sessonid ] ; } return $ condition ; }
This function check if the user is guest
 if guest return session_id otherwise return user_id
This function check if the user is guest if guest return session_id otherwise return user_id