Welcome Guest, Not a member yet? Register   Sign In
return redirect()->back();
#1

I have a private  error function in my controller that I'm trying to have redirect to the shopping cart.
It sends an email to an errors email address and then I want to have it redirect.
I have tried:
return redirect()->back();
return redirect()->to( '/cart' );
return redirect()->to( base_url( '/cart') );
return redirect()->to( base_url( 'cart') );

None work. The URL in the address bar remains as: <domain>/cart/completeCheckout with a blank page.

Here is the function:

private function _handle_checkout_error( $error, $cart )
{

        helper('common_functions');

        $bmConfig = config('BM');

        session()->setFlashdata('message', 'There was a problem checking out.  Please try again later.');



        $router = service('router');

        $log = "ERROR!\n\n";

        $log .= $error . "\n\n";

        $log .= 'CONTROLLER # METHOD:' . "\n";

        $log .= $router->controllerName() . ' # ' . $router->methodName() . "\n\n";

        $log .= 'GET ARRAY: ' . print_r($_GET, true) . "\n\n";

        $log .= 'POST ARRAY: ' . print_r($_POST, true) . "\n\n";

        $log .= 'CART: ' . print_r($cart, true) . "\n\n";

        $log .= 'USER AGENT:' . "\n";

        $log .= $_SERVER['HTTP_USER_AGENT'];

        log_message('critical', $log);



        email( $bmConfig->emailFromAddress, $bmConfig->errorsEmail, 'ERROR!', $log );



        return redirect()->to( base_url( 'cart' ) );
    }



This code works all the way to the redirect - I get the $log entry and the email, then nothing.
Reply


Messages In This Thread
return redirect()->back(); - by swsupport - 05-15-2021, 08:24 AM
RE: return redirect()->back(); - by includebeer - 05-15-2021, 08:38 AM
RE: return redirect()->back(); - by swsupport - 05-15-2021, 09:01 AM
RE: return redirect()->back(); - by swsupport - 05-15-2021, 09:50 AM
RE: return redirect()->back(); - by swsupport - 05-15-2021, 10:20 AM
RE: return redirect()->back(); - by InsiteFX - 05-15-2021, 11:40 AM
RE: return redirect()->back(); - by swsupport - 05-15-2021, 11:41 AM
RE: return redirect()->back(); - by wdeda - 05-15-2021, 03:10 PM
RE: return redirect()->back(); - by swsupport - 05-15-2021, 04:47 PM
RE: return redirect()->back(); - by demyr - 05-15-2021, 10:54 PM
RE: return redirect()->back(); - by MGatner - 05-22-2021, 05:19 AM
RE: return redirect()->back(); - by John_Betong - 05-22-2021, 04:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB