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

Highlight current page in speedbar

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-03-2010, 01:18 PM
  FTI's Avatar 
FTI FTI is offline
 

Senior Member
  
Join Date: Oct 2009
Location: Plovdiv, Bulgaria
Posts: 153
 

Default Highlight current page in speedbar

Hi there, currently I'm trying to highlight the speedbar link for the current page on which the user is. See the attached image to get my idea. So basicly when a user clicks on contacts in the speed bar, the contacts box link stays highlighted, which will make the menu more user-friendly. At first I thought this could be done with the active link property in CSS, but unfortunatelly it can't. So I've searched google and found out a way, but I'm not quite sure how to integrate this with X-Cart, so what we should do is assign id for the body of each page we have link to in the speed bar like this:

Code:
<body class=■home■>

And after that for each link we must add a custom class like this:

Code:
<ul> <li><a href=■home■ class=■home■>Home</a> <li><a href=■articles.html■ class=■articles■>Articles</a> <li><a href=■blog.html■ class=■blog■>Blog</a> ┘ etc┘ </ul>


And then we must add the custom classes in our CSS like this:


Code:
body.home a.home, body.articles a.articles, body.blog a.blog { background-color: green; }

That sounds reasonable when we are dealing with HTML, but how to do this with X-Cart and Smarty. I really need this one and it is a feature, that everybody will enjoy. Can someone point me out to the right files that we need to edit and tell me how to adapt the code to use with this great shopping cart system?
Attached Thumbnails
Click image for larger version

Name:	bump.jpg
Views:	100
Size:	41.1 KB
ID:	1931  
__________________
Version 4.2.3
X-Cart Gold

Version 4.3.1
X-Cart Gold
Reply With Quote

The following user thanks FTI for this useful post:
am2003 (05-24-2010)
  #2  
Old 05-03-2010, 04:38 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Highlight current page in speedbar

Use $main, $help_section and $page_data and define css style "current" or wnatever you want to call it

{if $main eq "...."}, {if $help_section eq "contactus"}, {if $page_data.pageid eq "...."}

Something like this

<a href=""{if $help_section eq "contactus"} class="current"{/if}>Contact Us</a>
<a href=""{if $page_data.pageid eq "5"} class="current"{/if}>Skin Care</a>
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following 2 users thank cflsystems for this useful post:
am2003 (05-04-2010), FTI (05-04-2010)
  #3  
Old 05-04-2010, 04:55 AM
  FTI's Avatar 
FTI FTI is offline
 

Senior Member
  
Join Date: Oct 2009
Location: Plovdiv, Bulgaria
Posts: 153
 

Default Re: Highlight current page in speedbar

Thank you, Sir. But in which file I should put this, and also all the links in my speed bar are links to categories in my site. So I'll be glad if you point me to the right file. Thanks in advance!
__________________
Version 4.2.3
X-Cart Gold

Version 4.3.1
X-Cart Gold
Reply With Quote
  #4  
Old 05-04-2010, 07:28 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Highlight current page in speedbar

These will be your links so where you want them to appear thats where you put them. Not sure right now what the template for the speed bar links was called but if you look in head,tpl you should be able to find it. If links are based on categories you can use

{if $current_category.categoryid eq "xxx"}
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 05-10-2010, 08:47 AM
  FTI's Avatar 
FTI FTI is offline
 

Senior Member
  
Join Date: Oct 2009
Location: Plovdiv, Bulgaria
Posts: 153
 

Default Re: Highlight current page in speedbar

I can't find the speedbar links. I got as far as tabs.tpl:

Code:
{* $Id: tabs.tpl,v 1.2 2009/04/21 11:42:00 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {if $speed_bar} <div class="tabs"> <ul> {foreach from=$speed_bar item=sb name=tabs} <li{interline name=tabs}><a href="{$sb.link|amp}">{$sb.title}</a></li> {/foreach} </ul> </div> {/if}
__________________
Version 4.2.3
X-Cart Gold

Version 4.3.1
X-Cart Gold
Reply With Quote
  #6  
Old 05-10-2010, 12:35 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Highlight current page in speedbar

These are the speed bar links. They are in an array called $speed_bar and the templates just loops trhough them. Put the if statement inside the <a>
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #7  
Old 05-11-2010, 06:22 AM
  FTI's Avatar 
FTI FTI is offline
 

Senior Member
  
Join Date: Oct 2009
Location: Plovdiv, Bulgaria
Posts: 153
 

Default Re: Highlight current page in speedbar

Code:
{* $Id: tabs.tpl,v 1.2 2009/04/21 11:42:00 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {if $speed_bar} <div class="tabs"> <ul> {foreach from=$speed_bar item=sb name=tabs} <li{interline name=tabs}><a href="{$sb.link|amp}"{if $current_category.categoryid eq "xxx"}>{$sb.title}</a></li> {/foreach} </ul> </div> {/if}

Something like this? How I should apply this for all of the 7 links and I know it sounds stupid but how can I get the category ID Thank you man, you are the one who is helping me since my fist post in this forum. I appreciate it, too bad I can't help you a lot with my poor knowledge...
__________________
Version 4.2.3
X-Cart Gold

Version 4.3.1
X-Cart Gold
Reply With Quote
  #8  
Old 05-11-2010, 07:14 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Highlight current page in speedbar

you can get the cat id in the admin section.

just click on the cat and then the id will show in the URL
__________________
xcart 5.1.2
Reply With Quote
  #9  
Old 05-11-2010, 09:41 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Highlight current page in speedbar

Quote:
Originally Posted by FTI
Code:
{* $Id: tabs.tpl,v 1.2 2009/04/21 11:42:00 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {if $speed_bar} <div class="tabs"> <ul> {foreach from=$speed_bar item=sb name=tabs} <li{interline name=tabs}><a href="{$sb.link|amp}"{if $current_category.categoryid eq "xxx"} class="current"{/if}>{$sb.title}</a></li> {/foreach} </ul> </div> {/if}

Something like this? How I should apply this for all of the 7 links and I know it sounds stupid but how can I get the category ID Thank you man, you are the one who is helping me since my fist post in this forum. I appreciate it, too bad I can't help you a lot with my poor knowledge...
See above in red. You can get the catid from admin - open categories, point to the category in question - it is in the url or you can export categories and look in the csv file. The foreach loops through all speed bar links and will apply class current to the item only if that item in the loop is matching the if statement
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
FTI (05-24-2010)
  #10  
Old 05-24-2010, 06:36 AM
  FTI's Avatar 
FTI FTI is offline
 

Senior Member
  
Join Date: Oct 2009
Location: Plovdiv, Bulgaria
Posts: 153
 

Default Re: Highlight current page in speedbar

Thank you so much, that did the job!

PS: Is there a way to assign this current class to all subcategories in the main category, cause the highlighting disappears when I go into a subcategory?
__________________
Version 4.2.3
X-Cart Gold

Version 4.3.1
X-Cart Gold
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 04:49 AM.

   

 
X-Cart forums © 2001-2020