category list in other places

I’m trying to put the category list two places on the page, but I’m not able to. I don’t understand why I can’t just re-use this code:

{assign var=“foreach_name” value=“cats_$cid”}

{foreach from=$items item=“category” name=$foreach_name}


Is $items reset somewhere in the page? I’m trying to put categories in the footer as well as the side nav bar.

$items is usually assigned from

foreach from=$categrories item="item"

If you are missing the outer look of $categories then $item will never get set.

a grep of the entire skins directory shows no results for ‘foreach from=$categories’

The categories code does work in menu_items.tpl, which has this inheritance:

index.tpl → main.tpl → blocks/locations/index/left.tpl → customer/blocks/categories_emenu.tpl → menu_items.tpl

However, when I take the same code and stick it in main.tpl, it doesn’t work.

the category info seems to be passed in a variable called ‘$items’. If $items is available to categories_emenu.tpl, how come it isn’t available in main.tpl? I don’t see a place that it’s assigned in the templates, so I assume it’s assigned in the php and I would expect that to mean it was globally available.

Also, {debug} does nothing for me. I have php’s display_errors turned on, but nothing shows up.

Why can’t you just create another Category block named Category Footer and use that to get your categories in the footer? I’m just curious…I’m not an expert on PHP or Smarty templates by any means and would like to know why that wouldn’t work.




Have you taken a look at /core/templater_plugins/function.block.php?

// This block is not static, so it is necessary to find its items
if (strpos($_block['properties']['list_object'], '.tpl') === false || !empty($_block['properties']['items_function'])) {
$_block['properties']['appearances'] = $params['template'];
$items = fn_get_block_items($_block);
//if (empty($items) && $_block['properties']['hide_empty_block'] != 'no') {
if (empty($items)) {
$display = false;
} else {
$smarty->assign('items', $items);


Thanks, that explains it completely. I’m just trying to get a grasp of all the internal workings of the system. I appreciate the help!

I guess the {block} statement is unique to cs-cart? It’s not a smarty command, right?


the category info seems to be passed in a variable called ‘$items’.


As Bob indicated above, you are trying to create a block outside of the category block.

Regarding the debugger… Make sure you have pop_ups enabled for your URL within your browser. The {debug} statement should open a pop_up with all the variables and their assignements at the point of the {debug} statement. Note that if it’s within a loop, you will get the last value of the variables within the loop.

weird. Nothing is set to block popups in my firefox. I guess that’s something to take up with smarty’s community.