X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Subcategory Icon (https://forum.x-cart.com/showthread.php?t=39715)

cosy 05-04-2010 10:01 PM

Re: Subcategory Icon
 
HI, Can you please share your code with us?Thanks

pia 05-04-2010 10:22 PM

Re: Subcategory Icon
 
1 Attachment(s)
No problem,

In customer/main/subcategories.tpl I have the following:

Code:

{if $active_modules.Bestsellers ne "" and $config.Bestsellers.bestsellers_menu ne "Y"}
<p />
{include file="modules/Bestsellers/bestsellers.tpl"}
{/if}
<p />
{if $active_modules.Special_Offers}
{include file="modules/Special_Offers/customer/category_offers_short_list.tpl"}
{/if}
{if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description}<p />{/if}
{capture name=dialog}
{assign var="tmp" value="0"}
{foreach from=$subcategories item=c key=catid}
{if $c.category}{assign var="tmp" value="1"}{/if}
{/foreach}
{if $subcategories}
<table  width="100%">
{assign var="count_per_row" value=3}

{math equation="floor(100/x)" x=$count_per_row assign="width"}
{assign var="count" value=0}

{foreach from=$subcategories item=c key=catid}

        {if $count is div by $count_per_row}
            <tr>
            {assign var="count" value=0}
        {/if}

        <td align=center valign=top>
<div class="subcatrow">
        <table border=0 class="subcatstyle" cellspacing="0">
            <tr>
                <td align="center" valign="top" ><a href="home.php?cat={$catid}" class="VertMenuItems">
                {if $c.icon_url ne ""}<img src="{$c.icon_url}" width=120>
                {else}
                <img src="image.php?type=C&id=0&ts=" width=105>               
                {/if}</a></td>
            </tr>
            <tr>
                <td align="center"><font class="CategoriesList"><a href="home.php?cat={$catid}" class="VertMenuItems">{$c.category}</a></font></td>
            </tr>
            {*<tr>
                <td align=center>{$c.description}</td>
            <tr>*}

        </table>
</div>
        </td>

        {capture name=prod_index}
            {math equation="index+x+1" index=$count x=$count_per_row}
        {/capture}
       
        {if $smarty.capture.prod_index is div by $count_per_row}
            </tr>
        {/if}
        {math equation="x+1" x=$count assign="count" }

{/foreach}

    {if $count lt $count_per_row}
    {section name=rest_cells loop=$count_per_row start=$count}
        <td class="SectionBox">&nbsp;</td>
    {/section}
    {/if}
</tr>
 
</table>
{/if}
{if $tmp and $products ne "" }
<br clear="left" />
<hr size="1" noshade="noshade" />
{/if}
{if $products}
{if $sort_fields}
<div align="right">{include file="main/search_sort_by.tpl" sort_fields=$sort_fields selected=$search_prefilled.sort_field direction=$search_prefilled.sort_direction url="home.php?cat=`$cat`&"}</div>
{/if}
{if $total_pages gt 2}
<br />
{ include file="customer/main/navigation.tpl" }
{/if}
<hr size="1" width="100%" />
{include file="customer/main/products.tpl" products=$products}
{/if}
{if $products eq "" and $tmp eq "0"}
{$lng.txt_no_products_in_cat}
{/if}
{/capture}
{include file="dialog.tpl" title=$current_category.category content=$smarty.capture.dialog extra='width="100%"'}
{if $products eq ""}
{if $f_products ne ""}
<p />
{include file="customer/main/featured.tpl"}
{/if}
{/if}
{ include file="customer/main/navigation.tpl" } 


Then, in your skin1/main.css I have the following style code that you can change and add to as fits your design:

[code]/* pia's subcat styles */
table.subcatstyle {
width: 150px; margin-right: 30px; margin-bottom: 10px;
}

.subcatrow {
height: 175px;
border: 1px solid #cccccc;
text-align: center;
padding-left: 15px;
vertical-align: middle;
}
/* end subcatstyles */

You can see what it looks like in the screen shot:Attachment 1934

I hope that helps

oh and ps... the sub cat image works for my css if its no bigger than 150 x 150 ish :)

cosy 05-04-2010 11:14 PM

Re: Subcategory Icon
 
Thank you so much, and do you got product under neath?

i'm trying to figure out when click the root menu it's only show the subcategory icons only so like to show some images under neath this sub cat icons?

pia 05-04-2010 11:32 PM

Re: Subcategory Icon
 
Hi cosy,

If your categories have no products in them that aren't in subcategories, then no products/images will show beneath the subcats.

Not sure I understood your question correctly, so is that what you were asking?

cosy 05-05-2010 04:53 AM

Re: Subcategory Icon
 
Quote:

Originally Posted by pia
Hi cosy,

If your categories have no products in them that aren't in subcategories, then no products/images will show beneath the subcats.

Not sure I understood your question correctly, so is that what you were asking?


I have a number of subcategories On the subcategories page, I would like to be able to show these subcategories like your box image.

also

When they do have products in them, they should be displayed on the same page.


All times are GMT -8. The time now is 07:49 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.