ec_category_subcategory_and_subsubcategory_display db category_list subcategory_list subsubcategory_listWhat it does:
Returns an HTML table of category, subcategory, and subsubcategory informationDefined in: /web/philip/tcl/ecommerce-defs.tcl
Source code:
if { [empty_string_p $category_list] } { return "None Defined" } set to_return "<table border=0 cellspacing=0 cellpadding=0>\n" foreach category_id $category_list { append to_return "<tr>\n" set tr_done 1 if { ![empty_string_p $subcategory_list] } { set relevant_subcategory_list [database_to_tcl_list $db "select subcategory_id from ec_subcategories where category_id=$category_id and subcategory_id in ([join $subcategory_list ","]) order by subcategory_name"] } else { set relevant_subcategory_list [list] } if { [llength $relevant_subcategory_list] == 0 } { append to_return "<td valign=top>[ec_space_to_nbsp [database_to_tcl_string $db "select category_name from ec_categories where category_id=$category_id"]]</td><td></td><td></td>\n" } else { append to_return "<td valign=top rowspan=[llength $relevant_subcategory_list]>[ec_space_to_nbsp [database_to_tcl_string $db "select category_name from ec_categories where category_id=$category_id"]]</td>" foreach subcategory_id $relevant_subcategory_list { if { $tr_done } { set tr_done 0 } else { append to_return "<tr>\n" } append to_return "<td valign=top> -- [ec_space_to_nbsp [database_to_tcl_string $db "select subcategory_name from ec_subcategories where subcategory_id=$subcategory_id"]]</td><td valign=top>" if { ![empty_string_p $subsubcategory_list] } { set relevant_subsubcategory_name_list [database_to_tcl_list $db "select subsubcategory_name from ec_subsubcategories where subcategory_id=$subcategory_id and subsubcategory_id in ([join $subsubcategory_list ","]) order by subsubcategory_name"] } else { set relevant_subsubcategory_name_list [list] } foreach subsubcategory_name $relevant_subsubcategory_name_list { append to_return " -- [ec_space_to_nbsp $subsubcategory_name]<br>\n" } append to_return "</td></tr>" } ; # end foreach subcategory_id } ; # end of case where relevant_subcategory_list is non-empty } ; # end foreach category_id append to_return "</table>\n" return $to_return