Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    May 2010
    Posts
    36
    Plugin Contributions
    0

    Default Hiding New products to unauthorised customers

    Hi,
    On my store i wish to hide the "new products" box from unauthorised customers. I know i can set "Customer Shop Status - View Shop and Prices" to 1 in the admin panel but that completely removes all the side boxes which i dont want to do.

    I have done some searches but cant find anything that fits my needs. I saw people suggesting to use the code:
    PHP Code:
    $show_categoriesfalse;

    if (!
    $_SESSION['customer_id']) {
      
    // run the code
        
    $show_categoriestrue;
    } else {
    // do not run the code
      
    $show_categoriesfalse;
    }  

    if (
    $show_categories == true) { 
    but i have no idea where i would put that. My guess would be in the whats_new.php but then i dont know where to put it in there. (i know the variable would change in this statement).

    I would be grateful of any help.

    Thanks

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Hiding New products to unauthorised customers

    Do you want to block the New Sidebox from Customers not logged in or not logged in and not Approved?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    May 2010
    Posts
    36
    Plugin Contributions
    0

    Default Re: Hiding New products to unauthorised customers

    I would like to block it from anyone not logged in and not approved. I would be very happy if this is achievable.

    Thanks

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Hiding New products to unauthorised customers

    Code:
      if ($_SESSION['customers_authorization'] != xx && $random_whats_new_sidebox_product->RecordCount() > 0 ) {
    where XX is the value you want used ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    May 2010
    Posts
    36
    Plugin Contributions
    0

    Default Re: Hiding New products to unauthorised customers

    Where do i put this code? Is it in whats_new.php?
    Im not really sure what to do with it. I've tried putting it in whats_new.php but with no luck. I doesnt show the sidebox to customers not logged in (which is a start) but when an unauthorised user logs in they can see the sidebox.

    Thanks
    Last edited by alexsmith2709; 24 May 2010 at 02:25 PM.

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Hiding New products to unauthorised customers

    This is for the sidebox ...

    In the file:
    /includes/modules/sideboxes/your_template_dir/whats_new.php

    You should use the code:
    Code:
    //  if ($random_whats_new_sidebox_product->RecordCount() > 0 ) {
      if ($_SESSION['customer_id'] && $_SESSION['customers_authorization'] == 0 && $random_whats_new_sidebox_product->RecordCount() > 0 ) {
    I left out the $_SESSION['customer_id'] ...

    Or you could code that to test if the $_SESSION['customers_authorization'] is set and if it is equal to 0 ... either way should work ...

    You can adapt the code for other areas of the Catalog ...

    On some of the code, you will also need to determine if the Products are considered new or not ...

    You can look in the New Product Module in the:
    /includes/modules/new_products.php

    to see how it tests for new products ...

    For the module itself, you can again turn it off based on the IF that is used in the whats_new.php sidebox ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. v150 WHATS NEW CATAGORY HELP .. hiding certain products
    By jgirl5799 in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 6 Aug 2012, 02:32 AM
  2. v139h Hiding categories from specific customers/countries
    By igi2011 in forum General Questions
    Replies: 0
    Last Post: 22 Mar 2012, 10:45 AM
  3. Hiding New Products/All Products pages...
    By bubblegumgoods in forum General Questions
    Replies: 3
    Last Post: 6 Aug 2009, 03:31 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