Post by Rebecka » Sat Dec 03, 2011 10:31 pm

I want to replace header links.

Instead of like this
Home Wish List (0) My Account Shopping Cart Checkout

I want it likes this
My Account Order History Wish List (0) Newsletter

The header links are in header.tpl

Code: Select all

<div class="links"><a href="<?php echo $home; ?>"><?php echo $text_home; ?></a><a href="<?php echo $wishlist; ?>" id="wishlist_total"><?php echo $text_wishlist; ?></a><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a><a href="<?php echo $cart; ?>"><?php echo $text_cart; ?></a><a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div>
The links that I want to add from the footer/footer.tpl

Code: Select all

<a href="<?php echo $order; ?>"><?php echo $text_order; ?></a>
<a href="<?php echo $newsletter; ?>"><?php echo $text_newsletter; ?></a>
I know how to place them and how to remove Home, Shopping Cart and Checkout. The problem I have with adding the links from the footer is that I get an error message. Something about text_order and text_newsletter not exist.

This is what my code looks like

Code: Select all

<div class="links"><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a><a href="<?php echo $wishlist; ?>" id="wishlist_total"><?php echo $text_wishlist; ?></a><a href="<?php echo $newsletter; ?>"><?php echo $text_newsletter; ?></a></div>
Anybody know what I am doing wrong?
Last edited by Rebecka on Sun Dec 04, 2011 2:56 am, edited 1 time in total.

Rebecka went over to PrestaShop.


Active Member

Posts

Joined
Sun Sep 18, 2011 4:49 am
Location - Sweden

Post by labeshops » Sat Dec 03, 2011 10:39 pm

Easiest way is to just replace <?php echo $text_order; ?> with Order, etc.

Or copy the definitions from your language/english/common/footer.php to the same folder's header.php file.

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by Rebecka » Sat Dec 03, 2011 11:12 pm

labeshops wrote:Easiest way is to just replace <?php echo $text_order; ?> with Order, etc.
How do you mean here?

Like this?

Code: Select all

<a href="<?php echo $order; ?>">Order History</a>
<a href="<?php echo $newsletter; ?>">Newsletter</a>
The links look right now, but when you visit Order History or Newsletter you will get to the error page.
The page you requested could unfortunately not be found.

Rebecka went over to PrestaShop.


Active Member

Posts

Joined
Sun Sep 18, 2011 4:49 am
Location - Sweden

Post by labeshops » Sun Dec 04, 2011 2:25 am

You might want to take some time and read some of the posts about how opencart is structured.

Each template file has corresponding controller and model files. Queries are called in the model files (not all pages have them) and variables are set in the controller files.

So if you shift something from one template to another, you also have to shift the corresponding information from the matching controller and/or model files. In this case, the link variables are set in the controller files, so you can find and copy the lines you need in the footer controller file to the header controller file, or manually create the entire link. Anytime there is a variable set (like $order), it will be defined in the controller file.

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by Rebecka » Sun Dec 04, 2011 2:55 am

I fixed it. :)

Rebecka went over to PrestaShop.


Active Member

Posts

Joined
Sun Sep 18, 2011 4:49 am
Location - Sweden
Who is online

Users browsing this forum: No registered users and 49 guests