X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Fancy Cats - Trying to show ALL cats + subcats by default (https://forum.x-cart.com/showthread.php?t=8912)

pipercub 08-13-2004 10:05 AM

Fancy Cats - Trying to show ALL cats + subcats by default
 
Boy, I didn't think this task would be so involved! What I'm trying to do is to create a category driectory which shows all Main Cats as well as Sub Cats without the need to 'expand'. I got this to work (kinda) without the fancy cats add-on, but it displayed my sub cats weird.

So anyway, I purchased the Fancy Cats Add-On in hopes of making life simple. Well, I could do exactly what I need to do if I could only get the 'Catagories' menu to show the entire expanded category 'tree' by default.

Has anyone attempted this?

Thanks,
Piper

shan 08-16-2004 12:31 PM

instead of looping {$categories} in categories.tpl loop through {$allcategories} instead

pipercub 08-25-2004 03:54 AM

Quote:

Originally Posted by shan
instead of looping {$categories} in categories.tpl loop through {$allcategories} instead


Shan, that worked very well, but It does not give me the control over the appearance of the cats & sub cats like I need. The mod will display like this:

Cat 1
Sub cat 1a
Sub cat 1b
Sub cat 1c
Cat 2
sub cat 2a
sub cat 2b
sub cat 2c
Cat 3
sub cat 3a
sub cat 3b
sub cat 3c

However, I really need to have controll over the look of the categories vs. the sub catagories. In other words, lets say I want to have all of the categories show up in a 14pt Bold typeface, but I want all of the sub cats to be 12pt regular. I know this can be done via CSS, but because I am currently looping the entire list as shown above, I have no control over those parameters.

That's why I bought the Fancy Categories module. I had hoped that I would gain control over the styles of the cats vs the sub cats. With Fancy Cats, I was able to display all of the cats & sub cats by default (with control over the styles), but when the user clicks on a sub cat, the list doubles up on the sub cats for the parent. Like this: (this is what I get when you click on a sub cat. In this case, it could have been 1a, 1b or 1c)

Cat 1
Sub cat 1a
Sub cat 1b
Sub cat 1c
Sub cat 1a
Sub cat 1b
Sub cat 1c
Cat 2
sub cat 2a
sub cat 2b
sub cat 2c
Cat 3
sub cat 3a
sub cat 3b
sub cat 3c

I am still trying to figure this out so if anyone has any input, please chime in!

Thanks,
Piper

PoloJohn 08-25-2004 04:41 AM

sorry to hijack but to list catergories like this

Main
Sub A
Sub B
SubC
Main 2
Main 3

so that the active one shows the sub cats then what wud i need to do, heres my code

Quote:

{* $Id: categories.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"}
{else}
{if $config.General.root_categories eq "Y"}
{section name=cat_num loop=$categories}
<FONT class="CategoriesList">{$categories[cat_num].category}</FONT>

{/section}
{else} {section name=cat_num loop=$subcategories}
<FONT class="CategoriesList">{$subcategories[cat_num].category}</FONT>

{/section}
{/if}
{/if}
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu }

abcohen 09-29-2005 12:38 PM

but this still doesnt anwser the Fancy Categories, if you have say something like Paper product and then lots of sub categories how do you auto expand the fancy categories explorer theme to default show the first round of Subcategories...

abcohen 11-07-2005 12:01 PM

I had posted this over a month ago with no reply... so I'd like to try again... I'm using fancy categories...

Right now when you see my cart its like this...

+ Categorie1


What I want to have is if no products are listed in it then to expand to show the subcategories ie

- Categorie1
+ subcat1
+ subcat2

did anyone hack the fancy categories to do this... or can help me out. thanks.

TelaFirma 11-07-2005 12:21 PM

Forget Fancy Categories.
  • Causes Code Bloat
  • Will not really accomplish what you need

If all you have is two levels (category and category///subcategory) then try this code:

Code:

{section name=cat_num loop=$allcategories}
{if $allcategories[cat_num].parentid eq 0}
        <font class="CategoriesList">{$allcategories[cat_num].category}</font>

{/if}
{if $allcategories[cat_num].subcategory_count gt 0}
   
{section name=sub_num loop=$allcategories}
{if $allcategories[sub_num].parentid eq $allcategories[cat_num].categoryid}
        <font class="SubCategoriesList"> - {$allcategories[sub_num].category}</font>

{/if}
{/section}

{/if}
{/section}


You will need to define the two classes used (CategoriesList and SubCategoriesList) in your CSS file.

ming_wistongroup 11-17-2005 02:00 PM

Inspire of TelaFirma's code and combine with Fancy Cat: Explorer mod, here is my hack:

fancy_categories.tpl
Code:

{* $Id: fancy_categories.tpl,v 1.9.2.8 2005/11/17 12:43:30 ming Exp $ *}
{assign var="rootcounter" value="0"}<SPAN class="VertMenuItems">
{foreach from=$allcategories item="category" key="categoryidx"}
{if $category.depth eq "0"}
{if $fancy_categories_variable_nowrap_categories eq "Y"}<NOBR>{/if}{$category.category|escape}{if $fancy_categories_variable_nowrap_categories eq "Y"}</NOBR>{/if}

{if $category.expanded ne "0" || $fancy_categories_variable_full_js eq "Y"}
{assign var="next_last_in_chain" value=$last_in_chain}
{if $rootcounter eq $allcategoriesroot}
{assign_ext var="next_last_in_chain[]" value="Y"}
{else}
{assign_ext var="next_last_in_chain[]" value="N"}
{/if}
{include file="`$fancycategories_config.modules_path`/fancy_subcategories.tpl" parencategory=$category.categoryid last_in_chain=$next_last_in_chain}
{/if}
{/if}
{/foreach}
</SPAN>


fancy_subcategories.tpl
Code:

{* $Id: fancy_subcategories.tpl,v 1.9.2.7 2005/11/17 12:43:30 ming Exp $ *}
{if $parencategory ne "0"}
{foreach from=$allcategories item="category" key="categoryidx"}
{if $category.categoryid eq $parencategory}
{math equation="x+1" x=$category.depth assign="indent"}
{assign var="rootcounter" value="0"}
{foreach from=$category.childcategoryidx item="chcategory" key="chcategoryidx"}
{math equation="x+1" x=$rootcounter assign="rootcounter"}
{section name=indentsteps loop=$last_in_chain}{/section}
{if $allcategories[$chcategory].subcategory_count gt 0}{if $fancy_categories_variable_nowrap_categories eq "Y"}<NOBR>{/if}{$allcategories[$chcategory].category|escape}{if $fancy_categories_variable_nowrap_categories eq "Y"}</NOBR>{/if}

{else}
{if $fancy_categories_variable_nowrap_categories eq "Y"}<NOBR>{/if}{$allcategories[$chcategory].category|escape}{if $fancy_categories_variable_nowrap_categories eq "Y"}</NOBR>{/if}

{/if}
{if $allcategories[$chcategory].expanded ne "0" || $fancy_categories_variable_full_js eq "Y"}
{assign var="next_last_in_chain" value=$last_in_chain}
{if $rootcounter eq $category.childcategory_number}
{assign_ext var="next_last_in_chain[]" value="Y"}
{else}
{assign_ext var="next_last_in_chain[]" value="N"}
{/if}
{include file="`$fancycategories_config.modules_path`/fancy_subcategories.tpl" parencategory=$allcategories[$chcategory].categoryid last_in_chain=$next_last_in_chain}
{/if}
{/foreach}
{/if}
{/foreach}
{/if}


Note 1: Icon indent does not support.
Note 2: I feel dumb since I modified a bloat-code. It's not innovation... :(
Note 3: If you'd like to see what it looks like, goto: http://www.wgdirect.com

Raptor 01-30-2006 03:33 AM

Is there any way to show all categories and sub categories but not sub categories of sub categories.

So basically it shows...

Main 1
- Sub 1
- Sub 2
- Sub 3

Instead of...

Main 1
- Sub 1
- Sub Sub 1
- Sub Sub 2
- Sub 2
- Sub 3

wildelectronics 10-18-2006 11:11 PM

Re: Fancy Cats - Trying to show ALL cats + subcats by default
 
Hi, I tried this mod with some serious problems.

Please see www.wildelectronics.com.au/store/customer

First of all, the categories are back to the way they used to be, with "Gifts for him/Her" in the left menu. They were previously invisible there, only to be in the GIFT section.

Also, when you click into a category, you'll notice the words up top are screwed up.

Does anyone know how I can restore this?

Regards Kurt
X-Cart 3.5.5


All times are GMT -8. The time now is 02:26 PM.

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