Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2007
    Posts
    117
    Plugin Contributions
    1

    Default Sidebox shows only after login

    I would like to make several of my sideboxes to show up only to individuals that are logged in. I would prefer that guests to my site not be able to see these boxes.

    Is this possible? And how would I do it?

    Thanks for any help.

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Sidebox shows only after login

    It's both possible and straightforward. Just four simple steps.

    1. Locate the module for the sidebox (or boxes) that you want to treat like this. You'll find them in includes/modules/sideboxes.

    2. Create over-ride files for them by copying them to includes/modules/sideboxes/YOUR_TEMPLATE_NAME.

    3. Open the over-ride file and find a couple of lines that look similar to
    // test if box should display
    $show_featured= true;
    These were taken from the featured_products products sidebox and the variable name for your box will probably differ slightly. Then change them to
    // test if box should display
    if (!$_SESSION['customer_id']) {
    $show_featured= false;
    } else {
    $show_featured= true;
    }
    4. Upload to your server and enjoy.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Apr 2007
    Posts
    117
    Plugin Contributions
    1

    Default Re: Sidebox shows only after login

    Here is the code. I do not see the //test if box should display. I tried adding it to the begining of the code. That didn't work. I tried changing 'require' to 'if'. That didn't work. It did remove it from the main page but after I logged in, I couldn't see it either. I looked at some of the other php files to try and figure out what I needed to add but I am not a programmer.

    This php file is from the Wordpress on Zencart Mod.

    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2004 The zen-cart developers |
    // | |
    // | http://www.zen-cart.com/index.php |
    // | |
    // | Portions Copyright (c) 2003 osCommerce |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license, |
    // | that is bundled with this package in the file LICENSE, and is |
    // | available through the world-wide-web at the following url: |
    // | http://www.zen-cart.com/license/2_0.txt. |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to |
    // | license AT zen-cart DOT com so we can mail you a copy immediately. |
    // +----------------------------------------------------------------------+

    require($template->get_template_dir('tpl_wp_archives.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_wp_archives.php');

    $title = BOX_HEADING_WP_ARCHIVES;
    $left_corner = false;
    $right_corner = false;
    $right_arrow = false;
    $title_link = false;

    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    ?>

  4. #4
    Join Date
    Oct 2004
    Location
    Southport, UK
    Posts
    4,244
    Plugin Contributions
    20

    Default Re: Sidebox shows only after login

    Don't forget to change $show_featured to $show_whatever
    Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
    20 years with Zencart !

  5. #5
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Sidebox shows only after login

    The problem here is that the sidebox that you're using is not designed for use with Zen Cart 1.3.x. All that $left-corder, $right-corner stuff shows that it was derived from an earlier tables-based version and therefore doesn't follow the proper structure for the current series.

    It's not to difficult to update though. Just use one of the current sideboxes as a model.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  6. #6
    Join Date
    Apr 2007
    Posts
    117
    Plugin Contributions
    1

    Default Re: Sidebox shows only after login

    Thank you to kuroi and Ryk for your help. I really do appreciate your responses. Due to my lack of programming skills, I had to find additional help in the Wordpress on Zencart thread.

    And here is the solution without having to rewrite the code. Thank you misty......

    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2004 The zen-cart developers |
    // | |
    // | http://www.zen-cart.com/index.php |
    // | |
    // | Portions Copyright (c) 2003 osCommerce |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license, |
    // | that is bundled with this package in the file LICENSE, and is |
    // | available through the world-wide-web at the following url: |
    // | http://www.zen-cart.com/license/2_0.txt. |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to |
    // | license AT zen-cart DOT com so we can mail you a copy immediately. |
    // +----------------------------------------------------------------------+
    require($template->get_template_dir('tpl_wp_archives.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_wp_archives.php');
    $title = BOX_HEADING_WP_ARCHIVES;
    $left_corner = false;
    $right_corner = false;
    $right_arrow = false;
    $title_link = false;
    //Comment in next line if only registered members can view this sidebox
    if ($_SESSION['customer_id'] != '')
    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    ?>


    Please take note of everything from //Comment in next line....


    Once again, thank you everyone for your help.

 

 

Similar Threads

  1. Replies: 6
    Last Post: 14 Jan 2016, 01:01 PM
  2. v154 After upgrade only header shows, no errors in logs
    By aestheticdesign in forum Upgrading to 1.5.x
    Replies: 3
    Last Post: 24 Jan 2015, 10:55 PM
  3. Only display after Login
    By vishalon in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Feb 2010, 11:56 AM
  4. Customer Login page shows up blank-after security changes
    By heygretchen in forum General Questions
    Replies: 2
    Last Post: 23 Dec 2009, 01:40 AM
  5. Site only shows login page
    By seeinstars89 in forum General Questions
    Replies: 6
    Last Post: 24 Jan 2009, 01:11 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