Results 1 to 2 of 2

Hybrid View

  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
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

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

 

 

Similar Threads

  1. v139h Can I redirect customers to My Account after logging in?
    By ideasgirl in forum General Questions
    Replies: 0
    Last Post: 8 Jun 2012, 03:19 AM
  2. Can't login after adding a 301 redirect in .htaccess
    By eutopia in forum Basic Configuration
    Replies: 0
    Last Post: 11 Oct 2011, 02:27 AM
  3. Login Link - Can I redirect to My Account after login?
    By perkiekat in forum General Questions
    Replies: 2
    Last Post: 3 Feb 2010, 01:34 AM
  4. 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
  5. Customers can't login after upgrade!
    By Grimmy2007 in forum Upgrading from 1.3.x to 1.3.9
    Replies: 3
    Last Post: 20 Dec 2007, 10:55 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR