Zen Cart Logo
Forums / General Questions / Only certain categories go on the main page?

Only certain categories go on the main page?

Locked

Views: 769

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
4 Oct 2008, 11:29 PM
#1
diane22 avatar

diane22

New Zenner

Join Date:
Nov 2007
Posts:
33
Plugin Contributions:
0

Only certain categories go on the main page?

Ok, I get how to make all the categories show on the main page, and I get how to make none of them show... But how do I make only SOME show in the mainpage (while all remain in the sidebox)?

5 Oct 2008, 5:17 AM
#2
kobra avatar

kobra

Black Belt

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

Re: Only certain categories go on the main page?

What is the link to your site to see what you have?

5 Oct 2008, 4:11 PM
#3
diane22 avatar

diane22

New Zenner

Join Date:
Nov 2007
Posts:
33
Plugin Contributions:
0

Re: Only certain categories go on the main page?

https://www.fetchingdogcollars.com/wholesale

I want the 4 collar categories (3/4, 1, 1.5, and 2-inch) to remain on the main page AND the sidebox, but the leashes to only be in the sidebox.

5 Oct 2008, 5:57 PM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: Only certain categories go on the main page?

You can suppress display of a certain category in that page by editing
/includes/modules/your_template/category_row.php. Find this section:```php
// strip out 0_ from top level cats
$cPath_new = str_replace('=0_', '=', $cPath_new);

//    $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);

$list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
                                       'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'] . '</a>');

$col ++;
if ($col > (MAX_DISPLAY_CATEGORIES_PER_ROW -1)) {
  $col = 0;
  $row ++;
}
$categories->MoveNext();

}
}
?>
and add a test for category 7:php
// strip out 0_ from top level cats
$cPath_new = str_replace('=0_', '=', $cPath_new);

//    $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);
if ((int)$cPath_new !=7) { //display all but cat 7
$list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
                                       'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'] . '</a>');

$col ++;
} //display all but cat 7
if ($col > (MAX_DISPLAY_CATEGORIES_PER_ROW -1)) {
  $col = 0;
  $row ++;
}
$categories->MoveNext();

}
}
?>

5 Oct 2008, 10:33 PM
#5
diane22 avatar

diane22

New Zenner

Join Date:
Nov 2007
Posts:
33
Plugin Contributions:
0

Re: Only certain categories go on the main page?

Ok, I must be missing something. I put the new code in and nothing happened....

6 Oct 2008, 12:10 AM
#6
gjh42 avatar

gjh42

Black Belt

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

Re: Only certain categories go on the main page?

Add a debug line to make sure the test is accurate:

echo 'top cat id: ' . (int)$cPath_new; //debug
if ((int)$cPath_new !=7) { //display all but cat 7

Nevermind, the $cPath_new variable is going to be something like
cPath=7
which will never evaluate to just 7.
Change the line to

if ((int)str_replace('cPath=', '', $cPath_new) != 7) { //display all but cat 7