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

2 Column Subcategory Display
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #1  
Old 12-21-2002, 04:15 AM
 
amanda amanda is offline
 

Advanced Member
  
Join Date: Oct 2002
Posts: 41
 

Default 2 Column Subcategory Display

Hi

Can someone tell me how to change the subcategories so they are listed in 2 columns without the product numbers??

Thanks
Amanda

Merry Christmas Everybody!
Reply With Quote
  #2  
Old 03-25-2004, 01:29 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Little late but here is the code for this in 3.5.x:

Code:
{* divide subcategories into 2 columns www.cart-lab.com written for 3.5.x *} { include file="location.tpl" } {if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y"} {include file="modules/Bestsellers/bestsellers.tpl"} {/if} { include file="customer/main/navigation.tpl" } {if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description|regex_replace:"/[\n]/":" "} {/if} {capture name=dialog} {assign var="tmp" value="0"} {section name=cat_num loop=$subcategories} {if $subcategories[cat_num].category}{assign var="tmp" value="1"}{/if} {/section} {section name=cat_num loop=$subcategories start=1} {math equation="x/2" x=$smarty.section.cat_num.max assign="counter" } {if %cat_num.first%} {if $tmp} [img]{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/icon.php?categoryid={$cat}{/if}[/img] {/if} <table border=0 width="100%" cellspacing=5><tr> {/if} <td width="50%"><font class="ItemsList">{ $subcategories[cat_num].category_name|escape }</font> </td> {if %cat_num.index% is div by 2}</tr><tr>{/if} {* <td align=right nowrap><font class=Text> {if $config.Appearance.count_products eq "Y"} {if $subcategories[cat_num].product_count} { $subcategories[cat_num].product_count } {$lng.lbl_products} {elseif $subcategories[cat_num].subcategory_count} { $subcategories[cat_num].subcategory_count } {$lng.lbl_categories|lower} {/if} {/if} </font></td> </tr> *} { if %cat_num.last% } </tr></table> {/if} {/section} {if $tmp and $products ne "" } <br clear=_all><hr size=1 noshade> {/if} {include file="customer/main/products.tpl" products=$products} {if $products eq "" and $tmp eq "0"} {$lng.txt_no_products_in_cat} {/if} {/capture} {include file="dialog.tpl" title=$current_category.category_name|regex_replace:"/.*\//":"" content=$smarty.capture.dialog extra="width=100%"} {if $products eq ""} {if $f_products ne ""} {include file="customer/main/featured.tpl"} {/if} {/if} { include file="customer/main/navigation.tpl" }
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #3  
Old 04-08-2004, 08:09 AM
 
SMDStudios SMDStudios is offline
 

eXpert
  
Join Date: Dec 2003
Location: Orlando, FL
Posts: 207
 

Default

This mod appears to drop the first subcat in the site. I've looked at the code for awhile can not figure it out.
__________________
X-Cart Gold various versions
Tahoe Web Design

WebsiteCM.com - We recommend WebsiteCM
Reply With Quote
  #4  
Old 04-10-2004, 08:09 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

It may be because of the start=1 in the section loop.

Code:
{section name=cat_num loop=$subcategories start=1}
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #5  
Old 04-12-2004, 11:44 AM
 
SMDStudios SMDStudios is offline
 

eXpert
  
Join Date: Dec 2003
Location: Orlando, FL
Posts: 207
 

Default

When I set start=0 it doesn't display the table correctly.

Link: http://www.shopgspot.com/shop/home.php?cat=248
FYI this is an adult site.

Quote:
Originally Posted by B00MER
It may be because of the start=1 in the section loop.

Code:
{section name=cat_num loop=$subcategories start=1}
__________________
X-Cart Gold various versions
Tahoe Web Design

WebsiteCM.com - We recommend WebsiteCM
Reply With Quote
  #6  
Old 04-15-2004, 11:20 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Code:
{* first coloumn *} <TABLE width="100%"><TR><TD valign="top" width="50%"> {section name=cat_num loop=$subcategories start=0 step=2} {math equation="x/2" x=$smarty.section.cat_num.max assign="counter"} {if %cat_num.first%} {if $tmp} [img]{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/icon.php?categoryid={$cat}{/if}[/img] {/if} <table border=0 width="100%" cellspacing=5><tr> {/if} <td width="50%">{ $subcategories[cat_num].category_name|escape } </td> </tr><tr> { if %cat_num.last% } </tr></table> {/if} {/section} {* 2nd coloumn *} </TD><TD valign="top" width="50%"> {section name=cat_num loop=$subcategories start=1 step=2} {math equation="x/2" x=$smarty.section.cat_num.max assign="counter"} {if %cat_num.first%} {if $tmp} [img]{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/icon.php?categoryid={$cat}{/if}[/img] {/if} <table border=0 width="100%" cellspacing=5><tr> {/if} <td width="50%">{ $subcategories[cat_num].category_name|escape } </td> </tr><tr> { if %cat_num.last% } </tr></table> {/if} {/section} </TD></TR></TABLE>

Updated, works properly now, I just used two section loops and set the stpes at 2 and 1 so I could create columns and get rid of the is div by 2 that wasn't doing what I needed.

hth.
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #7  
Old 04-16-2004, 01:48 PM
 
SMDStudios SMDStudios is offline
 

eXpert
  
Join Date: Dec 2003
Location: Orlando, FL
Posts: 207
 

Default

THANKS BOOMER!

I don't know what us newbies would do without you pros!
__________________
X-Cart Gold various versions
Tahoe Web Design

WebsiteCM.com - We recommend WebsiteCM
Reply With Quote
  #8  
Old 04-22-2004, 10:29 AM
 
xdam xdam is offline
 

Newbie
  
Join Date: Apr 2004
Posts: 1
 

Default

sorry i'm new to x-cart, on which page do i insert this code?
Reply With Quote
  #9  
Old 04-22-2004, 10:30 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

customer/main/subcategories.tpl
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #10  
Old 04-23-2004, 07:07 PM
 
BHMedia BHMedia is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 71
 

Default

Hey Boomer - I tried it out - It does display the sub categories but when i click on one of them it just goes blank? Any ideas. 3.5.7... I restored the file and everything works fine? werid
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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:20 PM.

   

 
X-Cart forums © 2001-2018