Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How to Just turn off Categories on Front page ?

How to Just turn off Categories on Front page ?

Views: 12,118

Results 1 to 7 of 7
15 Mar 2013, 1:43 PM
#1
psvialli avatar

psvialli

New Zenner

Join Date:
Mar 2011
Posts:
76
Plugin Contributions:
0

How to Just turn off Categories on Front page ?

I have removed Categories off my main Page but I cannot seem to get them to work on any other page now ,

I went to Tool>Layout box control> then turned off sideboxes/document_categories.php

have tried Layout settings : Categories - Always Show on Main Page to 0 but still shows on main page

I just wanted to turn them off on the main page ?

Thanks

15 Mar 2013, 4:36 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to Just turn off Categories on Front page ?

Turning off the document-categories sidebox will hide it everywhere, but that is not what displays the regular categories anyway.
Layout settings : Categories - Always Show on Main Page to 0
will stop the categories display in the center column of the homepage; it has nothing to do with the categories sidebox.

What exactly do you want to show and not show on home and other pages? A link to see the current behavior may help us advise correctly.

15 Mar 2013, 5:16 PM
#3
psvialli avatar

psvialli

New Zenner

Join Date:
Mar 2011
Posts:
76
Plugin Contributions:
0

Re: How to Just turn off Categories on Front page ?

Hi,

The temp link is :http://www.quantumistic.co.uk/claimsprotectiondata.co.uk/

I am trying to just get the Side Categories on the Products page , so every page apart from the Front page.

I have set Always Show on Main Page to 0

but it still shows ?

Thanks

15 Mar 2013, 6:17 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to Just turn off Categories on Front page ?

As I said, the "Always Show on Main Page" refers to the center column, not the sidebox. For this, you need to add a test to the categories sidebox module file, /includes/modules/sideboxes/your_template/categories.php (copy it from /includes/modules/sideboxes/categories.php if it is not there already). Something like this (add the parts in red)

//the heading comments

if (!$this_is_home_page) {

//the module processing code

}
?> (end of the file)
15 Mar 2013, 10:04 PM
#5
psvialli avatar

psvialli

New Zenner

Join Date:
Mar 2011
Posts:
76
Plugin Contributions:
0

Re: How to Just turn off Categories on Front page ?

Thanks,

This is what i have but it still shows up , if I remove all and just put in your code it removes it from All pages.

Sorry what am i doing wrong ?

<?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 $
 */

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




if (!$this_is_home_page) {

//the module processing code

}


?>
15 Mar 2013, 10:44 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to Just turn off Categories on Front page ?

Umm... you were supposed to put the parts in the places I described, not just paste the whole thing at the end of the file - that does nothing.
The
if (!$this_is_home_page) {
goes in here:

 * @version $Id: categories.php 2718 2005-12-28 06:42:39Z drbyte $
 */

  if (!$this_is_home_page) {

    $main_category_tree = new category_tree;

and the
}
goes where you put at the end.
The comment
//the module processing code
is a placeholder for all of the code in the middle of the file, not literal.

15 Mar 2013, 11:41 PM
#7
psvialli avatar

psvialli

New Zenner

Join Date:
Mar 2011
Posts:
76
Plugin Contributions:
0

Re: How to Just turn off Categories on Front page ?

Ahhh very new to this !

Works a treat many thanks indeed for your help!