How to redirect affiliate on registration

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 3 weeks ago #329810

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 7.9.24
-- PHP version -- : 7.4
-- Browser(s) name and version -- : Opera 74.0.3911.107

Hello
How do I redirect new affiliates after the register to become affiliates?
These are not customers.
Many thanks
Jo

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

  • Posts: 72763
  • Thank you received: 11096
  • MODERATOR
2 months 3 weeks ago #329812

Hi,

Well, when the registration is through the checkout, I don't think you want to redirect them, but stay on the checkout.

When the registration is through the HikaShop registration form page, then you can edit the "after_register" view file via the menu Display>Views to add a bit of code for the redirection.
For example:

<?php
$user  = hikashop_loadUser(true);
if(!empty($user->user_partner_activated)) {
 $app = JFactory::getApplication();
 $url =  'URL WHERE TO REDIRECT';
 $app->redirect($url);
}

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 3 weeks ago #329829

Hi
No, that's not getting any response at all. Still delivering to blank page.
You are correct, this is not registration through the checkout. I am trying to set up the affiliate program and people who are not customers should be able to register and be taken to the Affiliates home page.
I have little experience in this.... should the code above simply be placed under the current code on that page?...
<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.1
* @author hikashop.com
* @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?>
Many thanks

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 3 weeks ago #329833

After registration it is currently going to this page;
mysite.com/register/user/register

Many thanks

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

  • Posts: 72763
  • Thank you received: 11096
  • MODERATOR
2 months 2 weeks ago #329870

Hi,

Well, The modification I provided is supposing that you're using HikaShop's registration form page for your registration.
If you use Joomla's registration form or another component's registration form, then you'll have to do something else and I won't be able to help as I don't have the knowledge.
The URL register/user/register seems to indicate that you might be using Joomla's registration form, which would explain why the modification to the view file didn't change anything.
If you could provide the URL of the page with the registration form, I would be able to check what registration form you're using.

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 2 weeks ago #329947

Hi Nicolas, thanks for the help
Okay, the modification you gave is in place on after_register.php, see below;
<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.1
* @author hikashop.com
* @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?>
<?php
$user = hikashop_loadUser(true);
if(!empty($user->user_partner_activated)) {
$app = JFactory::getApplication();
$url = ' portableacousticbaffle.com/control-panel/affiliate ';
$app->redirect($url);
}
The redirect landing page should be /affiliate

2. Here is a link to the registration page; portableacousticbaffle.com/hikashop-registration

3. Here is the page is actually takes me to after registration, which is blank: portableacousticbaffle.com/hikashop-registration/user/register

4. I can confirm that I am using the Hikashop registration menu link, I have named it 'hikashop-registration'

Many thanks
jo

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

  • Posts: 72763
  • Thank you received: 11096
  • MODERATOR
2 months 2 weeks ago #329961

Hi,

The first and main issue I can see is that in the "registration" setting of the HikaShop configuration, you've selected "guest". And thus, what you see is a guest form, not a registration form.
I would recommend changing the "Display method for registration" setting to "selector" so that you could then select both "guest" and "registration" in the "registration" setting.
That way, on the registration form page, you would have a registration form.

Another issue I see is that you've added spaces between the quotes and the URL of the redirection.

Another issue is that I've made you add a check on the user_partner_activated parameter of the user, but on your registration form, you don't display the partner checkbox (thanks to the "Add a 'become a partner' checkbox on the registration form" option of the HikaShop configuration). In that case, this code will never redirect to your URL. So either you activate that option so that when registering the user can choose to become a partner or not, or you change the line:
if(!empty($user->user_partner_activated)) {
to:
if(true) {
so that the user is always redirected to your affiliate page after going through the registration page.

One other potential problem is that the hikashop_loadUser function might use a cached version of the data instead of the new user data. So just in case, I would recommend to add the line:
hikashop_loadUser(false, true);
before the line:
$user = hikashop_loadUser(true);
in order to clear the cache before loading the user data.

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 2 weeks ago #329990

Thanks for this Nicolas, still not quite there...

Just to clarify, I am wanting to sign people up as affiliates who will likely NOT be customers.

Okay, so got the registration form, no problem. However, the redirect is still not working. On registration I am presented with the message to confirm the email address, but not taken to the correct page.

Also, I'm not sure why the redirect address showed up as having a space before and after the address in the previous message I posted here, I did check it, and there was no space. Anyhow, redirect still not working.

I have deleted the test account you used previously if you would like to use the same email address to try again.

Many thanks

Jo

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

  • Posts: 72763
  • Thank you received: 11096
  • MODERATOR
2 months 2 weeks ago #329995

Hi,

To post code on the forum, make sure you use the [ code ] and [ / code ] tags ( without the spaces) around the code. That way, the forum system won't try to process your code's text.

Did you also do the code modifications I proposed in my previous message ?
What code do you now have in the after_register.php view file ?

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 2 weeks ago #330038

Hi
Here's the code I'm using;

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.4.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php
hikashop_loadUser(false, true);
$user  = hikashop_loadUser(true);
if(true) {
 $app = JFactory::getApplication();
 $url = 'https://portableacousticbaffle.com/control-panel/affiliate';
 $app->redirect($url);
}

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 2 weeks ago #330039

And this is the page it actually redirects to;

/hikashop-registration/checkout/activate_page?lang=en

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 2 weeks ago #330040

changed the page it's being directed to.... just to let you know! Still doesn't work;

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.4.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php
hikashop_loadUser(false, true);
$user  = hikashop_loadUser(true);
if(true) {
 $app = JFactory::getApplication();
 $url = 'https://portableacousticbaffle.com/members-home';
 $app->redirect($url);
}

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

  • Posts: 72763
  • Thank you received: 11096
  • MODERATOR
2 months 2 weeks ago #330042

Hi,

You've apparently activated the activation of users.
In that case, you want to do a similar modification to the checkout / activate_page.php view file.
However, In that case, it's possible that users registering through the checkout will also get this redirection.

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 1 day ago #330572

Thanks Nicolas

Okay, the registration process does work.
Register -> Get confirmation email

But, looking further...the Test is categorised as a Customer not a Partner

What am I missing?

Many thanks

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

  • Posts: 72763
  • Thank you received: 11096
  • MODERATOR
2 months 1 day ago #330573

Hi,

If you want someone who registers to automatically becomes a partner or to choose, you have the settings:
"Add a 'become a partner' checkbox on the registration form" and "Default value of the partner checkbox" in the "Affiliate" section of the HikaShop configuration.

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
2 months 14 hours ago #330650

Thanks Nicolas, I am one step closer!
Now...
Is it possible to change the url in the activation email? At the moment it takes me to a blank page with the 'Your account has been successfully activated' message. And, I am automatically logged in, but not on the page I want.
What I'd like it to do it take me to a specific page.
Many thanks
Jo

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

  • Posts: 24
  • Thank you received: 2
  • Hikashop Business
1 month 4 weeks ago #330721

It's okay, I got it thank you.
I added the following code to the 'activate' file in the 'user' view.

<?php
$app=&JFactory::getApplication();
$app->redirect('mywebsite.com');
?>

Was that correct? It is working!

Thanks again for the help.

Jo

The following user(s) said Thank You: Philip

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

Time to create page: 0.089 seconds
Powered by Kunena Forum