Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    How to give page redirection to the current page after login

    Knowledge Base
    3
    9
    1473
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      Keerthi last edited by

      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.

      1 Reply Last reply Reply Quote 1
      • R
        rahul last edited by

        Hi @Keerthi

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

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

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

        Thanks

        1 Reply Last reply Reply Quote 0
        • K
          Keerthi last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • R
            rahul last edited by

            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

            1 Reply Last reply Reply Quote 2
            • K
              Keerthi last edited by

              Hi,

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

              1 Reply Last reply Reply Quote 0
              • R
                RK REZA last edited by

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

                1 Reply Last reply Reply Quote 0
                • R
                  rahul last edited by

                  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

                  1 Reply Last reply Reply Quote 1
                  • R
                    RK REZA last edited by

                    Thanks.

                    .

                    1 Reply Last reply Reply Quote 0
                    • K
                      Keerthi last edited by

                      Hi @rahul,

                      can you please tell me page redirection to the current session page after login with google+ with the below code is working only for existing customers that means only registered customers and not working with pop up login (in this case also it is redirecting to the customers profile page after successfully logged in) Please suggest me on this issue.

                         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']);
                              }
                      
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post