Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2005
    Posts
    77
    Plugin Contributions
    0

    customer issue Hide Items from non-registered users

    I am building a site and the client would like to hide certain items from users who are not logged in.

    EXAMPLE: Ask A Question (MOD) installed
    DISPLAY: Only for logged in users (otherwise hidden)

    I noticed that there is a switch in Admin/Email to "allow guest to tell a friend" and assume that this would work the same way but I'm not sure what code to add where.

    There are other items that may need this restriction so I'm wondering if there is a "standard" piece of HTML/PHP code I can insert into the template files to to check to see if the user is logged then display the content, if not logged in then hide the content?

    TEST LINK: http://70.85.24.162/index.php?main_p...&products_id=1

    THANK YOU ALL!!!

  2. #2
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: Hide Items from non-registered users

    http://www.zen-cart.com/forum/showth...hlight=members
    Above previous forum post may help

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default Re: Hide Items from non-registered users

    Remember too that certain abilities to hide things are already built in to Zen Cart; try out Admin->Configuration->Customer Details->Customer Shop Status - View Shop and Prices to see some of the possible variants.

    To address your example specifically, AAQ is probably not something you want to only allow customers to do - you'll have more conversions if guests can ask about your products without having to create an account. TAF is (optionally) login restricted to keep spammers from exploiting your site.

    Good luck,
    Scott
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Nov 2005
    Posts
    77
    Plugin Contributions
    0

    Default Re: Hide Items from non-registered users

    Quote Originally Posted by misty View Post
    Thanks misty for pointing me in the right direction. I added bunyip's code (see below) and with a few modifications I was able to hide certain content from non-users. THANKS AGAIN!!!

    <-----START CODE--->
    if ($_SESSION['customer_id']) {
    // display this link for logged in user
    echo '<a href="http://www.yoursite.com">Link</a>';
    } else {
    //display something else for user not logged in
    echo 'you\'d see a cool link here if you were logged in';
    }
    <-----END CODE--->

  5. #5
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: Hide Items from non-registered users

    Thanks misty for pointing me in the right direction.
    No problem, glad to hear you achieved required result

  6. #6
    Join Date
    Dec 2006
    Posts
    7
    Plugin Contributions
    0

    Default Re: Hide Items from non-registered users

    I kind of want to do the same thing as kgmmusic (i.e. hide info from guests), except the only information I want to hide is the price. And I only want to hide the prices of certain products from browsers, but allow them to see the prices of other products. Is there a way to do this?

  7. #7
    Join Date
    Jun 2006
    Posts
    57
    Plugin Contributions
    0

    Default Re: Hide Items from non-registered users

    only for certain products, which are controlled by their ID(or group like manufacturer), sounds to me that ZC requires that reference, be it a new database table, a read file like defines, or another field in products table(db) like hide_price_from_guest(boolean).

    it's after that when you start placing a code like...

    if (($_SESSION['customer_id']) && (zen_get_hide_value((int)$_GET['products_id'])) {


    note: the zen_get_hide_value is only a sample custom function.

  8. #8
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,622
    Plugin Contributions
    123

    Default Re: Hide Items from non-registered users

    FYI: it's not a good practice to preface custom function names with "zen_." Imagine how unhappy you'd be if in the next release the core team creates a function with the same name! Just use regular names instead.

    Scott
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  9. #9
    Join Date
    Dec 2006
    Posts
    7
    Plugin Contributions
    0

    Default Re: Hide Items from non-registered users

    Quote Originally Posted by redxiii View Post
    only for certain products, which are controlled by their ID(or group like manufacturer), sounds to me that ZC requires that reference, be it a new database table, a read file like defines, or another field in products table(db) like hide_price_from_guest(boolean).

    it's after that when you start placing a code like...

    if (($_SESSION['customer_id']) && (zen_get_hide_value((int)$_GET['products_id'])) {


    note: the zen_get_hide_value is only a sample custom function.
    Thanks for the hint, but not being well versed in PHP, I don't know how exactly to apply this. Could you give me a general step by step on how to implement it? (i know that each database/store is going to be different, but maybe you know generally how I can do this)

 

 

Similar Threads

  1. Replies: 2
    Last Post: 5 Jun 2010, 07:14 PM
  2. Hide certain products from a group of users
    By mohammedsk in forum Basic Configuration
    Replies: 4
    Last Post: 29 Dec 2009, 06:31 AM
  3. Can I prevent registered users from seeing prices until authorized?
    By oavs in forum Managing Customers and Orders
    Replies: 1
    Last Post: 9 Dec 2009, 01:36 PM
  4. How to hide Information page from non registerested guest?
    By sdkhoo in forum Basic Configuration
    Replies: 3
    Last Post: 9 Nov 2009, 09:23 PM
  5. hide elements from non-members??
    By slappadudle in forum General Questions
    Replies: 6
    Last Post: 3 Jul 2009, 05:42 AM

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