Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Subcategory Icon

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 05-04-2010, 10:01 PM
 
cosy cosy is offline
 

Advanced Member
  
Join Date: Mar 2009
Posts: 79
 

Default Re: Subcategory Icon

HI, Can you please share your code with us?Thanks
__________________
Version 4.2.0
Testing v 4.4
Reply With Quote
  #12  
Old 05-04-2010, 10:22 PM
 
pia pia is offline
 

Newbie
  
Join Date: Oct 2009
Posts: 6
 

Default Re: Subcategory Icon

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:Click image for larger version

Name:	lsbs-subcats-screenshot.jpg
Views:	202
Size:	86.8 KB
ID:	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
__________________
---
pia

x-cart 4.3.1
Reply With Quote
  #13  
Old 05-04-2010, 11:14 PM
 
cosy cosy is offline
 

Advanced Member
  
Join Date: Mar 2009
Posts: 79
 

Default 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?
__________________
Version 4.2.0
Testing v 4.4
Reply With Quote
  #14  
Old 05-04-2010, 11:32 PM
 
pia pia is offline
 

Newbie
  
Join Date: Oct 2009
Posts: 6
 

Default 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?
__________________
---
pia

x-cart 4.3.1
Reply With Quote
  #15  
Old 05-05-2010, 04:53 AM
 
cosy cosy is offline
 

Advanced Member
  
Join Date: Mar 2009
Posts: 79
 

Default 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.
__________________
Version 4.2.0
Testing v 4.4
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:16 AM.

   

 
X-Cart forums © 2001-2020