Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Join Date
    May 2015
    Posts
    23
    Plugin Contributions
    0

    customer issue Can I remove certain sideboxes on certain pages?

    Hello folks. I'm currently putting together a site. Zencart using Version 155. Westminster New template.

    Maybe this is a simple question, but I've spent all day trying to figure it out.

    Apart from the main index page, every page has the left sidebox detailing Categories, What's New, Reviews, et al.

    What I want to do is remove this sidebox on certain pages. I've been reading about templates all night /includes/templates.......

    I'm thinking the answer lies in an override, or maybe a custom template. For the life of me I cannot figure it out.

    I'll keep on studying and tinkering, but can someone point me in the right direction?

    I saw this site https://www.picaflor-azul.com/blog/c...xes-tutorials/

    It mentions...

    Code:
    Find this line of code:
    
    
       if ($show_shopping_cart_box == true) {
    
    And just above it, add this:
    
    
         if ($show_shopping_cart_box == true) { 
            if (($current_page_base == "shopping_cart") || 
                ($current_page_base  == "account_history_info") ||
                ($current_page_base  == "checkout") ||
                ($current_page_base  == "checkout_payment") ||
                ($current_page_base  == "checkout_confirmation") 
               ) { 
                  $show_shopping_cart_box = false;
            }
         }
    
    And edit it to indicate the pages on which you wish to disable the shopping cart sidebox.
    But even then I cannot figure it out.

    Help.

    Thanks a lot, folks.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Can I remove certain sideboxes on certain pages?

    Well, the general information needed is certainly there, it's just putting it together.

    So, let's take the categories sidebox as an example (first listed in the above post as a sidebox displayed on every page).

    So, also, let's assume that the goal is to display it on every page except the shopping_cart and checkout_shipping pages (more than one page on which to hide it).

    You can see the default sidebox definition in includes/modules/sideboxes/categories.php...

    So, first thing about modifying one of the default files is where able to use an override version of the file in which to make edits, that way you will still have the "original" available and can mark it up to do what you want done under your current template. So you would copy the file categories.php found in the above path to: includes/modules/sideboxes/YOUR_TEMPLATE/ where YOUR_TEMPLATE is the foldername associated with the template to which the changes are to apply. (override path).

    Then, you would access that file using a plain text editor to make the changes desire.

    Now, looking at this particular file, there are no such if true then display/load this page/sidebox options in the code. Essentially, this particular sidebox appears to have been written to always appear whenever it is possible to be displayed. So, in order to limit this particular sidebox from being displayed, additional code would need to be added around it to offer such an on/off feature.

    Recommendation would be to add between the end of the top commented area and the first line of code, something like:

    Code:
     $show_categories_box = true;
    
    if ($current_page_base == FILENAME_SHOPPING_CART ||
        $current_page_base == FILENAME_CHECKOUT_SHIPPING) {
         $show_categories_box = false;
    }
    
    if ($show_categories_box) {
    Then at the end of the file just before the unnecessary close of the php open tag, add:
    Code:
    } // eof close of if should show this box
    And then add any additional commenting needed to understand in the future why this was changed.

    The end result is, if the current page (main_page=xxx) isn't xxx then the categories sidebox will be displayed. If the current page is yyy and yyy is in the list of the if statement, then it will not be displayed.

    Now, why was FILENAME_xxx used? In a standard non-edited cart, FILENAME_SHOPPING_CART is assigned: 'shopping_cart', but that could be modified if/when desired. By using the constant reference, it doesn't matter to what the constant is assigned, all coded references to that page will end up using the newly assigned value. Generally speaking such references are provided in includes/filenames.php, but they too can be overridden or added to by placement of a file with the desired define in includes/extra_configures.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    May 2015
    Posts
    23
    Plugin Contributions
    0

    Default Re: Can I remove certain sideboxes on certain pages?

    Fantastic, absolutely fantastic.

    Thanks a lot. I'll put it together tonight. I'm bound to make a mistake, so I'll probably ask more questions..

    Zencart, I love it.

    Thanks again, I'll get back to everyone with me results.

  4. #4
    Join Date
    Jan 2015
    Location
    Houston
    Posts
    26
    Plugin Contributions
    0

    help question Re: Can I remove certain sideboxes on certain pages?

    Hi, I may be missing something, I applied the above code to the iincludes/modules/sideboxes/responsive_apparel_boutique/categories.php of my Zen Cart.... it has not worked. Running v155d
    Here is the modified code:

    HTML Code:
    <?php
    /**
     * categories sidebox - prepares content for the main categories sidebox
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: categories.php 2718 2005-12-28 06:42:39Z drbyte $
     */
     $show_categories_box = true;
    
    if ($current_page_base == FILENAME_SHOPPING_CART ||
        $current_page_base == FILENAME_CHECKOUT_SHIPPING) {
         $show_categories_box = false;
    }
    
    if ($show_categories_box) {
    
        $main_category_tree = new category_tree;
        $row = 0;
        $box_categories_array = array();
    
    // don't build a tree when no categories
        $check_categories = $db->Execute("select categories_id from " . TABLE_CATEGORIES . " where categories_status=1 limit 1");
        if ($check_categories->RecordCount() > 0) {
          $box_categories_array = $main_category_tree->zen_category_tree();
        }
    
        require($template->get_template_dir('tpl_categories.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_categories.php');
    
        $title = BOX_HEADING_CATEGORIES;
        $title_link = false;
    
        require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    } // eof close of if should show this box
    ?>
    Any idea as to what I have missed? Thanks in advance for your assistance.
    H

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: Can I remove certain sideboxes on certain pages?

    When you say "it has not worked", in what way does it "not work"?

  6. #6
    Join Date
    Jan 2015
    Location
    Houston
    Posts
    26
    Plugin Contributions
    0

    Default Re: Can I remove certain sideboxes on certain pages?

    Quote Originally Posted by lat9 View Post
    When you say "it has not worked", in what way does it "not work"?
    Site is https://guiltypleasures4you.com/lingerie
    I wanted to remove the side boxes from the shopping cart, pages are too busy, and the shipping page but the sideboxes are still there. Just need to understand what code needs to be added to remove them only on these pages.

    I have a test profile you can use if you want to check it out email: [email protected] pw: goodguy

    Thanks, H

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

    Default Re: Can I remove certain sideboxes on certain pages?

    In includes/templates/responsive_classic/common/tpl_main_page.php, there's a block of code that looks like this:

    Code:
    // the following IF statement can be duplicated/modified as needed to set additional flags
    if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
      $flag_disable_right = true;
    }
    in 1.5.5e this is lines 52-55.

    Copy this file to includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php if it's not there already.

    Change it to

    Code:
    if (in_array($current_page_base,explode(",",'shopping_cart,checkout_shipping,checkout_payment,checkout_confirmation')) ) {
      $flag_disable_right = true;
      $flag_disable_left = true;
    }
    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.

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

    Default Re: Can I remove certain sideboxes on certain pages?

    For the individual sidebox (instead of the entire side) I would suggest verifying that the sidebox in question is the correct one of concern by any of a number of ways: one, temporarily add an additional echo statement within the file, two: inspect the list of sideboxes in admin tools->layout boxes controller: files at top (above bar line) show on left side, files on bottom (below bar line) on right side. Perhaps more than one file provides functionality of a categories type box. The information associated with each box should give some assistance of identifying what box it is and which file(s) are involved with the specific box.

    Otherwise the general all sidebox on this side or that side to be hidden is a great start for the "hide all" type direction. It's quick, relatively easy, and doesn't require picking and choosing specific sideboxes or verifying display code. It's when/if there is still that "one" box desired to be displayed that things get a little more involved. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Jan 2015
    Location
    Houston
    Posts
    26
    Plugin Contributions
    0

    Default Re: Can I remove certain sideboxes on certain pages?

    Quote Originally Posted by swguy View Post
    ...

    Copy this file to includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php if it's not there already.

    Change it to

    Code:
    if (in_array($current_page_base,explode(",",'shopping_cart,checkout_shipping,checkout_payment,checkout_confirmation')) ) {
      $flag_disable_right = true;
      $flag_disable_left = true;
    }
    Humm, thanks, but didn't work with responsive_apparel_boutique template ??? Not sure what happened as I got a blank screen. Applied my backup and all was well. I saw how that should have worked but the responsive_apparel_boutique/common/tpl_main_page.php looks totally different from the classic responsive.
    Any other suggestions? and again thanks for your help.
    H

  10. #10
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Can I remove certain sideboxes on certain pages?

    Quote Originally Posted by K_C_Enterprises View Post
    Humm, thanks, but didn't work with responsive_apparel_boutique template ??? Not sure what happened as I got a blank screen. Applied my backup and all was well. I saw how that should have worked but the responsive_apparel_boutique/common/tpl_main_page.php looks totally different from the classic responsive.
    Any other suggestions? and again thanks for your help.
    H
    After it not working by possibly copying and pasting, did you happen to try manually typing in the recommended code? Sometimes when trying to provide assistance with specific code, extraneous characters get "captured" when copying and pasting to either post the code or to pull it from the forum. Also, there should have been a log entry made to help debug the situation: http://www.zen-cart.com/content.php?124-blank-page
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Rearranging Sideboxes on Certain Pages
    By McLovin in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 23 Feb 2015, 03:03 PM
  2. Why is sideboxes out of side on certain pages
    By navido in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 7 Oct 2011, 03:24 AM
  3. hide sideboxes on certain pages?
    By sheila123 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Sep 2009, 01:58 PM
  4. Remove sideboxes from certain pages?
    By chrisj in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 28 Aug 2006, 10:40 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