Not for official support
We do not provide technical support in this forum.
If you want to contact our customer support, please use our support form.
You are not logged in.
Hello all,
Currently when I add subcategories to a particular category, they just list vertically on the category page. How would I get them to list horizontally or better yet, have them display in a 4 column format, where they would list horizontally until the 5th subcategory in which they would start on a new row.
Any help would be greatly appreciated.
Thanks
Offline
Edit file published/SC/html/scripts/templates/frontend/category.tpl.html by changing
<p>{section name=i loop=$subcategories_to_be_shown}
{if $subcategories_to_be_shown[i][3]}
{assign var=_sub_category_url value="?categoryID=`$subcategories_to_be_shown[i][0]`&category_slug=`$subcategories_to_be_shown[i][3]`"|set_query_html}
{else}
{assign var=_sub_category_url value="?categoryID=`$subcategories_to_be_shown[i][0]`"|set_query_html}
{/if}
<a href="{$_sub_category_url}">{$subcategories_to_be_shown[i][1]}</a>
({$subcategories_to_be_shown[i][2]})<br />
{/section}</p>to
<table>
{section name=i loop=$subcategories_to_be_shown}
{if $smarty.section.i.index is div by 4}<tr>{/if}
<td>
{if $subcategories_to_be_shown[i][3]}
{assign var=_sub_category_url value="?categoryID=`$subcategories_to_be_shown[i][0]`&category_slug=`$subcategories_to_be_shown[i][3]`"|set_query_html}
{else}
{assign var=_sub_category_url value="?categoryID=`$subcategories_to_be_shown[i][0]`"|set_query_html}
{/if}
<a href="{$_sub_category_url}">{$subcategories_to_be_shown[i][1]}</a> ({$subcategories_to_be_shown[i][2]})
</td>
{if ($smarty.section.i.index + 1) is div by 4}</tr>{/if}
{/section}
</table>Offline
I am trying to do the same thing with the related products but to no avail.
That is, to have the related products list horizontally with 4 columns, but only displaying the thumbnail. (I have figured out how to remove the title and price).
Thanks
Offline
Try to change the following code fragment as marked by Smarty comments "MODIFIED":
<table {if $PAGE_VIEW eq 'mobile'}align="center"{/if}>
{assign var=columns value=4}
{section name=i loop=$product_related}
{if $smarty.section.i.index is div by $columns}<tr>{/if}{* MODIFIED *}
{if $PAGE_VIEW eq 'mobile'}
<td align="center">
{if $product_related[i].pictures.default.thumbnail}
<a href='{"?productID=`$product_related[i].productID`&product_slug=`$product_related[i].slug`"|set_query_html}'>
<img border="0" src="{$smarty.const.URL_PRODUCTS_PICTURES}/{$product_related[i].pictures.default.thumbnail|escape:'url'}" />
</a>
<br />
{/if}
<a href='{"?productID=`$product_related[i].productID`&product_slug=`$product_related[i].slug`"|set_query_html}'>
{$product_related[i][1]}
</a>
<br />
<span style="color: brown;">{$product_related[i][2]}</span>
</td>
{else}
<td align="center">
{if $product_related[i].pictures.default.thumbnail}
<a href='{"?productID=`$product_related[i].productID`&product_slug=`$product_related[i].slug`"|set_query_html}'>
<img border="0" src="{$smarty.const.URL_PRODUCTS_PICTURES}/{$product_related[i].pictures.default.thumbnail|escape:'url'}" />
</a>
{/if}
</td>
<!--<td>
<a href='{"?productID=`$product_related[i].productID`&product_slug=`$product_related[i].slug`"|set_query_html}'>
{$product_related[i][1]}
</a>
</td>
<td>
<span style="color: brown; white-space: nowrap;"> {$product_related[i][2]}</span>
</td>-->
{/if}
{if $smarty.section.i.index+1 is div by $columns}</tr>{/if}{* MODIFIED *}
{/section}
</table>Offline