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

Display Sub Categories in 2 or 3 column + Pic

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-25-2008, 03:43 PM
 
chealyte chealyte is offline
 

Member
  
Join Date: Jun 2005
Posts: 22
 

Exclamation Display Sub Categories in 2 or 3 column + Pic

I am wondering does anyone done this yet or know how to do this ?..

I want to display my sub-Categories in 2 or 3 column with catagory picture infront of each one name .. i am wondering how do it this ?

example :

Cat-Pic 1 : Cat name 1 | Cat-Pic 2 : Cat Name 2 | Cat-pic 2 : Cat name 2
Cat-Pic 4 : Cat name 4 | Cat-Pic 5 : Cat Name 5 | Cat-pic 6 : Cat name 6

Thank in advance for help
__________________
http://tinybeeonline.com

X-Cart Gold V 4.1.9
Reply With Quote
  #2  
Old 05-26-2008, 06:29 AM
 
xim xim is offline
 

X-Cart team
  
Join Date: Nov 2004
Posts: 677
 

Default Re: Display Sub Categories in 2 or 3 column + Pic

Try to use the following code in the template where the $subcategories array is defined:

Code:
{assign var="cell_counter" value="0"} {assign var="subcat_per_row" value="3"} <table width="100%" cellspacing="5"> {foreach from=$subcategories item=subcat} {math equation="x+1" x=$cell_counter assign="cell_counter"} {if $cell_counter eq "1"}<tr>{/if} <td><a href="home.php?cat={$subcat.categoryid}"><img src="{$subcat.categoryid|func_get_image_url:C|default:"image.php?id=`$subcat.categoryid`&type=C"}" alt="{$subcat.category|escape}" style="padding-right: 5px;" align="left"/>{$subcat.category}</a></td> {if $cell_counter eq $subcat_per_row} </tr> {assign var="cell_counter" value="0"} {/if} {/foreach} {if $cell_counter gt 0} {section loop=$subcat_per_row name=cc start=$cell_counter} <td>&nbsp;</td> {/section} </tr> {/if} </table>

Also, I'd recommend you to move your category images to the file system. You can perform it under admin area on the "Images location" page.
__________________
Sincerely yours, Max Vydrin
Reply With Quote
  #3  
Old 05-26-2008, 02:24 PM
 
chealyte chealyte is offline
 

Member
  
Join Date: Jun 2005
Posts: 22
 

Default Re: Display Sub Categories in 2 or 3 column + Pic

i found " subcategories.tpl " but it is look like not the place where $subcategories is define .. and it is a lot files to look into .. BUT .. if we assignt this to file where " $subcategories " is define will it effect the menu system ? i saw it use " $subcategories " too.
__________________
http://tinybeeonline.com

X-Cart Gold V 4.1.9
Reply With Quote
  #4  
Old 05-26-2008, 09:25 PM
 
xim xim is offline
 

X-Cart team
  
Join Date: Nov 2004
Posts: 677
 

Default Re: Display Sub Categories in 2 or 3 column + Pic

This code should work on the categories pages, products listing and product details page.

On these pages you can use this code in any templates which are included to show the appropriate content.
__________________
Sincerely yours, Max Vydrin
Reply With Quote
  #5  
Old 06-05-2008, 04:24 PM
 
chealyte chealyte is offline
 

Member
  
Join Date: Jun 2005
Posts: 22
 

Default Re: Display Sub Categories in 2 or 3 column + Pic

can i know which file(s) exacly that i should modify and add the code to it ?
__________________
http://tinybeeonline.com

X-Cart Gold V 4.1.9
Reply With Quote
  #6  
Old 06-05-2008, 09:45 PM
 
xim xim is offline
 

X-Cart team
  
Join Date: Nov 2004
Posts: 677
 

Default Re: Display Sub Categories in 2 or 3 column + Pic

Quote:
Originally Posted by chealyte
can i know which file(s) exacly that i should modify and add the code to it ?

Generally the subcategories list on the category details page. Therefore you should edit the "skin1/customer/main/subcategories.tpl" template as you previously did it.

If you have any problem with code implementing I'd recommend you to contact your Support team in your Help Desk account.
__________________
Sincerely yours, Max Vydrin
Reply With Quote
  #7  
Old 06-06-2008, 04:42 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default Re: Display Sub Categories in 2 or 3 column + Pic

Quote:
Originally Posted by chealyte
can i know which file(s) exacly that i should modify and add the code to it ?

"skin1/customer/main/subcategories.tpl"

Find in the file the following code and replace at that what you wrote above.

PHP Code:
.......
<
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}&amp;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>
....... 
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 03:47 PM.

   

 
X-Cart forums © 2001-2020