Forums / Basic Configuration / can I redirect customers to category page after login?

can I redirect customers to category page after login?

Views: 1,474

Results 1 to 2 of 2
22 Nov 2011, 8:18 PM
#1
alaint avatar

alaint

New Zenner

Join Date:
Jul 2011
Location:
Canada
Posts:
6
Plugin Contributions:
0

can I redirect customers to category page after login?

I am currently using v1.3.9h. I would like to change the login page for my returning customers to bring them to a catagories page instead of the main page. I know I can setup for the catagories to always show on main page from the admin, but I don't want that. I only want when a customer logs in, that instead of comming up to the main page to have only catagories as the main page.

Can someone help me or atleast point me to the proper thread if it exists.

Thanks

Al

23 Nov 2011, 2:22 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: can I redirect customers to category page after login?

Easy. Add the following 2 files to your store:

/includes/auto_loaders/config.login_redirect.php```

<?php /** * autoloader to initialize an observer class * * @package initSystem * @copyright Copyright 2003-2011 Zen Cart Development Team * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: config.login_redirect.php drbyte$ */ /** * Designed for v1.5.0 */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } /** * point 200 is usually suitable for addon observer classes in v1.x */ $autoLoadConfig[200][] = array('autoType'=>'class', 'loadFile'=>'observers/class.login_redirect.php'); $autoLoadConfig[200][] = array('autoType'=>'classInstantiate', 'className'=>'login_redirect', 'objectName'=>'login_redirect'); ```and /includes/classes/observers/class.login_redirect.php``` <?php /** * @package addons * @copyright Copyright 2003-2011 Zen Cart Development Team * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: class.login_redirect.php 2011-11 drbyte $ * * Designed for v1.5.0 */ class login_redirect extends base { function __construct() { $this->attach($this, array('NOTIFY_LOGIN_SUCCESS')); } function update(&$class, $eventID, $paramsArray = array()) { /** * $paramsArray contains any parameters passed to the hooked notifier point. * If those parameters are passed by reference, you can pass back the change by setting that entry to a new value. * For example, if the first parameter is passed as &$string1 * then you can effect a change to $string1 by setting the first entry in paramsArray, as shown: * $paramsArray[0] = 'new_value for string1'; */ if ($eventID == 'NOTIFY_LOGIN_SUCCESS') { $_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_DEFAULT, 'get' => array('cPath' => '0'))); // set the appropriate category path above (replacing the '0' with '3_10' or '147_83_24', etc } } } ``` This should work for both v1.3.9h and v1.5.0

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.