Recent Topics

How to give page redirection to the current page after login



  • Hi,

    Can anyone please suggest me how to give page redirection to the current session page after successfully login into bagisto ecommerce instead of redirecting to the user profile. For reference see this link https://camelia.ae/categories/flowers (In that where we actually login, after successfully logged in also it will redirect to the same page. Please give me solution. Thank you in advance.



  • Hi @Keerthi

    You can change redirection of login page of customer. (routes.php in Shop package)

    Route::post('login', 'Webkul\Customer\Http\Controllers\[email protected]')->defaults('_config', [
                'redirect' => 'customer.profile.index '
     ])->name('customer.session.create');
    

    Change its 'redirect' to that route where you want after login.

    Thanks



  • Hi,

    Redirection is working fine with which you have sent route, but actually I need redirection to the current session page after successfully login (suppose I am at product page then If I will login from header drop-down. After successfully logged in then it should be redirect to the same product page. Please can anyone suggest me thank you in advance.



  • Hi,

    Replace code of 'show' method of SessionController (Customer Package) with below one.

             if (auth()->guard('customer')->check()) {
                return redirect()->route('customer.profile.index');
            } else {
                $intendedUrl = url()->previous();
    
                session()->put('url.intended', $intendedUrl);
    
                return view($this->_config['view']);
            }
    

    Thanks



  • Hi,

    Thank you soooo much, It's working fine for me, once again thanks a lot.



  • Hey @rahul , How to do this same thing after posting review? Now it is redirecting to Home page.



  • HI @RK-REZA

    $intendedUrl = url()->previous();
    session()->put('url.intended', $intendedUrl);
    

    use this at 'create' method of ReviewController' and use

    return redirect()->intended(route($this->_config['redirect']));
    

    to redirect it at 'store' method of same controller (Shop Package).

    Thanks



  • Thanks.

    .


Log in to reply