Forums / Templates, Stylesheets, Page Layout / Don't show some sideboxes on main page

Don't show some sideboxes on main page

Locked

Started by frank18 on 13 Feb 2010, 4:44 AM · Views: 1,768

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
13 Feb 2010, 4:44 AM
#1
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

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/index.php?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.....:frusty:

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

Appreciate your help

Frank

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

13 Feb 2010, 10:39 AM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

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:

<?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);
}
?>
13 Feb 2010, 11:05 AM
#3
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

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 :yuck:

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

13 Feb 2010, 11:29 AM
#4
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

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 https://www.frnt.org/personalnaturals :frusty::frusty::frusty:

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

13 Feb 2010, 12:02 PM
#5
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Don't show some sideboxes on main page

Don't forget this part:

if ($show_currencies == true)
{

rest of the file

}

13 Feb 2010, 12:20 PM
#6
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

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

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

13 Feb 2010, 12:47 PM
#7
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Don't show some sideboxes on main page

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

<?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);
    }
  }
[B]}[/B]
?>
13 Feb 2010, 1:03 PM
#8
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

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???.... :clap::clap:

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

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.