Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How to Change "Home" to a different URL?

How to Change "Home" to a different URL?

Views: 1,582

Results 1 to 12 of 12
8 Feb 2012, 1:16 AM
#1
dustbowl avatar

dustbowl

New Zenner

Join Date:
Sep 2011
Posts:
43
Plugin Contributions:
0

How to Change "Home" to a different URL?

V 1.39

I've searched and searched the forums and tutoirals, but still need help.

How do you change the "home" on the top left corner of the zencart store to a different URL?
Of course this would also change the "home" in the footer?

I would like the header and footer "home" to go to my main site and not the home of the store.

I have a logo in the top and bottom of the middle section of the store that takes you to the home of the store.

I really do not need 4 links on every page to go to the home page of the store.

8 Feb 2012, 1:44 AM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to Change "Home" to a different URL?

Actually, you would need to change the header and footer Home links individually. They use Zen Cart's HTTP_SERVER and DIR_WS_CATALOG constants which you cannot alter without breaking the store. You can easily change the link code to use just HTTP_SERVER which will point to the base domain URL.

Edit /includes/templates/your_template/common/tpl_header.php and tpl_footer.php.

   <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
``` ```php
   <li><?php echo '<a href="' . HTTP_SERVER . '">'; ?><?php echo HEADER_TITLE_MAIN_SITE; ?></a></li>

Then add a define to /includes/languages/your_template/english.php like ```php
define('HEADER_TITLE_MAIN_SITE', 'Main Home');

11 Feb 2012, 3:47 AM
#3
Join Date:
Jan 2012
Posts:
15
Plugin Contributions:
0

Re: How to Change "Home" to a different URL?

So just to clarify: I should replace the first PHP code (in your reply) to read like the second PHP code, doing this in both the tpl_header.php and tpl_footer.php files? And then I should add the 'HEADER_TITLE_MAIN_SITE' PHP code to the english.php file?? Two questions:
(1) Exactly where within the english.php file would I add the new define line?
(2) My includes/languages only includes one template folder called classic, and it only contains an empty.txt file. Does that mean that I can't make the change to the home link URL described in this thread?

Please advise. Thank you! :)

11 Feb 2012, 5:43 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to Change "Home" to a different URL?

Yes.

  1. Add the define anywhere convenient, as long as it's between <?php ?> tags and not inside another define or a comment.
  2. Any place you see a /classic/ folder, you can make a /your_template/ folder next to it. Copy the file (in this case /includes/languages/english.php) to /includes/languages/your_template/english.php and make your edits.
11 Feb 2012, 3:51 PM
#5
gmartakis avatar

gmartakis

New Zenner

Join Date:
Feb 2011
Posts:
73
Plugin Contributions:
0

Re: How to Change "Home" to a different URL?

Hi
I having trouble with a simple transfer of a site into another domain. I want to have two sites work on the same server. the old site domain is https://www.flproducts.gr which I dont want to delete offcourse. Now the new one is https://www.pelagosmarine.gr.
I'm writing all the steps that I have been doing until now.

  1. I downloaded the https://www.flproducts.gr site contents with the database as a backup.
  2. I changed the configuration files both in admin/includes and includes.
  3. Then I changed the sql file the SQL command to
    DROP DATABASE pelagos;
    CREATE DATABASE pelagos DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
    USE pelagos;
    by simply changing the name of the database name because they cannot have the same db_name as they both are in the same server.
  4. then I transfered the backup into the new dir and then I import the sql file through phpmyadmin. And the new site does not seems to work properly please see https://www.pelagosmarine.gr.

Please tell me what am I doing wrong here? It seems to be something wrong with the database but I cannot trace it.

12 Feb 2012, 1:52 PM
#6
Join Date:
Jan 2012
Posts:
15
Plugin Contributions:
0

Re: How to Change "Home" to a different URL?

The thing that's confusing me is that the only template I've ever used is classic (I've not dared to incorporate a different template into my site settings). I'm using the original green default template that's standard for all new Zen Cart users. So I don't know why this folder only contains an empty text file when it apparently should already contain this english.php file. Hmmm...

13 Feb 2012, 5:48 PM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to Change "Home" to a different URL?

The stock default template and /template_default/ are two different things. Classic (the /classic/ folders) is an example of a custom template, which is enabled by default. It only contains files that it needs to be different from /template_default/. You can never select /template_default/ to be operational directly, but most of its files will be used by most custom templates. If your template needs to modify a file that is not already in its folders, copy it from the /template_default/ or basic version into your template folder and edit that.

Also, even if you don't want to mess with site settings, you need to use a different template folder than /classic/, because that will be erased and replaced every time you upgrade to a new version of Zen Cart.
Copy all of the /classic/ folders and their files to a new foldername, and edit the new template_info.php to reflect that foldername.

15 Feb 2012, 5:15 AM
#8
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: How to Change "Home" to a different URL?

EmJayNaturalBeautiqu:

The thing that's confusing me is that the only template I've ever used is classic (I've not dared to incorporate a different template into my site settings).

This saddens me. I'm sure you feel you have good reason to 'not dare to incorporate a different template' into your site, but whatever the reason is, it is invalid. If you continue to use (and modify) the 'classic' template you will cause yourself far more hassles and problems with upgrades than whatever it is/was that causes you to fear using a different template in the first place.

Furthermore, by adding another template (whilst still keeping the original 'classic' template untouched) will give you the ability to switch between your custom template and the original classic template if you ever need to solve problems or issues. One of the first things we tell people with template issues is 'does it work ok with the default template'. Knowing the answer to this goes a long way in determining whether any given issue is template related, or whether it has some other cause.

Cheers
Rod

15 Feb 2012, 6:38 PM
#9
Join Date:
Jan 2012
Posts:
15
Plugin Contributions:
0

Re: How to Change "Home" to a different URL?

Don't be saddened, RodG. I've only been using Zen Cart for a few weeks and haven't had time to delve into the world of changing templates. When I feel confident that making small adjustments to my website won't cause major issues like the one I had last week, and once I have time to find a new template that I want to use and learn how to incorporate it, I'll do it! :clap:

One of my concerns is that I don't have access to a person who can walk me through the process in a "live" setting or provide technical support if/when I err, so I must rely upon reading and correctly interpreting the instructions I find on this forum. This will take quite a bit of concentration for me to get it right. For now, I just need to remember how to properly back up my current files and database! LOL

15 Feb 2012, 6:52 PM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to Change "Home" to a different URL?

The basics of creating a custom template are very simple, like this: How do I create a new Custom Template?

Installing a template which you can then modify is usually even simpler; usually all you need to do is follow the directions in the template's readme file.

22 Feb 2012, 2:02 AM
#11
Join Date:
Jan 2012
Posts:
15
Plugin Contributions:
0

Re: How to Change "Home" to a different URL?

OK, I have officially begun my foray into the wonderful world of custom templates and CSS! I have set up my custom template folders and now I'm ready to try out CSS. However, the stylesheet that I'm interested in using wasn't designed for Zen Cart, so I'm not sure if I should try to use it. What do you think? Also, where can I find some decent free stylesheets designed for Zen Cart? Thanks for any assistance you can give. :)

~Bolder and Braver :clap:

22 Feb 2012, 2:38 AM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How to Change "Home" to a different URL?

A stylesheet not designed for Zen Cart will do almost nothing for you, as most of the stylesheet selectors will be either totally absent in Zen Cart or apply to somewhat different elements and give undesired results. You will need to find the Zen Cart element identifiers (classes, ids, etc.) that apply to the corresponding parts of the page and apply the style properties to those. It will work best to start with the /template_default/ or /classic/ stylesheet and modify from there, as they already have rules for most of the commonly-styled page elements. A large part of any custom template is the stylesheet, and there are some (like Future Zen) which are entirely stylesheet-driven. The "free stylesheets" you are looking for reside in every free template.