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)
-   -   Awesome SubCat mod with a bit of help (https://forum.x-cart.com/showthread.php?t=13671)

jburba2000 04-27-2005 05:26 PM

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.

jburba2000 04-27-2005 10:48 PM

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}


shipmerchant 04-29-2005 10:07 AM

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...

:wink:

luksamedia 08-02-2005 06:00 AM

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!

jburba2000 08-02-2005 08:42 AM

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}



All times are GMT -8. The time now is 03:14 PM.

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