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)
-   -   Grouping Categories for better viewing (https://forum.x-cart.com/showthread.php?t=8237)

BCSE 06-24-2004 06:10 PM

Grouping Categories for better viewing
 
I've done this for a customer and helped someone out on the forums with this and thought it might be useful to post here.

This will basically get you started on how to group your main categories for better readability for those of you with lots of main categories. This can be greatly expanded to include image dividors, Headings to each of the groups, etc. I have this as a free tip on my site and thought I'd copy and paste the tip for everyone here too.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTE: You should always make a back-up copy of your files and/or database before installing any modification.

This tip will help group categories with a line break, horiziontal rule, image, etc. inbetween category groups.


Look for a section of code in skin1/customer/categories.tpl that looks like this:
Quote:

{if $config.General.root_categories eq "Y"}
{section name=cat_num loop=$categories}
<font class=CategoriesList>{ $categories[cat_num].category_name|escape }</font>

{/section}
{else}


and change it to this:


Quote:

{if $config.General.root_categories eq "Y"}
{section name=cat_num loop=$categories}

{if $categories[cat_num].order_by eq 50 || $categories[cat_num].order_by eq 100 || $categories[cat_num].order_by eq 150}

{* NOTE: CHANGE THIS
TO BE WHAT EVER YOU WANT TO DIVIDE THE CATEGORIES *}
{/if}

<font class=CategoriesList>{ $categories[cat_num].category_name|escape }</font>

{/section}
{else}


You can change the noted
to a <HR> or an image or anything else you'd like to use to separate your categories.

Example, all the categories in the first grouping have a position number less than say, 50. The next section is between 50-100, next 100-150, etc. This means that the categories you want to show up at the top of the sections will have to have category position, 50, 100, and 150 in this example. You can change the 50, 100, 150 to be what ever position numbers you want and you can add more "or"s to the if statement.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hope this helps some!! :)

Carrie

skyking 01-16-2005 09:40 PM

You do good work!;-)
This is just what I was looking for on a new project, thank you much.

BCSE 01-31-2005 07:32 AM

I have finally implemented this on my site. So you can see an example of what you can do with this simple mod there. (http://www.bcsengineering.com/store/catalog)

Here's the exact code for on my site (notice the part set off in the middle is the new part):

Code:

if $config.General.root_categories eq "Y"}
{section name=cat_num loop=$categories}

{if $categories[cat_num].order_by eq 0}
{$lng.lbl_heading1}
{elseif $categories[cat_num].order_by eq 80}
{$lng.lbl_heading2}
{elseif $categories[cat_num].order_by eq 90}
{$lng.lbl_heading3}
{elseif $categories[cat_num].order_by eq 150}
{$lng.lbl_heading4}
{/if}

<font class=CategoriesList>{$categories[cat_num].category_name}</font>

{/section}


Carrie

Khar 02-01-2005 06:36 PM

How did you center your headings??

BCSE 02-01-2005 06:47 PM

Khar,

Here's an example lable for my site:
lbl_heading1 is:
Quote:

<center>X-cart Mods</center>

Does that help? I left the full control to be in the heading lable.

Carrie

Khar 02-01-2005 07:00 PM

Perfect!!!

Thanks again.

rjcbear 02-01-2005 08:29 PM

YEAH!!!! Carrie. Big time Kuddos for you.

Thank you so much

Freakmode 03-10-2005 06:46 AM

Hi

I tried this for 4.012 and it just shows nothing in the categories box.

I have checked that I have the cats numbered corectly but no joy.

Is it different on 4.012 or should it work?

BCSE 03-10-2005 06:55 AM

Can you post the code you changed?

Thanks,

Carrie

WPOO 04-18-2005 11:59 PM

Will this work for products aswell?
 
I would like to have this work with products as well.

Example:

Memory -> PC266
PC333
PC400

I would like to list all PC266 memory first then the PC333 and then the PC400

Is there a way to do this?

Regards WP

WPOO 04-28-2005 12:10 PM

Does anyone know if it is possible.
 
I trying to get all my products under a cateory in a list. does anyone know how to do this?

Example:

Computers Shuttle:

Product Price Information
-------------------------------------------------------------------------------
product 1 100 yes
-------------------------------------------------------------------------------
product 2 184 yes
-------------------------------------------------------------------------------product 3 190 yes
-------------------------------------------------------------------------------



is this possible?

Thanks in advance for any answers.

WP

BCSE 05-01-2005 12:55 PM

I'm not sure what you mean as the products in X-cart are listed under a category. ??

Maybe picture would be helpful of what you want it to look like?

Carrie

artinion 05-03-2005 08:54 PM

I liked the example on the reffered web site.. Is there a way to create separate category listings in separate boxes? The example shows separate category listings but are grouped together in one box.

I am developing our new look on 4.0.12. Has anyone tried using the sample code on 4.0.12 with success? How was your mileage?

ainion

BCSE 05-16-2005 09:39 PM

Yes you should be able to do that. Would be a bit trickier. Did you get it figured out? I realize I"m responding quite a bit after you last posted.

Carrie

IndieDepot 05-21-2005 02:40 AM

Carrie,

I get the same "Blank Box" that 01bodyjewellery clamined to have gotten.

I backed up my original and copy/pasted your code above exactly as you instructed us to. After refresh, categories box comes back blank. Here is my entire modified categories.tpl file that i modified according to your instructions above:


Code:

{* $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}

{if $categories[cat_num].order_by eq 50 || $categories[cat_num].order_by eq 100 || $categories[cat_num].order_by eq 150}

 {* NOTE: CHANGE THIS
 TO BE WHAT EVER YOU WANT TO DIVIDE THE CATEGORIES *}
{/if}

<font class=CategoriesList>{ $categories[cat_num].category_name|escape }</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 }


Using the above code, i get a blank categories box.

Now I will say this....
You told us to "Look for a section of code in skin1/customer/categories.tpl that looks like this: " and i find that my code is not exactly the same as the code you told us to look for. It is identical except for the a href link code.

The code you told us to look for:
Code:

<font class=CategoriesList>{ $categories[cat_num].category_name|escape }</font>

The code of my original file:
Code:

<FONT class="CategoriesList">{$categories[cat_num].category}</FONT>

Notice Carrie the difference towards the end of my code and how it's missing a few things. Welp, that's the way it came from the factory. Maybe 4.0.13 has a totally different categories.tpl file that will not work with your cool mod.

Hopefully you can check it out for us. *smile*

I am going back to FunkyCategories for the time being.

- Shannon

BCSE 05-21-2005 07:13 PM

My code was for version 3.x Looks like version 4 needs a slight change. Try this:

Code:

{* $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}

{if $categories[cat_num].order_by eq 50 || $categories[cat_num].order_by eq 100 || $categories[cat_num].order_by eq 150}

 {* NOTE: CHANGE THIS
 TO BE WHAT EVER YOU WANT TO DIVIDE THE CATEGORIES *}
{/if}

<font class=CategoriesList>{ $categories[cat_num].category_name|escape }</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 }


Let me know if that works and I'll include both in my free mod. Should work fine.

Thanks!

Carrie

AgileMolecule 05-21-2005 08:00 PM

Carrie-

This is exactly what I need but as I am an XCart virgin I really need a bit of guidance here if you have the time. Thanks in advance!

I am not understanding how the categories populate the menu area once this code is put in place. I can insert for example text or a line where you have directed us and it does show up fine but I just don't see any of the actual categories rendering.

I am obviously missing something here. Can you advise?

AgileMolecule 05-21-2005 08:53 PM

Got it to work- two of the classes did not have quotations and what do I know but when I took out the "return" it worked so hopefully this helps someone out- Thanks for the work on your end Carrie this has really helped me out.

Code:

{* $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}
{if $categories[cat_num].order_by eq 50 || $categories[cat_num].order_by eq 100 || $categories[cat_num].order_by eq 150}

 --------------------{* NOTE: CHANGE THE LINES TO BE WHAT EVER YOU WANT TO DIVIDE THE CATEGORIES *}
{/if}
<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 }


AgileMolecule 05-21-2005 09:08 PM

More lame coding from an XCart virgin.....

I imagine you pros can rip this to shreds but maybe it will help someone out-

Try this one out:

Remember to set your initial category numbers in the admin side according to what is in original Carrie's code- I just tweaked it a tad more here as an example.

Code:

{* $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}

{if $categories[cat_num].order_by eq 5}

COOL STUFF AAA

{/if}
{if $categories[cat_num].order_by eq 50}

COOL STUFF BBB

{/if}
{if $categories[cat_num].order_by eq 100}

COOL STUFF CCC

{/if}
{if $categories[cat_num].order_by eq 150}

COOL STUFF DDD

{/if}
<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 }


IndieDepot 05-22-2005 12:21 PM

Carrie,
Thanks, but it did not work again. However AgileMolecule must have done something different. I guess the quotes on the classes did the trick.

Thanks BCSE & AgileMolecule for getting this to work with 4.0.13:

Carrie this would be a great addition to your FREE area on your wonderful website.

To end this discussion here's the code for everybody using 4.0.13 X-Cart. This should replace your entire /customer/categories.tpl file:

this works fine in 4.0.13 written by BCSE:

Code:

{* $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}
{if $categories[cat_num].order_by eq 50 || $categories[cat_num].order_by eq 100 || $categories[cat_num].order_by eq 150}

 --------------------{* NOTE: CHANGE THE LINES TO BE WHAT EVER YOU WANT TO DIVIDE THE CATEGORIES *}
{/if}
<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 }


this is a fancier version with custom headings for each section for 4.0.13 created by BCSE & upgraded by AgileMolecule:

Code:

{* $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}

{if $categories[cat_num].order_by eq 5}

COOL STUFF AAA
 
{/if}
{if $categories[cat_num].order_by eq 50}

COOL STUFF BBB
 
{/if}
{if $categories[cat_num].order_by eq 100}

COOL STUFF CCC
 
{/if}
{if $categories[cat_num].order_by eq 150}

COOL STUFF DDD
 
{/if}
<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 }


- Shannon

BCSE 05-23-2005 05:56 AM

Glad you guys got it working! :)

Carrie

BCSE 08-26-2005 06:21 PM

I have an even better mod to do this same thing now. It will allow category headings in the main Root category menu and/or in the subcategories!!

Check it out! It's free!

http://www.bcsengineering.com/store/customer/product.php?productid=125&MMCF_cathead

Carrie

zardos 08-27-2005 05:54 AM

Hi IndieDepot

Try this

Skin1/customer/categories.tpl

Code:

{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}
{if $categories[cat_num].order_by eq 5}

<FONT class="CategoriesList2">Latest PC Systems.</FONT><HR>
{/if}
{if $categories[cat_num].order_by eq 10}

<FONT class="CategoriesList2">Main Categories.</FONT><HR>
{/if}
{if $categories[cat_num].order_by eq 90}

<FONT class="CategoriesList2">Latest PC Cases.</FONT><HR>
{/if}
{if $categories[cat_num].order_by eq 100}

<FONT class="CategoriesList2">Latest Gadgets.</FONT><HR>
{/if}[*]<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}


Thanks to Carrie at BCSE and AgileMolecule.

Add this to your CSS under CategoriesList.

Code:

.CategoriesList2 {
        FONT-SIZE: 12px;
        FONT-WEIGHT: bold;
}


This works fine in 4.0.14

MaDgamEr 01-28-2006 09:30 PM

Has anyone managed to get this (or a similar concept) to work with Fancy Categories? I've been playing around with it for a little while, but no real results yet....

Any help would be GREATLY appreciated. Thanks in advance.

BCSE 01-31-2006 12:39 PM

Sorry for our delayed reply. We've been swamped with questions, quotes, etc the past 2 weeks (well the whole month actually).

Are you trying to get the category headings to work or the grouping of categories??

Thanks,

Carrie

MaDgamEr 02-01-2006 06:59 PM

Not a problem, I understand we all get busy... and its better to have a business that is busy (making money) as compared to one that is not busy (losing money). 8)

I was looking to break up my categories into 2 or 3 groups and then list the approperiate categories (or category group I guess) listed under a heading.

Heading 1
*Cat 1
*Cat 2
*Cat 3

Heading 2
*Cat 4
*Cat 5
*Cat 6

and so on...

Raptor 02-09-2006 05:20 AM

The code provided doesn't work in 4.1.0 ?

Raptor 02-09-2006 06:14 AM

The code on 4.1.0 is like this...

Code:

{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="modules/Fancy_Categories/categories.tpl"}
{assign var="fc_cellpadding" value="0"}
{else}
{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
<font class="CategoriesList">{$c.category}</font>

{/foreach}
{else} {foreach from=$subcategories item=c key=catid}
<font class="CategoriesList">{$c.category}</font>

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


Can anyone convert it so I can have my sub categories back?

jmccunep 02-11-2006 11:59 AM

Categories headings
 
Quote:

Originally Posted by AgileMolecule

Remember to set your initial category numbers in the admin side according to what is in original Carrie's code- I just tweaked it a tad more here as an example.

Code:

{* $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}

{if $categories[cat_num].order_by eq 5}

COOL STUFF AAA

{/if}
{if $categories[cat_num].order_by eq 50}

COOL STUFF BBB

{/if}
{if $categories[cat_num].order_by eq 100}

COOL STUFF CCC

{/if}
{if $categories[cat_num].order_by eq 150}

COOL STUFF DDD

{/if}
<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 }



When you say to set the initial category numbers on admin side you must mean the to do so by setting the category position numbers?

Thanks for the help!

X-Cart v 4.0.17

bestdu 02-21-2006 10:14 AM

hey guys,

why did I have to change the eq to <, to get it work?

Touchy 02-22-2006 08:12 AM

Hi everyone,

x-cart Pro v.4.0.17

I would like to use this code to create a page break after every 15 categories.

I tried the BCSE code and my categories did not show up, then I tried the AgileMolecule code and the categories displayed properly but I did not get the desired effect of having a break after every 15 categories. I could not get a line break
or a horizontal rule <hr> (did not even try a page break yet).

Any suggestions on how to do this using this code or other code would be appreciated.

Thank you.

webtron 03-15-2006 01:28 PM

Carrie BSCE,

Does the code below been tested susscessfuly with 4.0.17?

Do I still need to group them by numbers (between 50-100, next 100-150, etc.)
I noticed on your site, you're not grouping them by number. How you do this?

Thanks.


Quote:

Originally Posted by BCSE
I have an even better mod to do this same thing now. It will allow category headings in the main Root category menu and/or in the subcategories!!

Check it out! It's free!

http://www.bcsengineering.com/store/customer/product.php?productid=125&MMCF_cathead

Carrie


BCSE 03-16-2006 07:55 PM

Product 125 does not need the grouping by numbers that was needed for the first free mod mentioned in this thread. It actually adds the category heading to the category table in the database.

It has been tested on 4.0.x of X-cart. I haven't specifically tested it on 4.0.17 but I don't see why it wouldn't work for that one.

We are currently using the old one on our site as I unfortunatly don't have any time to do any work on my site besides keeping descriptions up-to-date and adding new products. Either free products are good for making Headings, but the 2nd on is a bit easier to install if I remember right. A bit easier to grasp how it works.

I hope this helps.

Thanks,

Carrie

webtron 03-16-2006 09:44 PM

Thanks Carrie...it helps.

Acquamarina 04-03-2010 07:01 AM

Re: Grouping Categories for better viewing
 
Hi,

I know this is an older post but I am hoping someone can help me complete this. Downloaded and installed the free mod from BCSEngineering but it won't sort the categories. I either get a line (hr) in between each category or none at all, regardless how the categories are numbered in admin.

Is there a max number of parameters?

Do the categories have to be grouped by sorting them with the same number or with numbers in between the parameters?

If anyone has any suggestions I would really appreciate it. I have been working on a new category display for over a week!

Has anyone made this work with 4.1.9?

accesspos 08-25-2010 12:18 AM

Re: Grouping Categories for better viewing
 
I would like it for 4.3.2 :-)

BCSE 08-27-2010 12:47 PM

Re: Grouping Categories for better viewing
 
Quote:

Originally Posted by accesspos
I would like it for 4.3.2 :-)


Make sure you drop us an email so we can get it in our queue.

Thanks!

Carrie


All times are GMT -8. The time now is 12:17 AM.

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