I need help got the Category Dressing working pretty well, but theres a couple of issues.
1) Now all my icons next to each category has disappeared?
I have more, but lets attack one at a time, please help, this is urgent!
Do you have BetterCategories installed? It modifies some of the same code as this, so they would need to be carefully integrated, and might not be completely compatible.
What method/code did you use to get the icons?
no I don' thave better cat installed, here is the orignal code that had the icons next to each cat for tpl_categories.php Let me know what you think. THanks for your help!
<?php
/**
* Side Box Template
*
* @package templateSystem
* @copyright Copyright 2003-2006 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: tpl_categories.php 3157 2006-03-10 23:24:22Z drbyte $
*/
//$content_tm = '';
//$content_head = tm_box_head(BOX_HEADING_CATEGORIES,'','style3');
$content_tm .= '<ul class="ul2">
';
for ($i=0;$i<sizeof($box_categories_array);$i++) {
if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {
$content_tm .= '<li><a href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
if ($box_categories_array[$i]['current']) {
if ($box_categories_array[$i]['has_sub_cat']) {
$content_tm .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . '</span>';
} else {
$content_tm .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>';
}
} else {
$content_tm .= $box_categories_array[$i]['name'];
}
if ($box_categories_array[$i]['has_sub_cat']) {
$content_tm .= CATEGORIES_SEPARATOR;
}
if (SHOW_COUNTS == 'true') {
if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
$content_tm .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
}
}
$content_tm .= '</a></li>';
// if($i + 1 != sizeof($box_categories_array))
// $content_tm .= '<br /><div class="cat_separator"></div>' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
// display a separator between categories and links
if (SHOW_CATEGORIES_SEPARATOR_LINK == '1') {
$content_tm .= '</ul>
<br style="line-height:10px;">
<div class="h_l"><img alt="" src="images/spacer.gif" width="1" height="1"></div>
<br style="line-height:6px;">
<ul class="ul2" >' . "\n";
}
if (SHOW_CATEGORIES_BOX_SPECIALS == 'true') {
$show_this = $db->Execute("select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1");
if ($show_this->RecordCount() > 0) {
$content_tm .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_SPECIALS) . '">' . CATEGORIES_BOX_HEADING_SPECIALS . '</a>' . '</li>' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') {
// display limits
$display_limit = zen_get_products_new_timelimit();
$show_this = $db->Execute("select p.products_id
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit . " limit 1");
if ($show_this->RecordCount() > 0) {
$content_tm .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a>' . '</li>' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') {
$show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1");
if ($show_this->RecordCount() > 0) {
$content_tm .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a>' . '</li>' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
$content_tm .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a></li>' . "\n";
}
}
$content_tm .= '</ul>';
//$content_cont = tm_box_cont($content_tm);
//$content = $content_head.$content_cont;
$content = $content_tm;
?>
Ok, you have a Template Monster template, which has added a bunch of code to the stock file, and changed how the contents are built.
If you tell me which Categories Dressing feature you are trying to use, I can probably tell you how to integrate it with this template.
I think the issue is that TM has modified the categories to display as an unordered list, and when you merged/replaced code that got eliminated.
sorry about that, here is my code for the code for the modified tpl_categories.php file, i'm using the non linked headers, let mek now what you think.
<?php
/**
* Side Box Template
*
* @package templateSystem
* @copyright Copyright 2003-2006 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: tpl_categories.php 4162 2006-08-17 03:55:02Z ajeh $
* Modified for Categories Dressing v1.0 by Glenn Herbert (gjh42) 2007-06-06
*/
//$content_tm = '';
//$content_head = tm_box_head(BOX_HEADING_CATEGORIES,'','style3');
$content_tm .= '<ul class="ul2">
';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
for ($i=0;$i<sizeof($box_categories_array);$i++) {
switch(true) {
// to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
// uncomment the select below and set the cPath=3 to the cPath= your_categories_id
// many variations of this can be done
// case ($box_categories_array[$i]['path'] == 'cPath=3'):
// $new_style = 'category-holiday';
// break;
case ($box_categories_array[$i]['top'] == 'true'):
$new_style = 'category-top';
break;
case ($box_categories_array[$i]['has_sub_cat']):
$new_style = 'category-subs';
break;
default:
$new_style = 'category-products';
}
if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {
// categories dressing - add (divider and) heading above a cat
if ($box_categories_array[$i]['path'] == 'cPath=26') { //replace number with your desired cPath
$content .= '<br>' . "\n"; // to add divider uncomment this line
$content .= '<span class="catBoxHeading1"><strong>Room</strong></span><br />' . "\n";
}
// categories dressing - add (divider and) heading above a cat
if ($box_categories_array[$i]['path'] == 'cPath=19') { //replace number with your desired cPath
$content .= '<br>' . "\n"; // to add divider uncomment this line
$content .= '<span class="catBoxHeading1"><strong>Categories</strong></span><br />' . "\n";
}
// categories dressing - add (divider and) heading above a cat
if ($box_categories_array[$i]['path'] == 'cPath=31') { //replace number with your desired cPath
$content .= '<br>' . "\n"; // to add divider uncomment this line
$content .= '<span class="catBoxHeading1"><strong>Prices</strong></span><br />' . "\n";
}
$content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
// categories dressing - display images for category names
$cat_name_display = $box_categories_array[$i]['name'];
if(in_array(str_replace("cPath=","",$box_categories_array[$i]['path']), explode(",",''))) { //replace numbers with your cat ids separated by commas
$cat_name_display = '<img src="' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_TEMPLATE . 'images/catimg' . str_replace("cPath=","",$box_categories_array[$i]['path']) . '.gif" alt="Category ' . str_replace("cPath=","",$box_categories_array[$i]['path']) . '">';
}
if ($box_categories_array[$i]['current']) {
if ($box_categories_array[$i]['has_sub_cat']) {
$content .= '<span class="category-subs-parent">' . $cat_name_display . '</span>';
} else {
$content .= '<span class="category-subs-selected">' . $cat_name_display . '</span>';
}
} else {
$content .= $cat_name_display;
} // images for category names
if ($box_categories_array[$i]['has_sub_cat']) {
$content .= CATEGORIES_SEPARATOR;
}
$content .= '</a>';
if (SHOW_COUNTS == 'true') {
if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
$content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
}
}
$content .= '<br />' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
// display a separator between categories and links
if (SHOW_CATEGORIES_SEPARATOR_LINK == '1') {
$content .= '<hr id="catBoxDivider" />' . "\n";
}
if (SHOW_CATEGORIES_BOX_SPECIALS == 'true') {
$show_this = $db->Execute("select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1");
if ($show_this->RecordCount() > 0) {
$content .= '<a class="category-links" href="' . zen_href_link(FILENAME_SPECIALS) . '">' . CATEGORIES_BOX_HEADING_SPECIALS . '</a>' . '<br />' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') {
// display limits
// $display_limit = zen_get_products_new_timelimit();
$display_limit = zen_get_new_date_range();
$show_this = $db->Execute("select p.products_id
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit . " limit 1");
if ($show_this->RecordCount() > 0) {
$content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a>' . '<br />' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') {
$show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1");
if ($show_this->RecordCount() > 0) {
$content .= '<a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a>' . '<br />' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
$content .= '<a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a>' . "\n";
}
}
$content .= '</div>';
?>
You have replaced all of TM's code in this file, except for the opening
$content_tm .= '<ul class="ul2">
';
which is now not closed. This would cause an error if $content_tm were being applied at the end.. TM uses $content_tm to accumulate the list instead of $content, so the heading code will need to be modified to work with this.
Also, the <ul> is not going to play nice with a non-list item tossed in the middle, so we will have to end the list, add the heading and start another list.
You need to go back to the original TM file, and add just the heading code, as shown here in its modified form.
Immediately after this bit:add this:PHP Code:// skip if this is for the document box (==3)
} else {
PHP Code:// categories dressing - add (divider and) heading above a cat
if ($box_categories_array[$i]['path'] == 'cPath=26') { //replace number with your desired cPath
$content_tm .= '</ul>';
$content_tm .= '<br>' . "\n"; // to add divider uncomment this line
$content_tm .= '<span class="catBoxHeading1"><strong>Room</strong></span><br />' . "\n";
$content_tm .= '<ul class="ul2" >' . "\n";
}
// categories dressing - add (divider and) heading above a cat
if ($box_categories_array[$i]['path'] == 'cPath=19') { //replace number with your desired cPath
$content_tm .= '</ul>';
$content_tm .= '<br>' . "\n"; // to add divider uncomment this line
$content_tm .= '<span class="catBoxHeading1"><strong>Categories</strong></span><br />' . "\n";
$content_tm .= '<ul class="ul2" >' . "\n";
}
// categories dressing - add (divider and) heading above a cat
if ($box_categories_array[$i]['path'] == 'cPath=31') { //replace number with your desired cPath
$content_tm .= '</ul>';
$content_tm .= '<br>' . "\n"; // to add divider uncomment this line
$content_tm .= '<span class="catBoxHeading1"><strong>Prices</strong></span><br />' . "\n";
$content_tm .= '<ul class="ul2" >' . "\n";
}
PLEASE can you help me - I am going blind from looking at code and I'm sure the answer is right in front of me but I am missing it.
I am reinstalling my site and have update my version of Zen cart to the latest (did this 2 days ago).
I added this mod categories_dressing_2-7-3 and have managed to do some customizing but am stumped at something.
Here is my site (under construction)
http://ljgdesign.com
You will see my categories on the left side.
- I only want the one divider line above the link heading - how do i remove the other's?
- Also, where do I find the text "Link Heading" to modify it - I have looked all over the place and can't find it.
- one last thing...see the arrow that I put in that points to the sub categories? I did that last year - Any idea where that is? I would love to remove it lol
Thanks so much for any help you can offer. I really appreciate it and am sorry to bother you.
Hi guys how i can change and add button image in my top Categories path 1,2,3,4 ?
When I install it my category Cpath3 is giving me a sample button image, I want to add a button to cpath 1, 2,3,4 but I cannot figure out how to add it. Which file do I have to add to add the buttons?
I have Template Monster template (theme490) which I read in this thread that could be an issue with tpl_categories.php and getting this mod to work. All I want to do is have the top level categories have background images w/ hover. No subcats or anything else. I have uploaded my images and updated stylesheet_categories_dressing.php to reference the images. Below is my tpl_categories code. Can someone please tell me how to make this mod work with Template Monster as well as how to configure categories_dressing_defines.php? My categories are simply 1-6.
<?php
/**
* Side Box Template
*
* @package templateSystem
* @copyright Copyright 2003-2006 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: tpl_categories.php 4162 2006-08-17 03:55:02Z ajeh $
*/
$content = "";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
$content .= '<ul>' . "\n";
$li_class="";
$levels = array();
$j = 0;
foreach($main_category_tree->tree as $key => $value){
for ($i=0;$i<sizeof($box_categories_array);$i++){
if($box_categories_array[$i]['path'] == 'cPath=' . $value['path']){
$levels[$i] = $value['level'];
}
}
$j++;
}
for ($i=0;$i<sizeof($box_categories_array);$i++) {
switch(true) {
// to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
// uncomment the select below and set the cPath=3 to the cPath= your_categories_id
// many variations of this can be done
// case ($box_categories_array[$i]['path'] == 'cPath=3'):
// $new_style = 'category-holiday';
// break;
case ($box_categories_array[$i]['top'] == 'true'):
if($i == 0)
{
$new_style = 'category-top_un';
$li_class='<li class="category-top_un"><span class="top-span">';
break;
}
else{
$new_style = 'category-top';
$li_class='<li class="category-top"><span class="top-span">';
break;
}
case ($box_categories_array[$i]['has_sub_cat']):
$new_style = 'category-subs';
$li_class='<li class="category-subs" style="padding-left:' . 15 * ($levels[$i]) . 'px"><span class="top-span">';
break;
default:
$new_style = 'category-products';
$li_class='<li class="category-products" style="padding-left:' . 15 * ($levels[$i]) . 'px"><span class="top-span">';
break;
}
if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {
$content .= $li_class;
$content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
if ($box_categories_array[$i]['current']) {
if ($box_categories_array[$i]['has_sub_cat']) {
$content .= '<span class="category-subs-parent-selected">' . $box_categories_array[$i]['name'] . CATEGORIES_SEPARATOR . '</span>';
} else {
$content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>';
}
} else {
if ($box_categories_array[$i]['has_sub_cat']) {
$content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . CATEGORIES_SEPARATOR .'</span>';
} else
$content .= $box_categories_array[$i]['name'];
}
$content .= '</a>';
if (SHOW_COUNTS == 'true') {
if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
$content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
}
}
$content .= '</span></li>';
}
}
$content .= '</ul>' . "\n";
if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
// display a separator between categories and links
if (SHOW_CATEGORIES_SEPARATOR_LINK == '1') {
$content .= '<div id="catBoxDivider"></div>' . "\n";
}
$content .= '<div class="box_body_2"><ul>';
if (SHOW_CATEGORIES_BOX_SPECIALS == 'true') {
$show_this = $db->Execute("select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1");
if ($show_this->RecordCount() > 0) {
$content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_SPECIALS) . '">' . CATEGORIES_BOX_HEADING_SPECIALS . '</a></li>' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true') {
// display limits
// $display_limit = zen_get_products_new_timelimit();
$display_limit = zen_get_new_date_range();
$show_this = $db->Execute("select p.products_id
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit . " limit 1");
if ($show_this->RecordCount() > 0) {
$content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . CATEGORIES_BOX_HEADING_WHATS_NEW . '</a></li>' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true') {
$show_this = $db->Execute("select products_id from " . TABLE_FEATURED . " where status= 1 limit 1");
if ($show_this->RecordCount() > 0) {
$content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . CATEGORIES_BOX_HEADING_FEATURED_PRODUCTS . '</a></li>' . "\n";
}
}
if (SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
$content .= '<li><a class="category-links" href="' . zen_href_link(FILENAME_PRODUCTS_ALL) . '">' . CATEGORIES_BOX_HEADING_PRODUCTS_ALL . '</a></li>' . "\n";
}
$content .= '</ul></div>';
}
$content .= '</div>';
?>