Post by cosmicx » Sat May 25, 2013 12:40 am

Hello Theme Developers,


Im editing a theme named AquaCart, installed in OpenCart 1.5.5.1.
I also integrated twitter bootstrap's fixed top navbar.
I already moded the navbar and had put the Login/Logout menu there and It's doing fine.
This project is for my own online store.

I am have no PHP skills yet, only html/css. I have managed to put the login/logout button on my new navbar menu by copying codes from my current theme's header.tpl file and editing the header.php file (from the catalog\english\common\header.php).

Now, I am polishing the menu and wanted to add some custom menu/link named Sign Up!
I want this Sign Up! Text Link Menu to show as Logout Menu when a user is logged in.

My current edit show the logged in user name in a LI and logout menu in a second LI. This is not what I really want, what I want is to show the LOGOUT menu in place of the Sign Up! menu when a user is logged in.

Here is my current header.tpl edit:

Code: Select all

<ul aria-labelledby="drop3" role="menu" class="dropdown-menu pull-right">
	<?php if (!$logged) { ?>
	<?php echo $text_welcome; ?>
	<?php } else { ?>
	<?php echo $text_logged; ?>
	<?php } ?>
	<li class="divider" role="presentation"></li>							
	<li role="presentation"><a href="#" tabindex="-1" role="menuitem">Store Front</a></li>
	<li role="presentation"><a href="#" tabindex="-1" role="menuitem">Blog Page</a></li>
</ul>
My current header.php edit:

Code: Select all

<?php
// Text
$_['text_home']           = 'Online Shop';
$_['text_wishlist']       = 'Wish List (%s)';
$_['text_shopping_cart']  = 'Shopping Cart';
$_['text_search']         = 'Search';
$_['text_welcome']        = '<li role="presentation"><a href="%s">Login</a></li>';
$_['text_logged']         = 

'<li role="presentation"><a href="%s" tabindex="-1" role="menuitem">%s</a></li>
 <li role="presentation"><a href="%s" tabindex="-1" role="menuitem">Logout</a></li>';
 
$_['text_account']        = 'My Account';
$_['text_checkout']       = 'Checkout';
?>
That code is rendered like this:
Image

My goal is to turn that Sign Up! Text Link to Logout

Active Member

Posts

Joined
Mon Jan 09, 2012 6:27 pm

Post by anung » Sat May 25, 2013 1:50 am

Where the Sign Up! code?

User avatar
Active Member

Posts

Joined
Fri Mar 30, 2012 10:32 am
Location - Indonesia

Post by cosmicx » Sat May 25, 2013 2:07 am

Codes for the Sign Up Link is nonexistent yet. Im asking for help how to do it. What files to modify and what code to write.

Active Member

Posts

Joined
Mon Jan 09, 2012 6:27 pm

Post by cblack412 » Sun May 26, 2013 11:38 pm

Put this in the <li> in the <ul> in header.tpl to:

Code: Select all

 <?php if (!$logged) { ?>
   <li><?php echo $text_welcome; ?></li>
   <?php } else { ?>
   <li><?php echo $text_logged; ?></li>
   <?php } ?>
You also need to change the language file:

Code: Select all

$_['text_welcome']        = '<a href="%s">Sign Up!</a>';
$_['text_logged']         = '<a href="%s">Logout</a>';
Then change your header.php file to:

Code: Select all

$this->data['text_welcome'] = sprintf($this->language->get('text_welcome'), $this->url->link('account/register', '', 'SSL'));
$this->data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/logout', '', 'SSL'));
Please mark this as solved!

Thanks!

Newbie

Posts

Joined
Sun Jul 24, 2011 10:50 am
Who is online

Users browsing this forum: No registered users and 16 guests