Post by salmoon » Sun Oct 21, 2007 10:03 pm

Hi guys..

Does anyone have an idea how to use conditionals with the 'information' navigation?
I basically want these links to run across the top of the page and have them be highlighted or whatever, depending on what the current page is. Is this possible with opencart?

Thanks for any help / point in the right direction..  :)

New member

Posts

Joined
Sun Oct 21, 2007 9:59 pm

Post by salmoon » Fri Oct 26, 2007 5:04 pm

Has nobody got an idea?  ???

I'd really appreciate any help..

New member

Posts

Joined
Sun Oct 21, 2007 9:59 pm

Post by tchemis » Fri Oct 26, 2007 6:26 pm

Hello,

In order to change the information links and its location you need first create your css styles for the links which are located inside a div with a class of .information the generated links are links and not an unordered list keep that in mind. Below is the example of the default css used in opencart to style these links, modify them to fix your needs.

The CSS file is located at: catalog/template/default/css/default.css

Code: Select all

/* box information */
.box .information a {
	background: url('../image/bullet_2.png') no-repeat 10px 4px;
	padding: 0px 0px 0px 25px;
	display: block;
	text-decoration: none;
}
The code used to generate the links is:

Code: Select all

    <?php if (isset($information)) { ?>

    <?php echo $information; ?>

    <?php } ?>
Place this code where you want the links to appear.
Last edited by tchemis on Fri Oct 26, 2007 6:29 pm, edited 1 time in total.

Active Member

Posts

Joined
Tue Aug 21, 2007 9:23 am

Post by salmoon » Fri Oct 26, 2007 6:57 pm

Thanks for your reply tchemis...

This isn't what i'm looking for though. I need the individual information links to be conditional according to the current page. For example, if you're on the about us page.. then the about us link needs to be in bold, or whatever. Does that make sense?

I'm good with the CSS of this, i just need to know the code to make the links conditional.


Thanks a lot for any help..

New member

Posts

Joined
Sun Oct 21, 2007 9:59 pm

Post by tchemis » Fri Oct 26, 2007 7:02 pm

Hi,

Sorry yes I did misread your post, I am not sure how to currently retrieve the active page, ill have a look at it, and post if I find a solution.

Active Member

Posts

Joined
Tue Aug 21, 2007 9:23 am

Post by salmoon » Fri Oct 26, 2007 7:57 pm

Thanks so much..  :)

New member

Posts

Joined
Sun Oct 21, 2007 9:59 pm

Post by salmoon » Tue Oct 30, 2007 6:55 pm

Any progress yet?  :)

New member

Posts

Joined
Sun Oct 21, 2007 9:59 pm

Post by tchemis » Tue Oct 30, 2007 7:54 pm

Hi, I did work on it a little I will try and come up with something for you in the next day or two.

Active Member

Posts

Joined
Tue Aug 21, 2007 9:23 am

Post by salmoon » Tue Oct 30, 2007 7:56 pm

Ah fantastic, thanks a tonne..  :)

New member

Posts

Joined
Sun Oct 21, 2007 9:59 pm

Post by grimlock » Fri Mar 14, 2008 5:18 am

Ok I got this to work since no one would do it :P! I'm by no means a programmer but I it works so hey that counts right?

My solution to this problem was to change the templates CSS class based on the location of the user while browsing the store. The CSS modification is easy, you simple create an default non active class and an active class.

For example:

Code: Select all

a.homeoff{
	display: block;
	width: 42px;
	height: 33px;
	background: url(../image/homeoff.gif) 0 0 no-repeat;
	text-decoration: none;
}
a.homeoff:hover{
	background-position: -42px 0;
}
a.homeactive{
	display: block;
	width: 42px;
	height: 33px;
	background: url(../image/homeactive.gif) 0 0 no-repeat;
	text-decoration: none;
}
Now you'll need to find the location being visited by the user by using PHP's predefined variable REQUEST_URI.

For testing purposes you can echo REQUEST_URI by using

Code: Select all

<?php echo $_SERVER['REQUEST_URI'] ?>
Finally you'll need to use PHP's conditional IF and ELSE statements to change the class based on REQUEST_URI

Code: Select all

<?php if ($_SERVER['REQUEST_URI'] == '/') { ?><?php echo 'class="homeactive"' ?><?php } ?><?php if ($_SERVER['REQUEST_URI'] == '/controller/home') { ?><?php echo 'class="homeactive"' ?><?php } else { ?><?php echo 'class="homeon"' ?><?php } ?>
Depending on if you have SEO URL's enabled or not you'll need to change the URI to whatever your server supports.

Hope this helps!

Thanks,

Grim
Last edited by grimlock on Fri Mar 14, 2008 6:05 am, edited 1 time in total.

Newbie

Posts

Joined
Thu Mar 13, 2008 8:47 am
Who is online

Users browsing this forum: No registered users and 3 guests