Redirecting users to specific category

I would like to redirect a specific member category to a specific product category.



For example, I have a wholesaler that logs in, I want him to be directed to the to the wholesale category page for the wholesale product.



Can somebody help me with the code for this change?

auth.php in /controllers/common



line #118 ??

Search for:



```php

elseif (!empty($_REQUEST[‘return_url’]))

```



in that elseif block add something like:



```php

if (in_array(5,$auth[‘usergroup_ids’])) $redirect_url = ‘welcome-dealers.html’;

elseif (in_array(7,$auth[‘usergroup_ids’])) $redirect_url = ‘welcome-doctors.html’;

```



5 & 7 are the made up examples for price groups, you can get the real group ids from the database

mmm, not working for me, I also tried “membership_id” instead of “usergroup_ids”, nothing happens…



I’m attaching the auth.php file.

Auth.zip

Try to clear the cache. Delete all files and folders in /var/compiled/ and /var/cache/

```php

} elseif (!empty($_REQUEST[‘return_url’])) {

if (in_array(5,$auth[‘usergroup_ids’])) $redirect_url = ‘welcome-dealers.html’;

elseif (in_array(7,$auth[‘usergroup_ids’])) $redirect_url = ‘welcome-doctors.html’;

else $redirect_url = $_REQUEST[‘return_url’];

} ```



I don’t think you put it in correctly, plus, you did not change from sample indexes to real ones, you did not change the page redirection to where it should go… did you make a page welcome-dealers.html ? Did you look up your ids for the dealer group?



Your code has a bracket in the wrong place. I don’t think you know PHP enough to make edits yourself.

I cleared the cache, used &cc in the admin side and placed the correct code as mentionned (see attached file).



Below are my membership ID’s got fom the DB dump (4 and 6):


INSERT INTO cscart_membership_descriptions (`membership_id`, `lang_code`, `membership`) VALUES ('6', 'FR', 'Espace Pro');


INSERT INTO cscart_membership_descriptions (`membership_id`, `lang_code`, `membership`) VALUES ('4', 'FR', 'Admin');



Here is the code I inserted:




} elseif (!empty($_REQUEST['return_url'])) {
if (in_array(6,$auth['usergroup_ids'])) $redirect_url = 'toutes-les-activites.html';
elseif (in_array(4,$auth['usergroup_ids'])) $redirect_url = 'comment-ca-marche-.html';
else $redirect_url = $_REQUEST['return_url'];
}




I’m not sure what I’m doing wrong here.

Auth2.zip