Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Remove categories from front page

Remove categories from front page

Locked

Views: 1,855

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
24 Jul 2008, 3:28 AM
#1
bswinnerton avatar

bswinnerton

New Zenner

Join Date:
Jul 2008
Location:
Connecticut
Posts:
77
Plugin Contributions:
0

Remove categories from front page

Hey everyone,

Is there a way to remove the categories box from the front page, but have it on everything else?

I looked around the admin page but can't seem to find it.

24 Jul 2008, 4:25 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Remove categories from front page

bswinnerton:

Is there a way to remove the categories box from the front page, but have it on everything else?

I looked around the admin page but can't seem to find it.

In the current version there are no admin controls to selectively determine which page a certain sidebox will display on.

You'll have to edit your sidebox code to do that. Namely add a check for $this_is_home_page around all the logic in your custom version of /includes/modules/sideboxes/YOURTEMPLATE/categories.php

10 Aug 2008, 10:23 AM
#3
anniti avatar

anniti

New Zenner

Join Date:
May 2008
Posts:
33
Plugin Contributions:
0

Re: Remove categories from front page

DrByte:

You'll have to edit your sidebox code to do that. Namely add a check for $this_is_home_page around all the logic in your custom version of /includes/modules/sideboxes/YOURTEMPLATE/categories.php

Hi,
I did that, but the categories sidebox is showing anyway on the mainpage.

What did I do wrong?

regards, anna

10 Aug 2008, 11:41 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Remove categories from front page

anniti,

I did that, but the categories sidebox is showing anyway on the mainpage.
You might elaborate a bit more on what it is that you did???

10 Aug 2008, 1:59 PM
#5
anniti avatar

anniti

New Zenner

Join Date:
May 2008
Posts:
33
Plugin Contributions:
0

Re: Remove categories from front page

hi Kobra,
I added

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

<?php HERE!!!!! $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); ?>

regards, anna

10 Aug 2008, 1:59 PM
#6
stevesh avatar

stevesh

Black Belt

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

Re: Remove categories from front page

Mine does this properly, and the categories.php code looks like this: (Not sure why the code double-spaced when I pasted it.)

<?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);

}

?>
10 Aug 2008, 2:40 PM
#7
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,608
Plugin Contributions:
0

Re: Remove categories from front page

Your URL? What template are you using?

10 Aug 2008, 2:49 PM
#8
anniti avatar

anniti

New Zenner

Join Date:
May 2008
Posts:
33
Plugin Contributions:
0

Re: Remove categories from front page

hi Steve sh,
Thank you so much, now it works.
regards, anna