- Open the categories.tpl file located in the skins/[CUSTOMER_ACTIVE_SKIN]/customer/categories_pages directory of your CS-Cart installation, where [CUSTOMER_ACTIVE_SKIN] is an active skin of your storefront.
- Find the following part of the code there:
{if $subcategories or $category_data.description}
{math equation="ceil(n/c)" assign="rows" n=$subcategories|@count c=$columns|default:"2"}
{split data=$subcategories size=$rows assign="splitted_subcategories"}
{if $category_data.description && $category_data.description != ''}
<div class="category-description">{$category_data.description}</div>
{/if}
<div class="wrapper">
<div class="categories-image">
{include file="common_templates/image.tpl" show_detailed='Y' images=$category_data.main_pair object_type="category" no_ids=true}
</div>
<div class="subcategories">
{if $subcategories|@count < 6}
<ul>
{/if}
{foreach from=$splitted_subcategories item="ssubcateg"}
{if $subcategories|@count >= 6}
<div class="categories-columns">
<ul>
{/if}
{foreach from=$ssubcateg item=category name="ssubcateg"}
{if $category.category_id}<li><a href="{$index_script}?{$target_name}=categories&category_id={$category.category_id}" class="underlined-bold">{$category.category|escape:html}</a></li>{/if}
{/foreach}
{if $subcategories|@count >= 6}
</ul>
</div>
{/if}
{/foreach}
{if $subcategories|@count < 6}
</ul>
{/if}
</div>
</div>
<div class="clear-both"> </div>
{/if}
and replace it with this one:
{split data=$subcategories size=$columns|default:"COLUMNS_NUMBER" assign="splitted_subcategories"}
{math equation="floor(100/x)" x=$columns|default:"COLUMNS_NUMBER" assign="cell_width"}
<table cellpadding="0" cellspacing="3" border="0" width="100%">
{foreach from=$splitted_subcategories item="scats"}
<tr>
{foreach from=$scats item="category"}
{if $category}
<td align="center" valign="middle" width="{$cell_width}%">
<a href="{$index_script}?{$target_name}=categories&category_id={$category.category_id}">{include file="common_templates/image.tpl" show_detailed='N' object_type="category" images=$category.main_pair no_ids=true}</a>
</td>
{else}
<td width="{$cell_width}%"> </td>
{/if}
{/foreach}
</tr>
<tr>
{foreach from=$scats item="category"}
{if $category}
<td align="center" valign="top" width="{$cell_width}%">
<div class="subcategories"><a href="{$index_script}?{$target_name}=categories&category_id={$category.category_id}" class="underlined-bold">{$category.category|escape:html}</a></div><br />
</td>
{else}
<td width="{$cell_width}%"> </td>
{/if}
{/foreach}
</tr>
{/foreach}
</table>
where COLUMNS_NUMBER is the number of columns in your subcategories list (there are two entries of it in the code).
- Save the file and open the categories.php file located in the include/customer directory of your CS-Cart installation.
- Find the following part of the code there:
// Get subcategories list for current category
$subcategories = fn_get_subcategories($category_id);
$smarty->assign('subcategories', @$subcategories);
and replace it with this one:
// Get subcategories list for current category
$subcategories = fn_get_subcategories($category_id);
foreach($subcategories as $k => $v) {
$subcategories[$k]['main_pair'] = fn_get_image_pairs($v['category_id'], 'category', 'M', '', true, false);
}
$smarty->assign('subcategories', @$subcategories);
- Save the file and check the results.