common/components/CartFunctionality.php
/*
     * This function checks the product exists or not
     */
This function checks the product exists or not
This function checks the product exists or not
public static function check_product() {
        $condition = Yii::$app->CartFunctionality->UserCheck();
        $cart_items = Cart::find()->where($condition)->all();
        foreach ($cart_items as $cart) {
            $check_product = Product::find()->where(['id' => $cart->product_id])->one();
            if (empty($check_product)) {
                $cart->delete();
            }
        }
    }
public static function check_product ( ) { $ condition = Yii :: $ app -> CartFunctionality -> UserCheck ( ) ; $ cart_items = Cart :: find ( ) -> where ( $ condition ) -> all ( ) ; foreach ( $ cart_items as $ cart ) { $ check_product = Product :: find ( ) -> where ( [ 'id' => $ cart -> product_id ] ) -> one ( ) ; if ( empty ( $ check_product ) ) { $ cart -> delete ( ) ; } } }
This function checks the product exists or not
This function checks the product exists or not