Hello, I'm kinda having some trouble with a section of PHP code that's a part of osCommerce (http://www.oscommerce.com), an open source PHP/MySQL based eCommerce system.
Anyhow, I'm trying to get the following page: http://www.fourthehardway.com/shop/catalog/default.php?cPath=21_22&osCsid=f538af48e3c1f1703332094c677a1d1a
to display the header graphic for only the current category/subcategory rather than the header graphice for every category/subcategory in that section. I've isolated the code that does it, but unfortunately this is beyond my PHP coding skills. If any of you pro's would like to take a crack at it, I'd certainly appreciate the assistance.
Many thanks in advance...
Here's the code I'm struggling with:
<?php
if ($cPath && ereg('_', $cPath)) {
// check to see if there are deeper categories within the current category
$category_links = array_reverse($cPath_array);
for($i=0; $i<sizeof($category_links); $i++) {
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' order by sort_order, cd.categories_name");
if (tep_db_num_rows($categories_query) < 1) {
// do nothing, go through the loop
} else {
break; // we've found the deepest category the customer is in
}
}
} else {
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' order by sort_order, cd.categories_name");
}
$rows = 0;
while ($categories = tep_db_fetch_array($categories_query)) {
$rows++;
$cPath_new = tep_get_path($categories['categories_id']);
$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
echo tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . "\n";
{
}
}
?>