I have managed to get back to working out this problem and have come up with a solution but still need some advice.
I have created two ezpages for male and female categories and have followed this thread to allow them to support php:
http://www.zen-cart.com/forum/showthread.php?t=37252
I have given all male categories a sort order of 0 and all female categories a sort order of 1.
I am using sql to get the male and female categories for each page and am using the categories_row.php page as a template to generate the HTML to display. My code looks like this:
PHP Code:
$sql = "SELECT * FROM zen_categories WHERE parent_id != 0 AND sort_order=1 ORDER BY parent_id ASC;";
$categories_list = $db->Execute($sql);
if ($categories_list->RecordCount() > 0) { //if categories are returned from the SQL
while (!$categories_list->EOF) {
// Female categories have a sort order of 0
// if (!$categories_list->fields['categories_image']) !$categories_list->fields['categories_image'] = 'pixel_trans.gif';
$cPath_new = zen_get_path($categories_list->fields['categories_id']);
// strip out 0_ from top level cats
$cPath_new = str_replace('=0_', '=', $cPath_new);
$list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => '
<table style="width:1px; margin:auto;" align="center";>
<tr>
<td>
<div class="img_box">
<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES .zen_get_categories_image($categories->fields['parent_id']), $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a>
</div>
<br class="clearBoth" />
<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories->fields['categories_name'] . '</a><br /><br />
</td>
</tr>
</table>
<br />
');
$col ++;
if ($col > (MAX_DISPLAY_CATEGORIES_PER_ROW -1)) {
$col = 0;
$row ++;
}
$categories_list->MoveNext();
}
}
I have the $list_box_contents array, but am not sure how to use it. How do I actually output the HTMl for the categories?