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
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
Code:
<?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
Code:
<?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