Hi all.
I'm very new to Zen Cart (and PHP) and have found these forums invaluable while customising the look and feel of a new site, so here I am to try and give a little back
One modification I wanted was to have the product count suffixed to the Category rows, just like the one in the Category Sidebox. I couldn't find the answer so I decided to roll my own by cutting bits and pieces from around the place.
Works in version 1.3.8a
File to edit: includes/modules/YOUR_OVERLOAD/category_row.php
Change line 40 from:
PHP Code:
$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>');
To:
PHP Code:
$products_in_category = zen_count_products_in_category($categories->fields['categories_id']);
$content_count = "";
if (SHOW_COUNTS == 'true') {
if ((CATEGORIES_COUNT_ZERO == '1' and $products_in_category == 0) or $products_in_category >= 1) {
$content_count .= ' ' . CATEGORIES_COUNT_PREFIX . $products_in_category . CATEGORIES_COUNT_SUFFIX;
}
}
$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>' . $content_count);
HTH
Dave
Bookmarks