Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2011
    Location
    Canada
    Posts
    6
    Plugin Contributions
    0

    Default 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

  2. #2
    Join Date
    Jan 2004
    Posts
    60,580
    Blog Entries
    4
    Plugin Contributions
    145

    Default 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
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    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.



 

 

Similar Threads

  1. Replies: 1
    Last Post: 16 Apr 2011, 07:24 PM
  2. Login Page Redirect to My Account?
    By Zoethreads in forum General Questions
    Replies: 3
    Last Post: 27 May 2010, 02:28 AM
  3. Redirect after login to page outside of Zencart
    By Anuragji in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 4 Jun 2009, 11:24 PM
  4. Redirect from the Login Page
    By bgroup99 in forum Basic Configuration
    Replies: 8
    Last Post: 15 May 2007, 07:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •