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

ALWAYS display first level subcats beneath root cats

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #71  
Old 03-22-2008, 04:41 PM
 
EN4U EN4U is offline
 

eXpert
  
Join Date: Feb 2008
Location: AZ
Posts: 379
 

Default Re: ALWAYS display first level subcats beneath root cats

How can this be achieved.... I believe this differs some from what i read here.

What we want is a header.... Then the categories within it.....

example...

Mens Toys <--This is just a header area it points to in BOLD. No link associated.
Product category <---- Category
Product Category <--- Category

Womens Toys<--This is just a header area it points to in BOLD. No link associated.
Product category <---- Category
Product Category <--- Category

When done its just a complete list of zones(header name) then the items within it and so forth.....
__________________
Regards, Dan
X-Cart Gold Version 4.1.10

1 - One page checkout
2 - Image Generator
3 - CSDEO Pro
4 - Shop By Price
5 - Next - Previous
6 - On Sale
7 - Shop By Price

8 - Froogle & Google Base Feed
9 - Buy Together
10 - Customer Loyalty Points
11 - Customer Reward Points
Customer Reward Points Referral Add-on
12 - Product Reviews
13 - Other Custom Modifications
----------------------
http://www.townsqjewelry.com/
http://www.eroticnights4u.com/ <---- Adult Oriented - Toys
Reply With Quote
  #72  
Old 03-23-2008, 02:24 AM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: ALWAYS display first level subcats beneath root cats

Quote:
Originally Posted by EN4U
How can this be achieved.... What we want is a header.... Then the categories within it.....

example...
Mens Toys <--This is just a header area it points to in BOLD. No link associated.
Product category <---- Category
Product Category <--- Category
Try adding the code from this Free Mod from BCSE...
Category Heading FREE X-cart Modification #125:
http://www.bcsengineering.com/store/catalog/Category_Heading_FREE_Xcart_Modification-p-125.html

From the mod description, "This mod allows you to EASILY add headings to any categories you want. You can add headings to subcategories or main categories."

I believe that sounds like what you are looking for.

Robert
__________________
X-cart 4.1.10
Reply With Quote
  #73  
Old 03-28-2008, 01:06 AM
  DrQuietus's Avatar 
DrQuietus DrQuietus is offline
 

Advanced Member
  
Join Date: Dec 2005
Posts: 81
 

Default Show categories on welcome.tpl - after the mod on this thread is installed

My client wanted the categories listed on the home page with custom icons. I already had the show subcategories only for the current category mod installed. I copied the categories.tpl and named it categories-home.tpl, trimmed it down a bit, and put an if statement on the main categories list item to display the different icons. Just thought I would post it because it is an easy way to add the categories to welcome.tpl if you already have the mod in this thread installed. For version 4.1.x

categories-home.tpl - You would obviously have to change the categoryid numbers to suit your project, and it could get out of control if you have a lot of categories:

Code:
{if $config.General.root_categories eq "Y"} <ul id="homecats"> {foreach from=$categories item=c} <li {if $c.categoryid eq "10"}id="pressure"{elseif $c.categoryid eq "12"} id="electrical"{elseif $c.categoryid eq "19"}id="temp"{elseif $c.categoryid eq "24"} id="humidity"{elseif $c.categoryid eq "26"} id="air"{elseif $c.categoryid eq "28"}id="light"{/if}><a class="mainhomecats" href="home.php?cat={$c.categoryid}">{$c.category}</a> <ul> {assign var=in value=$c.categoryid} {foreach from=$allsubcategories.$in item=c } <li><a class="subhomecats" href="home.php?cat={$c.categoryid}">{$c.category}</a></li> {/foreach} </ul> </li> {/foreach} </ul> {/if}

welcome.tpl add the following line:
Code:
{include file="customer/categories-home.tpl"}




CSS (could be a bit more trim - but this is easy to follow):
Code:
ul#homecats { margin: 0px; padding: 0px; list-style-type: none; text-align: left; padding-left: 15px; } ul#homecats li#pressure, ul#homecats li#electrical, ul#homecats li#temp, ul#homecats li#humidity, ul#homecats li#air, ul#homecats li#light { width: 250px; float: left; display: block; height: 180px; margin-left: 10px; } ul#homecats li#pressure { background: url(images/pressure.gif) no-repeat left top; } ul#homecats li#electrical { background: url(images/electric.gif) no-repeat left top; } ul#homecats li#temp { background: url(images/temp.gif) no-repeat left top; height: 130px; } ul#homecats li#humidity { background: url(images/humidity.gif) no-repeat left top; height: 130px; } ul#homecats li#air { background: url(images/air.gif) no-repeat left top; height: 130px; } ul#homecats li#light { background: url(images/light.gif) no-repeat left top; height: 130px; } ul#homecats a.mainhomecats { display: block; color: #1c1d47; padding-left: 50px; padding-top: 24px; padding-bottom: 5px; font-size: 16px; font-weight: normal; text-align: left; border-bottom: 1px solid #1c1d47; } ul#homecats a.mainhomecats:hover { text-decoration: none; color: #471d1d; } ul#homecats ul { margin: 0px; padding: 0px; padding-top: 5px; list-style-type: none; } ul#homecats ul a.subhomecats { } ul#homecats ul a.subhomecats:hover { }

final result: http://www.tek-inst.com/
__________________
Dave Jones
dave@industrialwebworks.net
Mostly 4.7.2 - 4.7.5
Reply With Quote
  #74  
Old 07-04-2008, 12:16 AM
 
Scotty85 Scotty85 is offline
 

Advanced Member
  
Join Date: Mar 2008
Posts: 94
 

Default Re: ALWAYS display first level subcats beneath root cats

I have this working in 4.1.9 pretty well, but have a couple of quirks with it. If I click on a subcat inside a subcat, it collapses the menu back to the main cats. Is there a way to keep them open no matter the depth level of subs? One more thing I'd like to see, if possible, is the ability to NOT open the main cat page when it's clicked on, but only expand down the menu to the first level of subcats for the one you clicked on. From there it would open the corresponding subcat page, and so-on.

Ideas?

Great mod so far though!

Scotty
__________________
Xcart Version 4.1.9
Upgraded to 4.1.10 (clean install with mods added back)
Reply With Quote
  #75  
Old 07-21-2008, 04:50 AM
 
TanyaG TanyaG is offline
 

Advanced Member
  
Join Date: Nov 2007
Posts: 94
 

Default Re: ALWAYS display first level subcats beneath root cats

Awasson, thanks a lot for a great mod. Could you advice how can I display 3rd level subcategories.

Root category A
- subcategory A1
- subcategory A2

--- subcategory A21
--- subcategory A22
- subcategory A3
Root category B

Root category C



Many thanks.
__________________
Tanya

x-cart version: 4.1.7 4.1.9. 4.2
Reply With Quote
  #76  
Old 07-28-2008, 12:53 PM
 
JasonMiller1975 JasonMiller1975 is offline
 

Newbie
  
Join Date: Jan 2008
Posts: 2
 

Default Re: ALWAYS display first level subcats beneath root cats

Fantastic thread everyone. A mashup of several posts gave me the solution I needed. Much appreciated!
__________________
Version 4.1.8
Reply With Quote
  #77  
Old 04-08-2009, 02:21 PM
  clik's Avatar 
clik clik is offline
 

Advanced Member
  
Join Date: Mar 2006
Location: Canada
Posts: 30
 

Default Re: ALWAYS display first level subcats beneath root cats

Hi,
I'm working on setting up a new online store with x-cart 4.2. Did anybody try to implement it (subcategories in the Category menu box)? I've tried to search in "Storefront Design & Template Editing in v 4.2.x" directory without any luck .
I would appreciate your help and I think everybody can profit as well.
clik
__________________
__________________
XC5: 5.3.4.4
PHP: 7.0.26
MySQL server: 5.5.56-MariaDB
Reply With Quote
  #78  
Old 04-16-2009, 07:41 AM
 
Jeremy Smith Jeremy Smith is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 167
 

Lightbulb Re: ALWAYS display first level subcats beneath root cats

Quote:
Originally Posted by dalmuti
Here is my categories.tpl file:

{* $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"><a href="home.php?cat={$c.categoryid}" class="VertMenuItems">{$c.category}</a></font><br />
{foreach from=$allcategories item=cat}
{if $cat.parentid eq $c.categoryid}<font class="CategoriesList"><a href="home.php?cat={$cat.categoryid}" class="VertMenuItems">{$cat.category}</a>
</font>
<br />
{/if}
{/foreach}
{/foreach}
{else} {foreach from=$subcategories item=c key=catid}
<font class="CategoriesList"><a href="home.php?cat={$catid}" class="VertMenuItems">{$c.category}</a></font><br />
{/foreach}
{/if}
{/if}

The text in bold will correct both issues for you.

Thanks,

Louise

I got this one working on our shop site.

But as we have up to 50 sub categories, your talking a very long list when a user goes into a root category, means having to scroll, scroll and yet more scrolling, just isnt feasible for our shop.

Is there anyone that knows of a way (I think this may have been posted previously but as I am rushed to get this working, I thought I would post this question).

Is there anyway of displaying a list drop down menu at the top, above the welcome message, of root level categories and then when a user selects a root category, it then displays the relevant sub categories, magically appears and then are able to select products from that sub category?

Thanks for your help,
Jeremy.
__________________
Version 4.1.11 on Linux (Fedora)
X-Cart Gold
Reply With Quote
  #79  
Old 04-24-2009, 03:12 AM
  SamsonWebDesign's Avatar 
SamsonWebDesign SamsonWebDesign is offline
 

Senior Member
  
Join Date: Oct 2008
Location: East Sussex, UK
Posts: 101
 

Default Re: ALWAYS display first level subcats beneath root cats

This thread (although great) has got so long and complicated now I can't find the solution!

I'm on 4.1.12 and I want to simply display on every page of the site in the categories.tpl as follows:

Category 1
Subcat 1A
Subcat 1B
Subcat 1C

Category2
Subcat 2A
Subcat 2B
Subcat 2C

If anyone has this for the last release of 4.1.12 could they please post the code!
__________________
Versions 4.1.11 to 4.6.4 ... when will the new versions end!

Custom X-Cart driven e-commerce sites, skins and installations at www.samsonwebdesign.co.uk
Reply With Quote
  #80  
Old 07-28-2009, 06:49 AM
 
Steve-C Steve-C is offline
 

Senior Member
  
Join Date: Jan 2006
Location: England
Posts: 172
 

Default Re: ALWAYS display first level subcats beneath root cats

Quote:
Originally Posted by awasson
Success!
Hopefully someone will benefit from the following (and previous) code and explanation.

The following mods will provide a hierarchy (list) of navigation links where the current top level item will be highlighted in CSS and a listing of the sub-categories listed out. If a sub-item or sub-category is currently in view then that particular sub-category will also be highlighted in CSS. This works for 4.15 but I'm not sure how or if it will work with earlier versions.

1) First and foremost, you'll have to modify your categories.php file as per Chris2002's instructions. POST #32

2) Now you'll have to edit your categories.tpl to output the list of links along with some methods to highlight the links. I found the post that was put up by Dalmuti POST #28 really helpful. Then I had to do some research and mind numbing experimentation with the changes introduced by the categories.php mod until I got it figured out.

My categories.tpl now looks like this:
Code:
<div id="sidenavcontainer"> {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"} <ul> {foreach from=$categories item=c} {if $cat eq $c.categoryid || $current_category.parentid eq $c.categoryid} <li><h3><a class="current" href="home.php?cat={$c.categoryid}">{$c.category}</a></h3></li> {else} <li><h3><a href="home.php?cat={$c.categoryid}">{$c.category}</a></h3></li> {/if} {assign var=in value=$c.categoryid} {* CONDITIONAL DROP DOWN ITEMS FROM TOP CATEGORY *} {if $current_category.parentid eq $c.categoryid || $cat eq $c.categoryid} {foreach from=$allsubcategories.$in item=c } {if $cat eq $c.categoryid} <li><h4><a class="current" href="home.php?cat={$c.categoryid}">{$c.category}</a></h4></li> {else} <li><h4><a href="home.php?cat={$c.categoryid}">{$c.category}</a></h4></li> {/if} {/foreach} {/if} {* /CONDITIONAL *} {/foreach} {else} {foreach from=$subcategories item=c key=catid} <li><h3><a href="home.php?cat={$catid}">{$c.category}</a></h3></li> {/foreach} {/if} </ul> {/if} </div>

3) There is a CSS stylesheet that accompanies this mod and provides some indentation, fonts size and highlighting. I'm using heading tags <h3> & <h4> to provide some semantic sense to the categories and also it lets me indent them and adjust the text as much as I want through the stylesheet.

Categories & Sub-cats are black
Highlighted categories and sub-cats are bright green
Rollovers are red

It goes a little like this:
Code:
/** * sidenavcontainer is 181px wide and a minimum of 400px high * It has a little padding top and bottom as well * Modify it to suit your layout */ html, body, ul, ol, li, p, h1, h2, h3, h4, h5, h6, form, fieldset, a { margin: 0; padding: 0; border: 0; } #sidenavcontainer { padding:20px 0 10px 0; width:181px; min-height:400px; float:left; } h3{ /* PRODUCT CATEGORIES */ padding:0; margin:0; font-size:12px; font-style:normal; font-weight:bold; } #sidenavcontainer h3 { margin:0 0 0 30px; padding:10px 0; } h4{ /* PRODUCT SUB-CATEGORIES */ padding:0; margin:0; font-size:11px; font-style:normal; font-weight:normal; } #sidenavcontainer h4 { margin:0 0 0 40px; padding:0; padding-bottom:7px; } #sidenavcontainer a { color:#000000; text-decoration:none; } #sidenavcontainer a:hover { color:#FF0000; text-decoration:none; } #sidenavcontainer .current { color:#00FF00; }

I got a whole lot of help through searching and reading the previous posts about this and I hope this helps someone else too.

Cheers,
Andrew

I followed this and it works great in v4.1.8.

I've been trying to mod the code to stop the categories WITH subcats linking to the subcats page, just the categories WITHOUT subcategories to link.

I would like the categories with subcats to just open the list of subcats in the menu for further selection but not change page until a subcat is clicked.

Could anyone possibly help, I've tried all kinds of things but am stuck !!

Cheers
Steve
__________________
X-Cart Gold v 4.3.2
X-AOM, Marketing Manager, On Sale
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 07:39 PM.

   

 
X-Cart forums © 2001-2020