I just had another thought (I feel like Cosmo from the Fairly Oddparents, so sad, I wish I could say I was old enough to have kids, so I could blame it on them that I know caracters from cartoons on nick.).
Ok, so here are some more of my thoughts (beware):
I don't think the categories.php has to be changed at all, but ONLY the dropdown.tpl, home.tpl (to include the dropdown, DUH) and the categories.tpl. This is why..
In funks original code (again here):
Code:
// funkydunk modification
// amended query to get the main cat and subcat for each record
$categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 1) as maincat, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 2) as subcat from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category"));
It seems to me all that is being done is verifying the category is avaliable, and the biggest thing is, this is where the values of
maincat and
subcat are defined, but in 4.0.x we have parentid, which also should mean we don't have to set the index's right? Or am I wrong?
If we need to define the SUBSTRINGS we can define them much simpler by going SUBSTRING_INDEX($sql_tbl[categories].categoryid ? or something like that, again my ignorance to programming is where I can not be helpful.
So here are some of my thoughts:. (note I am only putting up the modifying part of the dropdown.tpl)
Code:
{section name=cat_num loop=$categories}
{assign var="temp" value="0"}
{section name=cat loop=$allcategories}
{if $allcategories[cat].maincat eq $categories[cat_num].category}
{if $allcategories[cat].subcatonly}
{$temp}
{if $temp gt 0}
linkset[{$smarty.section.cat_num.index}] +='<div class="menuitems">
{$allcategories[cat].category}</div>'
{else}
linkset[{$smarty.section.cat_num.index}] ='<div class="menuitems">
{$allcategories[cat].category}</div>'
{/if}
{math equation="temp+1" temp=$temp assign=temp}
{/if}
{/if}
{/section}
{/section}
Would we just modify this section:
Code:
{if $allcategories[cat].maincat eq $categories[cat_num].category}
{if $allcategories[cat].subcatonly}
to say something like:
Code:
{if $allcategories[cat].categoryid eq $categories[cat_num].category}
{if $allcategories[cat_num].parentid}
or something along those lines.
We would also have to change the categories.tpl to match these changes..
Am I making any sense? Or am I on the wrong path to completion for 4.0.x? Thanks for pointing me in some kind of direction, because I feel like I am getting myself even more confused. Thanks