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

Awesome SubCat mod with a bit of help

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-27-2005, 05:26 PM
 
jburba2000 jburba2000 is offline
 

Advanced Member
  
Join Date: Dec 2003
Location: Oklahoma
Posts: 66
 

Default Awesome SubCat mod with a bit of help

I've got this awesome subcat mod, and would be willing to share it if I can get a bit of help from the Community.

created: customer/subcat.tpl
Code:
{capture name=subcatdiag} {assign var="tmp" value="0"} {section name=cat_num loop=$subcategories} {if $subcategories[cat_num].category}{assign var="tmp" value="1"}{/if} {/section} {foreach from=$subcategories item=subcat} <FONT class="SubCategoriesList">{ $subcat.category|escape }</FONT> <FONT class="Text">{if $config.Appearance.count_products eq "Y"} {if $subcat.product_count gt "0"}({ $subcat.product_count }){/if} {/if}</FONT> {/foreach} {/capture} {if $subcat ne ""} { include file="submenu.tpl" menu_title=$current_category.category menu_content=$smarty.capture.subcatdiag} {/if}

created: submenu.tpl
Code:
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%"> <TR> <TD> <TABLE border="0" cellpadding="0" cellspacing="0" width="100%"> <TR> <TD><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="CatHeadLeft">[img]{$ImagesDir}/spacer.gif[/img]</td> <td class="CatHeadSpacer" width="100%">{if $link_href} <FONT class="VertMenuTitle">{$menu_title}</FONT> {else} <FONT class="VertMenuBoxNewsTitle">{$menu_title}</FONT> {/if} </td> <td class="CatHeadRight">[img]{$ImagesDir}/spacer.gif[/img]</td> </tr> </table> </TD> </TR> <TR> <TD><table class="VertMenuBorder" width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td><TABLE class="VertMenuBox" border="0" cellpadding="0" cellspacing="0" width="100%"> <TR> <td class="CatLeftSpacer">[img]{$ImagesDir}/spacer.gif[/img]</td> <TD class="SubCatHeadT" width="100%">{$lng.lbl_subcategories} </TD> <td class="CatRightSpacer">[img]{$ImagesDir}/spacer.gif[/img]</td> </TR> <TR> <TD class="SubCatDiv" width="100%" colspan="3">[img]{$ImagesDir}/spacer.gif[/img]</TD> </TR> <TR> <td class="SubCatHeadSpacerL">[img]{$ImagesDir}/spacer.gif[/img]</td> <TD class="SubCategoriesList" width="100%">{$menu_content} </TD> <td class="SubCatHeadSpacerR">[img]{$ImagesDir}/spacer.gif[/img]</td> </TR> <TR> <TD class="SubCatDiv" width="100%" colspan="3">[img]{$ImagesDir}/spacer.gif[/img]</TD> </TR> <TR> <td class="SubCatHeadSpacerL">[img]{$ImagesDir}/spacer.gif[/img]</td> <TD width="100%"></TD> <td class="SubCatHeadSpacerR">[img]{$ImagesDir}/spacer.gif[/img]</td> </TR> </TABLE></td> </tr> </table> </TD> </TR> </TABLE> </TD></TR> </TABLE>

1st Question
Down at the bottom of the 2nd code:
Code:
<TD width="100%"></TD> <td class="SubCatHeadSpacerR">[img]{$ImagesDir}/spacer.gif[/img]</td> </TR> </TABLE></td> </tr> </table> </TD> </TR> </TABLE> </TD></TR> </TABLE>

in the empty <TD width="100%"></TD> tags, is where the manufacturer information will go that I am trying to figure out. What I need is to be able to list the vendors in that subcategory and any sub/subcategories. Has anyone figured out how to do this yet?

2nd Question
How would you modify the product.count to be able to show the total products in all sub/subcategories in subcategories?

You can view my partially completed code here: http://www.mindells.com/home.php
and then clicking on the "Pumps" category to see how the site changes with this mod. You can then click on the "Replacement Parts" subcategory to see the count problem from my 2nd question.

the subcategory information out in the middle will be gone when this mod is completed.
__________________
Mindells.com - Your Style. Your Comfort. Your Way.
X-Cart Platinum - 4.6.1
Reply With Quote
  #2  
Old 04-27-2005, 10:48 PM
 
jburba2000 jburba2000 is offline
 

Advanced Member
  
Join Date: Dec 2003
Location: Oklahoma
Posts: 66
 

Default

Alright, I know I'm on the verge of this. What I am trying to get it to say is "If no subcategories under current category, show manufacturers for all products in this subcategory" This is my first mod, and I really think it is a major one once I get it completed. I'd think Boomer or someone might know how to appreciate this one, and would probably have a bit more knowledge on the 'ifs and thens' than I.

customer/subcat.tpl
Code:
{* $Id: subcat.tpl,v 1.0 2005/04/23 10:25:49 jburba2000 Exp $ *} {capture name=subcatdiag} {assign var="tmp" value="0"} {assign var=lowermostcat value=$current_category.categoryid_path|regex_replace:"/\/.*/":""} {section name=cat_num loop=$subcategories} {if $subcategories[cat_num].category}{assign var="tmp" value="1"}{/if} {/section} {foreach from=$subcategories item=subcat} {if $subcategories[cat_num].category ne "1"} <FONT class="SubCategoriesList">{ $subcat.category|escape }</FONT> {else} {section name=mid loop=$manufacturers_menu} <FONT class="SubCategoriesList">{$manufacturers_menu[mid].manufacturer}</FONT> {/section} {/if} {if $config.Appearance.count_products eq "Y"} {*** if $subcat.product_count gt "0" ***}<FONT class="Text">({ $subcat.product_count})</FONT>{*** /if ***} {/if} {/foreach} {/capture} { include file="submenu.tpl" menu_title=$current_category.category menu_content=$smarty.capture.subcatdiag}
__________________
Mindells.com - Your Style. Your Comfort. Your Way.
X-Cart Platinum - 4.6.1
Reply With Quote
  #3  
Old 04-29-2005, 10:07 AM
  shipmerchant's Avatar 
shipmerchant shipmerchant is offline
 

eXpert
  
Join Date: Mar 2005
Posts: 361
 

Default Great job!

Hi jburba2000,

I think you mods looks great, sorry I can be of any help, I am a rookie still trying to figure out how to get the contact, about us tabs out from the standard top right section, and place them in an area similar to your catagorie section.

This way I can free up the top section to place a larger logo, across the top...

__________________
Mil Mascaras
Live Xcart Site #1-V- 4.1.8
Live Xcart site # 2-V 4.4.3
CDSEO Mod - Firetank MM30 - 7DANA- The bestTemplates!
Linux - EWD Host Servers awesome service!
AlteredCart One Page Checkout
Reply With Quote
  #4  
Old 08-02-2005, 06:00 AM
 
luksamedia luksamedia is offline
 

Newbie
  
Join Date: Aug 2005
Posts: 1
 

Default This is what I need!!!

This is what I need. How exactly are you you listing the main category heading with a list of the sub categories?

THanks!
__________________
LiteCommerce v.2.1
Reply With Quote
  #5  
Old 08-02-2005, 08:42 AM
 
jburba2000 jburba2000 is offline
 

Advanced Member
  
Join Date: Dec 2003
Location: Oklahoma
Posts: 66
 

Default

Lite-commerce, Ive had zero experience with. What I basically did was this:

1. Copy the menu.tpl (which is basically just the html look of it) and paste it as submenu.tpl, making minor changes to the template just for the looks.
2. Create customer/subcat.tpl and add the following:
Code:
{* $Id: subcat.tpl,v 1.0 2005/04/23 10:25:49 jburba2000 Exp $ *} {capture name=subcatdiag} {assign var="tmp" value="0"} {section name=cat_num loop=$subcategories} {if $subcategories[cat_num].category}{assign var="tmp" value="1"}{/if} {/section} {foreach from=$subcategories item=subcat} {if $tmp ne "1"} {$lng.lbl_my_account}{else} <FONT class="SubCategoriesList">{ $subcat.category|escape }</FONT> {*** section name=mid loop=$manufacturers} <FONT class="SubCategoriesList">{$products.manufacturer}</FONT> {/section ***} {/if} {if $config.Appearance.count_products eq "Y"} {if $subcat.product_count gt "0"}<FONT class="Text">({ $subcat.product_count})</FONT>{/if} {/if} {/foreach} {/capture} { include file="submenu.tpl" menu_title=$current_category.category menu_content=$smarty.capture.subcatdiag}

(the quoted out part being the manufacturers listing for all products in that category and subcategories, because I do not have it working yet.)

3. Change home.tpl from:
Code:
{ include file="customer/categories.tpl" } {/if}
to:
Code:
{if $current_category.category ne ""} { include file="customer/subcat.tpl" } {/if} { include file="customer/categories.tpl" } {/if}
__________________
Mindells.com - Your Style. Your Comfort. Your Way.
X-Cart Platinum - 4.6.1
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 08:44 AM.

   

 
X-Cart forums © 2001-2020