Login/register redirect

  • Posts: 1119
  • Thank you received: 114
5 years 8 months ago #295358

Hi,

I am looking for advise here.

Is there a way to set different redirect returns urls to joomla login form after successful login based on where user came from to that login page?

As example, if user do a checkout he should go back to checkout page. If user just tries to login, he should be redirected as per login menu options or something...

Basically we are looking to have something similar as ebay or asos have. They have one login/register page and if you do a checkout, after login or registration you will be redirected back to checkout and vice versa if just simply trying to login....

I assume this somehow could be set during checkout in view files...

Any advise welcome.

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
5 years 8 months ago #295374

Hello,

The redirection is handle by Joomla core itself.
If you put an ACL on the menu ; HikaShop is not even called or related to the affair.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
5 years 8 months ago #295713

kyratn,

Did you end up working out a solution for your needs for this issue? If so, what did you do?

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
5 years 8 months ago #295722

Hi,

Unfortunately i did not. I am still looking for solution. As for now we are busy with other things but for sure will have to look again for it soon....

As for now the only i could think is to have another login/register page with custom redirections and redirect to that page before checkout. However having 2 login pages for different purpose is kinda odd :(

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
5 years 8 months ago #295724

Hi kyratn,

I managed to get something working for our website.

Basically I turned off the 'Redirect Joomla registration to HikaShop Plugin' and just used the Joomla registration. I created a menu item of type 'User > Registration Form' that loads the register user form, then redirects to the new users account profile page login page upon successful registration.

Last edit: 5 years 8 months ago by developer.

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
5 years 8 months ago #295726

Hi,

Well as i know it does that by default. What we need is to have one form and somehow set different redirections based on it was a checkout or just simple login registration through site.

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
5 years 8 months ago #295728

I'm guessing you would need to add an if/else type block and some redirects in the file '/components/com_hikashop/views/user/tmpl/after_register.php' to do what you want.

I haven't done much Joomla coding since v1.x days so I'm of no help sorry.

I'm glad my problem was an easier fix than yours :P

Good luck

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13036
  • MODERATOR
5 years 8 months ago #295717

Hi,

Note that if you try to access a menu item of HikaShop's user control panel, HikaShop will redirect you to the Joomla login form and will tell joomla to redirect you back to the URL you were trying to access before after the login.
And for the checkout, the login process is handled by HikaShop's login form so there is no redirection issue.
As Jerome said however, if you add access levels to your menu items, then it's Joomla handling the redirection to and from the Joomla login form and HikaShop doesn't have any control on that.
And it's the same for other extensions, or login forms.

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
5 years 8 months ago #295768

Hi,

Thanks Nicolas for clarification but i think your have misunderstood my question. I will try to describe what i want.

I do have menu with login form. In that form, as for now, in hidden input i have set:

<?php echo base64_encode($_SERVER['HTTP_REFERER']); ?>

So whenever user login he is redirected back to hes previous page. It works fine!

Now the idea is to have 2 steps checkout.

First step "Cart view" and second step" All other views"

When user is on first step and tries to go to next step he will be redirected to that login form and after succesful login redirected to step 2 ( same would apply to registration form ).

Now, i know how to do everything except how to find if user has come from checkout step 1 OR he just tries to login through some site "Login" button...

I can't redirect to checkout step 2 after every login cause it would make no sense for user. So as for know i see 2 solutions. Create 2 login forms, one for checkout and other for simple site login. Or to find a way to get previous page menu item id, in that way i will be able to set different redirection based on ID after login/registration...

I know it is outside hikashop support so you may replay or not to this, or you can just give some tip as experienced developer here :)

Kind Regards

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13036
  • MODERATOR
5 years 8 months ago #295838

Hi,

So if I understand correctly, you're not using the HikaShop form of the checkout, because otherwise, you wouldn't have the problem on the checkout since the login form of the checkout ALWAYS redirects back to the checkout as it is supposed to.
So I'll suppose that you're using the Joomla login module. In that case, you want to create a plugin of the group "user" and implement in it the trigger onUserAfterLogin :
docs.joomla.org/Plugin/Events/User#onUserAfterLogin
In it, you can check the

$_SERVER['HTTP_REFERER']
variable to know where you come from and then you can redirect to where you want based on that.
joomla.stackexchange.com/questions/16032...-message-in-joomla-3

The following user(s) said Thank You: kyratn

Please Log in or Create an account to join the conversation.

Time to create page: 0.080 seconds
Powered by Kunena Forum