It's categories_ul_generator.php in that addon which I'd like to know how to modify so it returns products per category instead of subcategories per category...anyone know???
I *think* all I need to do is change this line: var $document_types_list = ' (3) '; // acceptable format example: ' (3, 4, 9, 22, 18) '??????
but I do not know what number to put to have it return products not categories, what do the other possible values return??
Code:
class zen_categories_ul_generator {
var $root_category_id = 0,
$max_level = 6,
$data = array(),
$root_start_string = '',
$root_end_string = '',
$parent_start_string = '',
$parent_end_string = '',
$parent_group_start_string = '%s<ul>',
$parent_group_end_string = '%s</ul>',
$child_start_string = '%s<li>',
$child_end_string = '%s</li>',
$spacer_string = '',
$spacer_multiplier = 1;
var $document_types_list = ' (3) '; // acceptable format example: ' (3, 4, 9, 22, 18) '
function zen_categories_ul_generator() {
global $languages_id, $db, $request_type;
$this->server = ((ENABLE_SSL == true && $request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER);
$this->base_href = ((ENABLE_SSL == true && $request_type == 'SSL') ? DIR_WS_HTTPS_CATALOG : DIR_WS_CATALOG);
$this->data = array();
$categories_query = "select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd " .
"where c.categories_id = cd.categories_id and c.categories_status=1 and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
"order by c.parent_id, c.sort_order, cd.categories_name";
$categories = $db->Execute($categories_query);
while (!$categories->EOF) {
$products_in_category = (SHOW_COUNTS == 'true' ? zen_count_products_in_category($categories->fields['categories_id']) : 0);
$this->data[$categories->fields['parent_id']][$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'], 'count' => $products_in_category);
$categories->MoveNext();
}
// DEBUG: These lines will dump out the array for display and troubleshooting:
// foreach ($this->data as $pkey=>$pvalue) {
// foreach ($this->data[$pkey] as $key=>$value) { echo '['.$pkey.']'.$key . '=>' . $value['name'] . '<br>'; }
// }
}
another related thread but I don't fully understand the code:
http://www.zen-cart.com/showthread.p...-modifications
I just need to query the categories and return products instead of sub-categories, how do I do this??
Thank you, Tom -- please advise if I should start a new thread for the above question...