Just thoughts to get you started...
* use the "ondata" method to call a function thatg uses the get_category array
* for each category test the get_products(some_category) element to see of not null
* if not null then populate an output record with the value
In psuedo code... UNTESTED of course
the template
[blk1;block=tr;ondata=prepare_output]
|
* the sql for the block needs to order the get_products "ORDER BY category_id" then we know that if we have "ondata" situation we are processing a category that is not null
*
* sort the get_category array same as the get_products sql result
function prepare_output($BlockName,&$CurrRec,$RecNum) {
global $get_categories; // might need this
$CurrRec['output']="<tr><td>". $get_categories[category_id] ;
foreach( get_products(category_id) as $key->$val){
$CurrRec['output'] .= " - ". $get_product[category_id] ;
// notice the .=
}
$CurrRec['output'] . = "</td></tr>"
}
|
... I think you can get the idea from that ;)
It would be interesting to compare how this type of solution compares to the more (IMO) usual use of the TBS sub-block with sub-query technique.
Of course in either event - if the page takes too long to render - the TBS cache should be used definitely.
Hope that helps,