Multi-column subcategories for 4.1.x
Multi-column subcategories for 4.1.x
Edit the skin1/customer/main/subcategories.tpl template and replace:
PHP Code:
{if $subcategories}
<table cellspacing="5" width="100%">
{foreach from=$subcategories item=subcat}
<tr>
{if $tmp and $first_subcat ne "Y"}
<td valign="top" rowspan="{count value=$subcategories print="Y"}"><img src="{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/image.php?id={$cat}&type=C{/if}" alt="" /></td>
{assign var="first_subcat" value="Y"}
{/if}
<td class="SubcatTitle"><a href="home.php?cat={ $subcat.categoryid }"><font class="ItemsList">{ $subcat.category|escape }</font></a><br /></td>
<td class="SubcatInfo">{if $config.Appearance.count_products eq "Y"}
{if $subcat.product_count}{ $subcat.product_count } {$lng.lbl_products}
{elseif $subcat.subcategory_count}{ $subcat.subcategory_count } {$lng.lbl_categories|lower}
{/if}
{/if}</td>
</tr>
{/foreach}
</table>
{/if}
with the
PHP Code:
{if $subcategories}
<table cellspacing="5" width="100%">
{php}
$this->_tpl_vars['tmp_subcategories'] = array_values($this->_tpl_vars['subcategories']);
{/php}
{assign var=cols value="4"}
{section name=tr loop=$tmp_subcategories step=$cols}
<tr>
{section name=td start=$smarty.section.tr.index loop=$smarty.section.tr.index+$cols}
<td>
{if $tmp_subcategories[td].categoryid ne ""}
<div align="center">
<a href="home.php?cat={$tmp_subcategories[td].categoryid}">
<img src="{if $tmp_subcategories[td].icon_url}{$tmp_subcategories[td].icon_url}{else}{$xcart_web_dir}/image.php?id={$tmp_subcategories[td].categoryid}&type=C{/if}" alt="" /></a><br /><a href="home.php?cat={$tmp_subcategories[td].categoryid}">
<font class="ItemsList">
{$tmp_subcategories[td].category|escape|default:" "}
</font>
</a>
</div>
{else}
{/if}
</td>
{/section}
</tr>
{/section}
</table>
{/if}
__________________
Eugene Kaznacheev,
Evangelist/Product Manager at Ecwid: http://www.ecwid.com/ (since Sept 2009)
ex-Head of X-Cart Tech Support Department
ex- X-Cart Hosting Manager - X-Cart hosting
ex-X-Cart Technical Support Engineer
Note: For the official guaranteed tech support services please turn to the Customers HelpDesk.
|