Results 1 to 10 of 11

Hybrid View

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

    Default Password protecting a category

    I am referring to this search/thread:

    http://www.zen-cart.com/forum/showth...ord+protection


    I also need to password protect one specific category in my cart.

    I have copied Ajeh's code (posted 11th October 2007, 05:49 AM) from the thread as above and changed the category id to 36 (which is the one I want to protect). The category is called "Practitioner Only".

    Then I tried to insert the code into various sections in the file

    /includes/index_filters/default_filter.php

    Every time I do this I am getting a parse error.

    Could anyone please tell me where exactly (which line or lines) the code needs to be inserted in order to work properly.

    Thank you all and happy zenning!

    Frank

    www.frnt.org/zencart/

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Password protecting a category

    You might add to your post your details like the version of zencart you have etc.

    What you have attempted

    What template you are using
    Modules you have installed

    a link to your site

    Any other pertinent info
    Zen-Venom Get Bitten

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

    Default Re: Password protecting a category

    I am attempting to restrict access of users to one specific category. The user must be logged in or must register before they can access the category (ie. see images, descriptions and all..)

    In my original post above I have referred to a similar problem by another zenner. Ajeh posted an answer to the other zenner's question but I don't know where exactly I need to insert the code provided by Ajeh - please click the link in my original post for more info.

    My version is 1.3.7

    I am using a custom template (incidentally is called 'custom' ).

    Other modules installed are

    SMS on order
    Google analytics

    A link to my site is also on my original post.

    Thanks / Frank

    PS will be offline until tomorrow morning Aussie time.

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

    Default Re: Password protecting a category

    I have been experimenting with a few ideas in the past week, mainly concentrating on the file .../includes/index_filters/default_filter.php

    I feel that it is this file where I need to insert an "if" statement with these 2 conditions:

    1. customer clicks on category id = 36 (Practitioner Only)

    and

    2. customer is not logged on


    --> redirect customer to the login page.


    If the customer is logged on they can view category id = 36 , no further questions asked.


    Does anyone have an idea how this problem can be solved??


    Any help is much appreciated.

    Frank


    frnt.org

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

    Default Re: Password protecting a category

    I have made some progress since my last post.

    (BACKUP, BACKUP, BACKUP before you do any of this....)


    1. Redirecting a customer to the login page when they click on a specific manufacturer:


    modify the file /includes/index_filters/default_filter.php as follows:

    after the first

    if (!isset($select_column_list)) $select_column_list = "";
    insert this code


    //if the customer calls for a specific manufacturer a n d the customer is not logged in
    //then redirect them to the login page

    if (!$_SESSION['customer_id'] && (isset($_GET['manufacturers_id']) && $_GET['manufacturers_id'] = '1' )) {
    $_SESSION['navigation']->set_snapshot();
    zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
    }
    this works perfectly.

    If you want to use this code then just replace the '1' with the manufacturers id you want to block. Pre-condition: the products to block must have a manufacturer assigned to them.


    2. Redirecting a customer to the login page when they click on a specific category:

    have tried anything and everything known to me in the file /includes/index_filters/default_filter.php with no avail.

    then stumbled over the file /includes/functions/functions_categories.php

    and inserted before

    return 'cPath=' . $cPath_new;
    this code

    if (!$_SESSION['customer_id'] && ($cPath_new = '36')) {
    $_SESSION['navigation']->set_snapshot();
    zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
    }
    Clicking on the category with id=36 (Practitioner Only) produces the desired result: the customer is redirected to the login page. Upon testing the other categories all work fine (without redirection) except for the categories "Gift Certificates" and "Supplements (all)" - clicking on these 2 cats ALSO produces a redirection. That's not what I want, these 2 cats are "Free For All" - no hiding or redirecting required.

    What the am I doing wrong?


    To refresh your memories:

    I am using v Zen Cart 1.3.7.1

    the URL of my site is www.frnt.org/zencart/

    Can anyone help please??

    Once it's all done (with your kind help) I am planning to produce a mod and post it in the "Downloads" section for all to use at their pleasure (and risk).


    Thanks heaps,

    Frank
    Last edited by frank18; 2 Mar 2008 at 12:13 PM. Reason: need notification of reply

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Password protecting a category

    frank18,

    Thanks for sharing what you have discoverd for others that might also be seeking something along this line...
    Zen-Venom Get Bitten

 

 

Similar Threads

  1. v150 Password protecting subcategories?
    By forbish07 in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 6 Sep 2012, 03:51 AM
  2. Password Protecting my site
    By nic678dog in forum General Questions
    Replies: 3
    Last Post: 31 Mar 2009, 06:02 PM
  3. Password Protecting a subdomain?
    By datatv in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 2 Oct 2008, 12:58 AM
  4. Password Protecting a Category URL?
    By datatv in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 21 Sep 2008, 10:36 PM
  5. Password Protecting a category
    By jewelsbyjewls in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 27 Nov 2006, 07:52 AM

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