Hi there,
I need the help of a few Zen Cart guru's on this one. I know this can be done, but its just a little over the top of my head at this point (still learning).
In short, I'm trying to alter the $categories_image variable (found in the tpl_index_categories.php template file) so that it'll only display the image from the root category (no matter how deep into the sub-categories of that main category you're in).
So, for example, say I have the following category structure:
Household Supplies [ID: 1]
- Bathroom Supplies [ID: 2]
--- Toilet Supplies [ID: 3]
------ Cleaners [ID: x]
---------- Clorox [ID: x]
---------- Windex [ID: x]
------ Seat Covers [ID: x]
---------- Fluffy [ID: x]
---------- Leather [ID: x]
------ Plungers [ID: x]
---------- Super-Mario Style [ID: x]
--- Shower Supplies [ID: 4]
------ Curtains [ID: x]
---------- Pokadot [ID: x]
------ Shower Heads [ID: x]
---------- Steampunk [ID: x]
etc
Basically, I know the cPath to the 'Toilet Supplies' category would be 1_2_3, and 'Shower Supplies' would be 1_2_4.
Now, my question is how would I go about pulling *just* the second number (first sub-category of the main category) out of that cPath?
The goal here is so that the category icon for 'Bathroom Supplies' appears at the top of the 'Toilet Supplies' and 'Shower Supplies' category pages.
I can probably figure out the rest from there ('if' situations to determine if we're more than 2 categories deep, etc), but I'm feeling a little stumped here. Any advice?
![]()




