Customized Category Content

Hi Guys,

Pretty new to CS-Cart & Smarty & PHP.

Basically I want to be able to Put Ads / Banners & My Own Custom code on sections of my site based off the categories within my CS-Cart System.

Currently I trying to mod CS-Cart V3. But I am stuck… So help would be great. And advice with examples and paths would be helpful to learn as well :)

I currently been working in smarty alone. Although I would say there is a better way considering my ugly code… Currently I just had it in a post hook tpl

{hook name=“blocks:topmenu_dropdown”} but I would like it to be in php function or controller or something so I can just call the variables via smarty.

So in Pseudo/Smarty code this is what I need to happen.

{foreach from=0|fn_get_subcategories item=“root_cat”}

----- Assign to MyArray() - root_cat.category_id & & my_own_variable(called $_category_level (eg 271 & Electrical & 0)

Then Recursivley until no categories are left.

--------{foreach from=$root_cat.category_id|fn_get_subcategories item=“sub_cat”}

----- Assign to MyArray() - root_cat.category_id & & my_own_variable(called $_category_level (eg 272 & Power Points & root_cat.category_id)

So I now have a sub & sub of sub categories with its root category_id stored in MyArray- eg 272 & Power Points & 271

Then somehow in my .tpl I can call/check stuff against the array.? With the following

if $category_data.category_id &/or $product.main_category in MyArray then extract the right vars.

Match eg. 272 - Power Points - 271 was root… include my code/banner etc)

If correctly done I think it should show custom code based upon the root / category regardless if its a product or sub sub category.

Sorry for the wall of text.

Thanks in advance