Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2015
    Location
    Canada
    Posts
    4
    Plugin Contributions
    0

    Default Prevent redirect to log in page

    I have a store which required users to register before they can view the products. So my settings under configuration -> customer details --> Customers must be approved to shop, it is set to 1= Must login to browse.

    With this setting every page redirects to the log in page which is how I want the store to function. Except it prevents a file in my route folder from being accessed which needs to be accessed.

    I need to the file /shipstation_zc.php not redirected to the log in page. Is there a way to disable the site wide redirect just for this one page? It needs to be accessed to export my orders.

    The shipstation support was unable to help as the issue is contained within zen cart. I hope someone familiar with this zen cart feature can assist.

  2. #2
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Prevent redirect to log in page

    Not familiar with Ship Station but just downloaded the add-on from the plugins and went through the code.
    There is really nothing in that file that would test for a redirection. IMHO that file serves only for administrative purposes and initiates the export of orders - am I right??
    Do you manually call that file (as in calling http://yourdomain.com/shipstation_zc.php) or is it called via cron?

  3. #3
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Prevent redirect to log in page

    What version of Zen Cart is installed?

    If 1.5.x and shipstation_zc.php loads application_top.php... You may need to modify init_customer_auth.php to exclude shipstation_zc.php from being blocked by the setting "customer must be logged in".

  4. #4
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Prevent redirect to log in page

    Following on from ihungil's post, try this in /includes/init_includes/init_customer_auth.php

    Change (around line 70)

    PHP Code:
    switch (true) {
     
    /**  
       * bypass redirects for these scripts, to processing regardless of store mode or cust auth mode 
     */  
    case (preg_match('/ipn_main_handler\.php$/'$_SERVER['SCRIPT_NAME'])):  
    case (
    preg_match('/ajax\.php$/'$_SERVER['SCRIPT_NAME'])):
    break; 
    to this

    PHP Code:
    switch (true) {
     
    /**
       * bypass redirects for these scripts, to processing regardless of store mode or cust auth mode  
       */
      
    case (preg_match('/ipn_main_handler\.php$/'$_SERVER['SCRIPT_NAME'])):
      case (
    preg_match('/ajax\.php$/'$_SERVER['SCRIPT_NAME'])):
      case (
    preg_match('/shipstation_zc\.php$/'$_SERVER['SCRIPT_NAME'])):
      break; 
    Backup first!
    Last edited by frank18; 18 Jan 2015 at 11:06 AM.

  5. #5
    Join Date
    Jan 2015
    Location
    Canada
    Posts
    4
    Plugin Contributions
    0

    Default Re: Prevent redirect to log in page

    Quote Originally Posted by frank18 View Post
    Not familiar with Ship Station but just downloaded the add-on from the plugins and went through the code.
    There is really nothing in that file that would test for a redirection. IMHO that file serves only for administrative purposes and initiates the export of orders - am I right??
    Do you manually call that file (as in calling http://yourdomain.com/shipstation_zc.php) or is it called via cron?
    Yes basically the shipstation file is used to export the orders to the shipstation web application. If you do call http://yourdomain.com/shipstation_zc.php it normally would prompt you to enter admin login details.

    My init_customer_auth.php looks different around line 70. It is like in the following file http://www.zen-cart.com/docs/phpdoc-..._auth.php.html

    I did try changing the code you suggested in the equivalent spot but it did not work

    Code:
        // on special pages, allow customers to access regardless of store mode or cust auth mode
      case (preg_match('/ipn_main_handler\.php$/', $_SERVER['SCRIPT_NAME'])):
      case (preg_match('/ajax\.php$/', $_SERVER['SCRIPT_NAME'])):
      case (preg_match('/shipstation_zc\.php$/', $_SERVER['SCRIPT_NAME'])):
    
      break;
    I found a similar thread where the person was trying to stop the redirect for their homepage but I am not familiar with coding myself to adapt the changes to the shipstation_zc file

    http://www.zen-cart.com/showthread.p...-see-homepage*

  6. #6
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: Prevent redirect to log in page

    Does post #6 in the thread below have any relevance?

    http://www.zen-cart.com/showthread.p...50#post1269150
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  7. #7
    Join Date
    Jan 2015
    Location
    Canada
    Posts
    4
    Plugin Contributions
    0

    Default Re: Prevent redirect to log in page

    Quote Originally Posted by RixStix View Post
    Does post #6 in the thread below have any relevance?

    http://www.zen-cart.com/showthread.p...50#post1269150
    YES! that solved my problem

    I made the two changes that page suggested with the code frank18 recommended and it worked.

    Around line 55

    PHP Code:
    switch (true) {

    /**
      * bypass redirects for these scripts, to processing regardless of store mode or cust auth mode
      */
     
    case (preg_match('|_handler\.php$|'$_SERVER['SCRIPT_NAME'])):
     case (
    preg_match('|ajax\.php$|'$_SERVER['SCRIPT_NAME'])):
     case (
    preg_match('/shipstation_zc\.php$/'$_SERVER['SCRIPT_NAME'])):
     break;


      case (
    $down_for_maint_flag && DOWN_FOR_MAINTENANCE_TYPE == 'strict'): 
    and around line 111

    PHP Code:
    switch (true) {
    /**
     * check store status before authorizations
     */
      
    case (STORE_STATUS != 0):
        break;

     
    /**
      * bypass redirects for these scripts, to processing regardless of store mode or cust auth mode
      */
    case (preg_match('|_handler\.php$|'$_SERVER['SCRIPT_NAME'])):
    case (
    preg_match('|ajax\.php$|'$_SERVER['SCRIPT_NAME'])):
    case (
    preg_match('/shipstation_zc\.php$/'$_SERVER['SCRIPT_NAME'])):
    break;

      case (
    CUSTOMERS_APPROVAL_AUTHORIZATION == '1' and $_SESSION['customer_id'] == ''):
       */ 
    Thank you everyone for you help.

  8. #8
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Prevent redirect to log in page

    Quote Originally Posted by zc1000 View Post
    YES! that solved my problem

    I made the two changes that page suggested with the code frank18 recommended and it worked.

    Around line 55

    PHP Code:
    switch (true) {

    /**
      * bypass redirects for these scripts, to processing regardless of store mode or cust auth mode
      */
     
    case (preg_match('|_handler\.php$|'$_SERVER['SCRIPT_NAME'])):
     case (
    preg_match('|ajax\.php$|'$_SERVER['SCRIPT_NAME'])):
     case (
    preg_match('/shipstation_zc\.php$/'$_SERVER['SCRIPT_NAME'])):
     break;


      case (
    $down_for_maint_flag && DOWN_FOR_MAINTENANCE_TYPE == 'strict'): 
    and around line 111

    PHP Code:
    switch (true) {
    /**
     * check store status before authorizations
     */
      
    case (STORE_STATUS != 0):
        break;

     
    /**
      * bypass redirects for these scripts, to processing regardless of store mode or cust auth mode
      */
    case (preg_match('|_handler\.php$|'$_SERVER['SCRIPT_NAME'])):
    case (
    preg_match('|ajax\.php$|'$_SERVER['SCRIPT_NAME'])):
    case (
    preg_match('/shipstation_zc\.php$/'$_SERVER['SCRIPT_NAME'])):
    break;

      case (
    CUSTOMERS_APPROVAL_AUTHORIZATION == '1' and $_SESSION['customer_id'] == ''):
       */ 
    Thank you everyone for you help.
    Sounds like (if not already posted in the applicable support forum) that this issue be identified/addressed... Would be ideal if the installation instructions included the actions necessary for a store with this setup... Absolutely great that it got fixed though!
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v139h How to redirect admin page to the typed url after log in
    By navido in forum Customization from the Admin
    Replies: 1
    Last Post: 30 Nov 2015, 05:57 AM
  2. v150 Cannot log in after adding www. redirect to .htaccess file
    By coreyalderin in forum General Questions
    Replies: 34
    Last Post: 19 Dec 2012, 05:23 PM
  3. How to redirect a pseudo-static page using a 301 redirect ?
    By anahong in forum General Questions
    Replies: 1
    Last Post: 23 Jul 2010, 02:37 PM
  4. Prevent Redirect After Add To Cart, under certain conditions
    By andrew55 in forum Templates, Stylesheets, Page Layout
    Replies: 14
    Last Post: 26 Sep 2009, 08:50 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