Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Change URL of my Home Buttons to root of the domain when my site is in a sub folder

Change URL of my Home Buttons to root of the domain when my site is in a sub folder

Locked
This thread is locked. New replies are disabled.
14 Dec 2010, 10:25 AM
#1
colnixon avatar

colnixon

New Zenner

Join Date:
Apr 2008
Posts:
47
Plugin Contributions:
0

Post #1 by colnixon

Can a Sub Folder Installation have home button which point to the root of the domain?

I have installed my zen cart to https://www.kitchenandbedroominteriors.com/store

I want all of the 'Home Buttons' to link back to https://www.kitchenandbedroominteriors.com

I have had a good look through the forums and can not find any threads in relation to this.

Any help will be much appretiated

Many Thanks

14 Dec 2010, 1:47 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Post #2 by schoolboy

The home location is determined by php code.

For example: In your tpl_header.php file, you will see:

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

You'll need to remove (or comment out) that and create a hard-coded link to your desired home page.

20 years a Zencart User

14 Dec 2010, 3:45 PM
#3
colnixon avatar

colnixon

New Zenner

Join Date:
Apr 2008
Posts:
47
Plugin Contributions:
0

Post #3 by colnixon

Hi,

Which files would need to be hard coded?

Many Thanks

Col

schoolboy:

The home location is determined by php code.

For example: In your tpl_header.php file, you will see:

<li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
> 
> You'll need to remove (or comment out) that and create a hard-coded link to your desired home page.
14 Dec 2010, 4:54 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Post #4 by kobra

colnixon:

Which files would need to be hard coded?
schoolboy gave you the file
schoolboy:

For example: In your tpl_header.php file, you will see:

Zen-Venom Get Bitten

14 Dec 2010, 4:55 PM
#5
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Post #5 by schoolboy

Looks like you are using a derivation of Apple-zen template.

There are TWO main links in core zencart back to the "home" page (which is the front page of the webshop).

You will need to edit

includes/templates/apple_zen/common/tpl_header.php

and

includes/templates/apple_zen/common/tpl_footer.php

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

becomes:

<li><a href="http://www.kitchenandbedroominteriors.com">Main Site</a></li>

Rather than DELETE the original code, use comment tags to render it ineffective:

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

additionally, in apple_zen, there is another file:

includes/templates/apple_zen/common/tpl_drop_menu.php

... in which there is also a "home" link. Now in my opinion, you should leave this one in, but perhaps change the DEFINE for HEADER_TITLE_CATALOG:

/includes/languages/english/apple_zen/header.php

  • define('HEADER_TITLE_CATALOG', 'Home'); *

to something like:

  • define('HEADER_TITLE_CATALOG', 'Shop Home Page'); *

However, if you want this to ALSO point to the root site, then comment out the following line using HTML comment tags (shown in green)

** <!-- <li class="submenu"><a href="<?php echo zen_href_link(FILENAME_DEFAULT); ?>"><?php echo HEADER_TITLE_CATALOG; ?></a> -->**

and put in your own hardcode link directly under it... eg:
**
<li class="submenu"><a href="http://www.kitchenandbedroominteriors.com">Main Site</a>**

The HEADER_TITLE_CATALOG define is also used in places like the breadcrumbs, and you really don't want to fool about with those. That is why I suggest that whatever hard coding you do to other links, use Main Site as the text link, and by changing the define for HEADER_TITLE_CATALOG to Shop Home Page, at least your visitors will know what to click to either go back to your root site, or stay within the shop area.

20 years a Zencart User

15 Dec 2010, 10:05 PM
#6
colnixon avatar

colnixon

New Zenner

Join Date:
Apr 2008
Posts:
47
Plugin Contributions:
0

Post #6 by colnixon

Hi Schoolboy

Thanks a million for the in depth advice, my php aint great and the extra help is much appretiated

Thanks Again

Regards

Col