Post by Dubblicious » Mon Nov 07, 2011 2:03 pm

Hello all
I want to add "Contact Us" to the main Navigation bar on the far right side. The "Contact Us" link under Customer Service is great but I want to be more visible and the main Navigation bar is ideal and the first place most people would look anyways.

I tried doing something from a older post I made
http://forum.opencart.com/viewtopic.php ... 61#p171461

but the link I made was just to the right of the first link and I want it to the far right so it is the last link in the main Navigation bar.

Can this be done in the header.tpl or do I have to do it with CSS ?
Thanks in advance for you advice.
Last edited by Dubblicious on Tue Nov 08, 2011 7:54 am, edited 1 time in total.

User avatar
New member

Posts

Joined
Tue Jun 14, 2011 2:35 pm

Post by SXGuy » Tue Nov 08, 2011 1:12 am

Depending on how you coded the menu div it depends what you need to do.

If you placed the link to contact us as the first link in the menu div, then place the link to it as the last menu link.

if its a case of wanting to move the link across the menu bar but keep the previous linked together to the far left then do it below.

you will need to wrap the link to contact us around a span class and define it in the stylesheet.css file.

example <a href="yourlink"><span class="contactuslink">Contact Us</span></a>

and in stylesheet.css

.contactuslink {
position: relative;
left: 200px;
}

Something along those lines.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by Dubblicious » Tue Nov 08, 2011 2:50 am

SXGuy wrote:Depending on how you coded the menu div it depends what you need to do.

If you placed the link to contact us as the first link in the menu div, then place the link to it as the last menu link.

if its a case of wanting to move the link across the menu bar but keep the previous linked together to the far left then do it below.

you will need to wrap the link to contact us around a span class and define it in the stylesheet.css file.

example <a href="yourlink"><span class="contactuslink">Contact Us</span></a>

and in stylesheet.css

.contactuslink {
position: relative;
left: 200px;
}

Something along those lines.
Hi SXGuy
Thanks for replying
I did as you said and I put this code in the header.tpl

Code: Select all

<li><a href="http://www.mywebsite.com/store/index.php?route=information/contact"><span class="contactuslink">Contact Us</span></a></li>
and then the CSS

Code: Select all

.contactuslink {
position: relative;
left: 720px;
}
What happened is that the text link did move over to the correct area of the Nav bar and it works, but the roll over did not move over with the link and is in the same spot as before and is now a rollover with no text. The rollover still functions as a link to contact us page as well. So I am guessing they are still connected. Any idea what I should do ?

User avatar
New member

Posts

Joined
Tue Jun 14, 2011 2:35 pm

Post by SXGuy » Tue Nov 08, 2011 4:37 am

sorry, change it to

.contactuslink span {
position: relative;
left: 720px;
}

and add

.contactuslink:hover span {
position: relative;
left: 720px;
}

to be honest, i havent tested it so im only guessing here

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by Dubblicious » Tue Nov 08, 2011 5:47 am

SXGuy wrote:sorry, change it to

.contactuslink span {
position: relative;
left: 720px;
}

and add

.contactuslink:hover span {
position: relative;
left: 720px;
}

to be honest, i havent tested it so im only guessing here

I appreciate the help SXGuy
So tried your suggestion and now the CSS is doing nothing. The text is on the roll over and the link works but it was like I did no CSS changes at all and the link is where it was when I first made it in the header.tpl file.
I tried a few time making sure I saved the files , deleting the files on the server before uploading the new ones , and clearing cache but nothing.

I also tried going into admin and then catalog/category and created a new category call "Contact Us" then gave it a high sort number to place it to the far right side of the nav bar and it did create a roll over with the text in the proper place but there is no way to link to the existing Contact Us page in the options and it only creates a new page.

User avatar
New member

Posts

Joined
Tue Jun 14, 2011 2:35 pm

Post by nosecret » Tue Nov 08, 2011 7:37 am

Do you want like image below?
homepage.png

homepage.png (221.29 KiB) Viewed 5920 times

If yes, open file header.tpl
FIND :

Code: Select all

<ul>
    <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
      <?php if ($category['children']) { ?>
      <div>
        <?php for ($i = 0; $i < count($category['children']);) { ?>
        <ul>
          <?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
          <?php for (; $i < $j; $i++) { ?>
          <?php if (isset($category['children'][$i])) { ?>
          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
          <?php } ?>
          <?php } ?>
        </ul>
        <?php } ?>
      </div>
      <?php } ?>
    </li>
    <?php } ?>
  </ul>
REPLACE WITH:

Code: Select all

<ul>
    <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
      <?php if ($category['children']) { ?>
      <div>
        <?php for ($i = 0; $i < count($category['children']);) { ?>
        <ul>
          <?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
          <?php for (; $i < $j; $i++) { ?>
          <?php if (isset($category['children'][$i])) { ?>
          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
          <?php } ?>
          <?php } ?>
        </ul>
        <?php } ?>
      </div>
      <?php } ?>
    </li>
    <?php } ?>
	<li><a href="http://www.mywebsite.com/store/index.php?route=information/contact">Contact Us</a></li>
  </ul>

Active Member

Posts

Joined
Tue Dec 28, 2010 12:28 pm

Post by Dubblicious » Tue Nov 08, 2011 7:52 am

nosecret wrote:Do you want like image below?
homepage.png
If yes, open file header.tpl
FIND :

Code: Select all

<ul>
    <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
      <?php if ($category['children']) { ?>
      <div>
        <?php for ($i = 0; $i < count($category['children']);) { ?>
        <ul>
          <?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
          <?php for (; $i < $j; $i++) { ?>
          <?php if (isset($category['children'][$i])) { ?>
          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
          <?php } ?>
          <?php } ?>
        </ul>
        <?php } ?>
      </div>
      <?php } ?>
    </li>
    <?php } ?>
  </ul>
REPLACE WITH:

Code: Select all

<ul>
    <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
      <?php if ($category['children']) { ?>
      <div>
        <?php for ($i = 0; $i < count($category['children']);) { ?>
        <ul>
          <?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
          <?php for (; $i < $j; $i++) { ?>
          <?php if (isset($category['children'][$i])) { ?>
          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
          <?php } ?>
          <?php } ?>
        </ul>
        <?php } ?>
      </div>
      <?php } ?>
    </li>
    <?php } ?>
	<li><a href="http://www.mywebsite.com/store/index.php?route=information/contact">Contact Us</a></li>
  </ul>

Thank You nosecret
That is the solution I was looking for. O0

User avatar
New member

Posts

Joined
Tue Jun 14, 2011 2:35 pm

Post by SXGuy » Tue Nov 08, 2011 4:50 pm

i could have told you that.

i assumed you had positioning problems, but it appears you just needed to move the link in the menu div to the far bottom which is what i suggested first lol

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by Dubblicious » Wed Nov 09, 2011 1:28 am

SXGuy wrote:i could have told you that.

i assumed you had positioning problems, but it appears you just needed to move the link in the menu div to the far bottom which is what i suggested first lol
I said that is what I wanted to do , but I don't understand PHP and did not know where the link went in the code. Besides you did help me to better understand my problem and find a solution by replying to this post to begin with. Now I know more so thanks. ;D

User avatar
New member

Posts

Joined
Tue Jun 14, 2011 2:35 pm

Post by haloabove » Tue Feb 04, 2014 8:21 pm

No This topic is not solved as this post's heading claims, this is the hard coded way, what happens if i what to change the language of the site to other than English ?? The menu item remains the same, its because you will hard code the link and the name of the menu item in English .
So my question is :
is there a way of adding the contact us and the information pages in the menu the right way with the support of the language file ?

Newbie

Posts

Joined
Tue Feb 04, 2014 8:16 pm

Post by Xyph3r » Thu Feb 06, 2014 2:20 am

Yes. By editing the header.php controller file or making a vqmod.

you should add this in catalog/controller/common/header.php

Code: Select all

$this->language->load('common/footer');
			$this->data['contact'] = $this->url->link('information/contact');
			$this->data['text_information'] = $this->language->get('text_information');
			$this->data['text_contact'] = $this->language->get('text_contact');
			$this->load->model('catalog/information');
			$this->data['informations'] = array();
			foreach ($this->model_catalog_information->getInformations() as $result) {
				if ($result['bottom']) {
					$this->data['informations'][] = array(
						'title' => $result['title'],
						'href'  => $this->url->link('information/information', 'information_id=' . $result['information_id'])
					);
				}
			}
...let's say after:

Code: Select all

$this->data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL');
and replace

Code: Select all

<?php if ($categories) { ?>
<div id="menu">
  <ul>
    <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
      <?php if ($category['children']) { ?>
      <div>
        <?php for ($i = 0; $i < count($category['children']);) { ?>
        <ul>
          <?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
          <?php for (; $i < $j; $i++) { ?>
          <?php if (isset($category['children'][$i])) { ?>
          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
          <?php } ?>
          <?php } ?>
        </ul>
        <?php } ?>
      </div>
      <?php } ?>
    </li>
    <?php } ?>
  </ul>
</div>
<?php } ?>
with

Code: Select all

<?php if ($categories) { ?>
<div id="menu">
  <ul>
    <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
      <?php if ($category['children']) { ?>
      <div>
        <?php for ($i = 0; $i < count($category['children']);) { ?>
        <ul>
          <?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
          <?php for (; $i < $j; $i++) { ?>
          <?php if (isset($category['children'][$i])) { ?>
          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
          <?php } ?>
          <?php } ?>
        </ul>
        <?php } ?>
      </div>
      <?php } ?>
    </li>
    <?php } ?>
	<li><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li>
	<?php if ($informations) { ?>
	<li><a><?php echo $text_information; ?></a>
      <div>
        <ul>
          <?php foreach ($informations as $information) { ?>
			<li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li>
		  <?php } ?>
        </ul>
      </div>
    </li>
	<?php } ?>
  </ul>
</div>
<?php } ?>
in catalog/view/theme/your theme or default/template/common/header.tpl

I will come later with a vqmod.

ImageImageImage
Opencart Templates, Modules, Themes & Custom Development | ShopThemer


User avatar
Active Member

Posts

Joined
Sun Feb 10, 2013 1:08 am

Who is online

Users browsing this forum: No registered users and 72 guests