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

    Default Don't show some sideboxes on main page

    I am trying to suppress the display of some sideboxes on the main page (home page), namely

    currencies
    information
    more information
    editable sidebox (heading "Shop with Confidence")

    Currencies sidebox as example:

    Using the tutorial https://www.zen-cart.com/tutorials/i...hp?article=270 I added the following code to /includes/modules/sideboxes/MY_TEMPLATE/currencies.php


    // test if box should display
    $show_currencies = true;

    // do not show on home page
    if ($this_is_home_page) {
    $show_currencies = false;
    }
    This does not work for me.

    Then tried this
    if ((isset($_GET['main_page']) && $_GET['main_page'] == 'index') && (isset($_GET['cPath']) && ($_GET['cPath'] == '1' || $_GET['cPath'] == '2')))
    {
    $show_currencies = TRUE;
    } else
    {
    $show_currencies = FALSE;
    }
    same result: no go!

    I have used similar code on other sideboxes for SSL and NONSSL pages without problems but can't work out what I am doing wrong with these boxes.....


    URL www.frnt.org/personalnaturals
    ZC 1.3.8.a with loads of add-ons
    template cold_steel


    Appreciate your help

    Frank

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Don't show some sideboxes on main page

    Here's how it works for the categories.php file to not show the Categories sidebox on the main page - should be the same for other boxes:

    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 $
     */
      if ($this_is_home_page) {
        $show_categories = false;
      } else {
        $show_categories = true;
      }
    
      if ($show_categories == true)
    {
        $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);
    }
    ?>

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

    Default Re: Don't show some sideboxes on main page

    if ($this_is_home_page) {
    $show_categories = false;
    } else {
    $show_categories = true;
    }
    Gee, stevesh, this is exactly what I did in first place for the currencies box, but the relevant box still showed up!! - even after using my good old fashioned Netscape browser which clears all history, cookies and all that jazz when I shut the browser down.

    I'll give it another go for the relevant file(s) - may be a bit 'over-zenned' today

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

    Default Re: Don't show some sideboxes on main page

    The first few lines of my currencies.php (path as per my first post) file looks like this
    <?php

    /**
    * currencies sidebox - allows customer to select from available currencies
    *
    * @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: currencies.php 2834 2006-01-11 22:16:37Z birdbrain $
    */

    if ($this_is_home_page) {
    $show_currencies = false;
    } else {
    $show_currencies = true;
    }
    the box still shows up on my home page www.frnt.org/personalnaturals

  5. #5
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Don't show some sideboxes on main page

    Don't forget this part:

    if ($show_currencies == true)
    {

    rest of the file

    }

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

    Default Re: Don't show some sideboxes on main page

    that part is actually there:

    <?php

    /**
    * currencies sidebox - allows customer to select from available currencies
    *
    * @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: currencies.php 2834 2006-01-11 22:16:37Z birdbrain $
    */

    if ($this_is_home_page) {
    $show_currencies = false;
    } else {
    $show_currencies = true;
    }

    // don't display on checkout page:
    if (substr($current_page, 0, 8) != 'checkout') {
    $show_currencies= true;
    }


    if ($show_currencies == true) {

    rest of the file
    I'm stumped

  7. #7
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Don't show some sideboxes on main page

    You're still missing one curly brace - this works for me:

    Code:
    <?php
    /**
     * currencies sidebox - allows customer to select from available currencies
     *
     * @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: currencies.php 2834 2006-01-11 22:16:37Z birdbrain $
     */
    
      if ($this_is_home_page) {
        $show_currencies = false;
      } else {
        $show_currencies = true;
      }
    
      if ($show_currencies == true)
    {
    // test if box should display
      $show_currencies= false;
    
      // don't display on checkout page:
      if (substr($current_page, 0, 8) != 'checkout') {
        $show_currencies= true;
      }
    
      if ($show_currencies == true) {
        if (isset($currencies) && is_object($currencies)) {
    
          reset($currencies->currencies);
          $currencies_array = array();
          while (list($key, $value) = each($currencies->currencies)) {
            $currencies_array[] = array('id' => $key, 'text' => $value['title']);
          }
    
          $hidden_get_variables = '';
          reset($_GET);
          while (list($key, $value) = each($_GET)) {
            if ( ($key != 'currency') && ($key != zen_session_name()) && ($key != 'x') && ($key != 'y') ) {
              $hidden_get_variables .= zen_draw_hidden_field($key, $value);
            }
          }
    
          require($template->get_template_dir('tpl_currencies.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_currencies.php');
          $title =  '<label>' . BOX_HEADING_CURRENCIES . '</label>';
          $title_link = false;
          require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . 
    
    $column_box_default);
        }
      }
    }
    ?>

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

    Default Re: Don't show some sideboxes on main page

    Just copied your whole file as above and uploaded it to my templates folder and guess what???....

    Gee - talk about 'over-zenned' for the day.

    Thanks a zillion stevesh !!

    Now it's a matter of adapting the same procedure for the 'information' and 'more_information' (in my case 'Resources') boxes. But that may be a matter for after Valentine's day - or it spells D.I.V.O.R.C.E.

    Thanks again stevesh

 

 

Similar Threads

  1. v153 Attribute Images - Some Show, Some Don't
    By Dianne in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 23 Mar 2015, 02:39 PM
  2. Multiple Images for product - some show, some don't
    By DivaNU in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 12 Dec 2010, 06:56 PM
  3. Site moved, now sidebox and footer don't show on main page
    By aesthetics in forum General Questions
    Replies: 3
    Last Post: 4 Nov 2009, 11:59 PM
  4. some categories show, some don't
    By Kristina in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 14 Aug 2009, 06:59 PM
  5. Sideboxes don't appear on some pages - WHY?
    By butchx5 in forum Basic Configuration
    Replies: 3
    Last Post: 21 Feb 2009, 04:14 PM

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