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.
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.
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.
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 SXGuySXGuy 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.
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>
Code: Select all
.contactuslink {
position: relative;
left: 720px;
}
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.
Do you want like image below?
If yes, open file header.tpl
FIND :
REPLACE WITH:
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>
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>
nosecret wrote:Do you want like image below?
If yes, open file header.tpl
FIND :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 } ?> </ul>
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.
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.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
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 ?
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 ?
Yes. By editing the header.php controller file or making a vqmod.
you should add this in catalog/controller/common/header.php
...let's say after:
and replace
with
in catalog/view/theme/your theme or default/template/common/header.tpl
I will come later with 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'])
);
}
}
Code: Select all
$this->data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL');
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 } ?>
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 } ?>
I will come later with a vqmod.
Opencart Templates, Modules, Themes & Custom Development | ShopThemer
Who is online
Users browsing this forum: No registered users and 72 guests