Post by Digital Sushi » Mon Oct 18, 2010 10:37 pm

Hi all! This is my first post here :)

I did find another topic on this, but got stuck.

Basically, what I want to do is create another tab next to Home, but before Specials. It's called Forum and I want it to link to a Forum subdomain I'll be creating.

Any help?

EDIT: At the same time is it possible to remove the country and currency selectors?

Active Member

Posts

Joined
Mon Oct 18, 2010 10:23 pm
Location - South Africa

Post by jones » Tue Oct 19, 2010 12:54 pm

Find:

Code: Select all

<a href="<?php echo str_replace('&', '&', $home); ?>" id="tab_home"><?php echo $text_home; ?></a>
after add:

Code: Select all

<a href="//yourdomain.com/forum/" class="nav">FORUM</a >
or

Find:

Code: Select all

<a href="<?php echo str_replace('&', '&', $special); ?>" style="background-image: url('catalog/view/theme/default/image/special.png');"><?php echo $text_special; ?></a>
before add:

Code: Select all

<a href="//yourdomain.com/forum/" style="background-image: url('catalog/view/theme/default/image/your_image_forum.png');">Forum</a>
EDIT: At the same time is it possible to remove the country and currency selectors?
Yes it is.

Active Member

Posts

Joined
Tue Aug 24, 2010 1:05 pm

Post by Digital Sushi » Tue Oct 19, 2010 2:27 pm

jones wrote:Find:

Code: Select all

<a href="<?php echo str_replace('&', '&', $home); ?>" id="tab_home"><?php echo $text_home; ?></a>
after add:

Code: Select all

<a href="//yourdomain.com/forum/" class="nav">FORUM</a >
This one worked, but pushed Checkout into a new line
jones wrote:Find:

Code: Select all

<a href="<?php echo str_replace('&', '&', $special); ?>" style="background-image: url('catalog/view/theme/default/image/special.png');"><?php echo $text_special; ?></a>
before add:

Code: Select all

<a href="//yourdomain.com/forum/" style="background-image: url('catalog/view/theme/default/image/your_image_forum.png');">Forum</a>
This wasn't exactly what I'd pictured, but itworked perfectly. Thanks!
jones wrote:
EDIT: At the same time is it possible to remove the country and currency selectors?
Yes it is.
[/quote]
Thanks. Managed to mod it myself :)

Active Member

Posts

Joined
Mon Oct 18, 2010 10:23 pm
Location - South Africa

Post by jones » Tue Oct 19, 2010 3:06 pm

Digital Sushi wrote:
jones wrote:Find:

Code: Select all

<a href="<?php echo str_replace('&', '&', $home); ?>" id="tab_home"><?php echo $text_home; ?></a>
after add:

Code: Select all

<a href="//yourdomain.com/forum/" class="nav">FORUM</a >
This one worked, but pushed Checkout into a new line
You just need to reduce the width of your header menu in stylesheet.css place in stylesheet folder
Digital Sushi wrote:
jones wrote:Find:

Code: Select all

<a href="<?php echo str_replace('&', '&', $special); ?>" style="background-image: url('catalog/view/theme/default/image/special.png');"><?php echo $text_special; ?></a>
before add:

Code: Select all

<a href="//yourdomain.com/forum/" style="background-image: url('catalog/view/theme/default/image/your_image_forum.png');">Forum</a>
This wasn't exactly what I'd pictured, but itworked perfectly. Thanks!
the new small picture that describe your forum as similar to special offfers. boomarks etc then put the picture in catalog\view\theme\default\image\ folder
Digital Sushi wrote:
jones wrote:
EDIT: At the same time is it possible to remove the country and currency selectors?
Yes it is.
Thanks. Managed to mod it myself :)
Anytime, hope you get luck of senses

Active Member

Posts

Joined
Tue Aug 24, 2010 1:05 pm

Post by lith07 » Sat Nov 27, 2010 6:02 am

Hello,

How do I make it so that when I am on my new page, it shows the tab as selected, and displayes the selected state of the tab? Right now when I am on my new tab, it just has my home tab selected.

Thanks!

New member

Posts

Joined
Thu Jan 14, 2010 2:20 pm

Post by dennisBaskin » Sat Nov 27, 2010 2:20 pm

lith07 wrote:Hello,

How do I make it so that when I am on my new page, it shows the tab as selected, and displayes the selected state of the tab? Right now when I am on my new tab, it just has my home tab selected.

Thanks!
find this jQuery code in your header.tpl inside your view files:

Code: Select all

$(document).ready(function() {
	route = getURLVar('route');
	
	if (!route) {
		$('#tab_home').addClass('selected');
	} else {
		part = route.split('/');
		if (route == 'common/home') {
			$('#tab_home').addClass('selected');
		} else if (route == 'account/login') {
			$('#tab_login').addClass('selected');	
		} else if (part[0] == 'account') {
			$('#tab_account').addClass('selected');
		} else if (route == 'checkout/cart') {
			$('#tab_cart').addClass('selected');
		} else if (part[0] == 'checkout') {
			$('#tab_checkout').addClass('selected');
		} else {
			$('#tab_home').addClass('selected');
		}
	}
});
Then add this line before the if statement:

Code: Select all

	var loc = window.location;
});
within the if statement add the following:

Code: Select all

if (loc == 'http://www.aandjjewels.com/wp/shop/events') {
			$('#tab_events').addClass('selected');
		} 
The full version should look like this (remember to move $('#tab_home').addClass('selected'); into another else statement):

Code: Select all

$(document).ready(function() {
	route = getURLVar('route');
	var loc = window.location;
	
	if (!route) {
		 if (loc == 'http://www.YOURSITE.com/YOUR_SUB_DIR/SEO_PAGE_NAME') {
			$('#YOUR_TAB_ID').addClass('selected');
		} else {
			$('#tab_home').addClass('selected');
		}
	} else {
		part = route.split('/');
		
		if (route == 'common/home') {
			$('#tab_home').addClass('selected');
		} else if (route == 'account/login') {
			$('#tab_login').addClass('selected');	
		} else if (part[0] == 'account') {
			$('#tab_account').addClass('selected');
		} else if (route == 'checkout/cart') {
			$('#tab_cart').addClass('selected');
		} else if (part[0] == 'checkout') {
			$('#tab_checkout').addClass('selected');
		} else {
			$('#tab_home').addClass('selected');
		}
	}
});
All we are doing here is using javaScript to locate which url you are at when the page loads and if it matches we add the class "selected" to the tab you created. Of coarse don't forget to rename all the areas written in caps so that they match with what you are trying to do.

That probably should have been under a different post, but oh well. Hopefully this will help somebody. :D

Newbie

Posts

Joined
Sat Nov 27, 2010 7:12 am

Post by lith07 » Sat Nov 27, 2010 5:23 pm

Hey Dennis,

I cant seem to get it to work. I copy and pasted your code, changed parts with caps, and it just showing the home tab selected. My link is...

<a href="index.php?route=information/information&information_id=6" id="tab_articles">Articles</a>

and my code is....

$(document).ready(function() {
route = getURLVar('route');
var loc = window.location;

if (!route) {
if (loc == 'http://freetrition.com/opencart/index.p ... ation_id=6') {
$('#tab_articles').addClass('selected');
} else {
$('#tab_home').addClass('selected');
}
} else {
part = route.split('/');

if (route == 'common/home') {
$('#tab_home').addClass('selected');
} else if (route == 'account/login') {
$('#tab_login').addClass('selected');
} else if (part[0] == 'account') {
$('#tab_account').addClass('selected');
} else if (route == 'checkout/cart') {
$('#tab_cart').addClass('selected');
} else if (part[0] == 'checkout') {
$('#tab_checkout').addClass('selected');
} else {
$('#tab_home').addClass('selected');
}
}
});

Any ideas? Thanks for the help btw

New member

Posts

Joined
Thu Jan 14, 2010 2:20 pm

Post by lith07 » Sun Nov 28, 2010 10:50 am

Bump: anyone? I know it has to be a simple fix, but I just can't figure it out =[

New member

Posts

Joined
Thu Jan 14, 2010 2:20 pm

Post by openmycart.com » Sun Nov 28, 2010 1:41 pm

for

Code: Select all

http://freetrition.com/opencart/index.php?route=information/information&information_id=6
I thinks You just need to add

Code: Select all

index.php?route=information/information&information_id=<?php echo $information_id; ?>/
but i'm not tested it yet

Find and get many various of opencart modules, themes, mods, etc for your opencart store at http://www.openmycart.com/oc/, OPENCART SITE customization and Maintenance supports at here


User avatar
Active Member

Posts

Joined
Tue Oct 12, 2010 4:47 am


Post by lith07 » Sun Nov 28, 2010 4:51 pm

No that doesn't work. I'm not trying to make the link dynamic, I am just trying to say that when the tab that is linked to information_id=6 is selected, the tab changes to its selected state. But thanks for the help anyways. Have any other suggestions?

New member

Posts

Joined
Thu Jan 14, 2010 2:20 pm

Post by justinv » Sun Nov 28, 2010 5:05 pm

if this is the same site I helped you with your anythingSlider() before, try this in your header.tpl:

REPLACE THIS:

if (route == 'common/home') {
$('#tab_home').addClass('selected');
} else if (route == 'account/login') {
$('#tab_login').addClass('selected');
} else if (part[0] == 'account') {
$('#tab_account').addClass('selected');
} else if (route == 'checkout/cart') {
$('#tab_cart').addClass('selected');
} else if (part[0] == 'checkout') {
$('#tab_checkout').addClass('selected');
} else {
$('#tab_home').addClass('selected');
}

WITH THIS:

if (route == 'common/home') {
$('#tab_home').addClass('selected');
} else if (route == 'account/login') {
$('#tab_login').addClass('selected');
} else if (route == 'information/information') {
$('#tab_articles').addClass('selected');
} else if (part[0] == 'account') {
$('#tab_account').addClass('selected');
} else if (route == 'checkout/cart') {
$('#tab_cart').addClass('selected');
} else if (part[0] == 'checkout') {
$('#tab_checkout').addClass('selected');
} else {
$('#tab_home').addClass('selected');
}

Documentation: OpenCart User Guide
Mods: Total Import PRO | CSV Import PRO | Ecom Tracking | Any Feed | Autosuggest | OpenCart CDN
Image


Active Member

Posts

Joined
Tue Oct 12, 2010 1:24 pm

Post by lith07 » Sun Nov 28, 2010 5:18 pm

Justin you did it again! Thanks!

I've also figured out that I can change information/information to the 'loc' variable and set it to the URL. This allows me to set different information pages to different tabs, and still allow the selected effect to work. This is exactly what I've been trying to learn.

Thanks again Justin, and you really need a donate button!

New member

Posts

Joined
Thu Jan 14, 2010 2:20 pm

Post by dennisBaskin » Mon Nov 29, 2010 4:58 am

lith07 wrote:Justin you did it again! Thanks!

I've also figured out that I can change information/information to the 'loc' variable and set it to the URL. This allows me to set different information pages to different tabs, and still allow the selected effect to work. This is exactly what I've been trying to learn.

Thanks again Justin, and you really need a donate button!

If you have a route that you are going through then you can directly put in the the route logic like the others, but remember to take out the window.location variable out also, as it is only helpful when you don't have route information specified.

Glad it worked for you! :D

Newbie

Posts

Joined
Sat Nov 27, 2010 7:12 am

Post by afendio » Mon Feb 28, 2011 1:09 am

lith07 wrote:Justin you did it again! Thanks!

I've also figured out that I can change information/information to the 'loc' variable and set it to the URL. This allows me to set different information pages to different tabs, and still allow the selected effect to work. This is exactly what I've been trying to learn.

Thanks again Justin, and you really need a donate button!
hello lith07, can u teach me how to do that "to set different information pages to different tabs, and still allow the selected effect to work" ? or anybody who know how to code that? please help.

thanks.

New member

Posts

Joined
Wed Jan 13, 2010 3:43 pm
Location - Malaysia

Post by FraZeks » Tue Oct 11, 2011 7:49 am

The solution is in this tread. :)

New member

Posts

Joined
Fri Sep 18, 2009 6:57 am
Who is online

Users browsing this forum: No registered users and 10 guests