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


All times are GMT -8. The time now is 06:27 PM.

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