Forums / Templates, Stylesheets, Page Layout / Changing URL link of image with logo from Home Page

Changing URL link of image with logo from Home Page

Views: 1,687

Results 1 to 9 of 9
13 Apr 2014, 5:29 AM
#1
sachin1008 avatar

sachin1008

New Zenner

Join Date:
Mar 2014
Posts:
32
Plugin Contributions:
0

Changing URL link of image with logo from Home Page

I have my shopping cart under directory. So, when someone clicks on the logo, I want MySite.com page to open instead of MySite.com/NameofShoppingCart at present. Thanks in advance!

13 Apr 2014, 1:29 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Changing URL link of image with logo from Home Page

Please read through the Similar Threads linked below.

14 Apr 2014, 7:29 AM
#3
sachin1008 avatar

sachin1008

New Zenner

Join Date:
Mar 2014
Posts:
32
Plugin Contributions:
0

Re: Changing URL link of image with logo from Home Page

I tried the following way but failed.

Under /includes/templates/template_default/common in tpl_header.php file, I added the third line: <li><a href="http://your_main_page_url">Main Site</a></li>

<div id="navMain"> <ul class="back"> <li><a href="http://your_main_page_url">Main Site</a></li> <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li> <?php if ($_SESSION['customer_id']) { ?> <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li> <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>

On clicking the logo, I still get the shopping cart page (directory) instead of home page.

14 Apr 2014, 2:45 PM
#4
yaritai avatar

yaritai

Zen Follower

Join Date:
Apr 2014
Posts:
154
Plugin Contributions:
0

Re: Changing URL link of image with logo from Home Page

Sachin1008:

I tried the following way but failed.

Under /includes/templates/template_default/common in tpl_header.php file, I added the third line: <li><a href="http://your_main_page_url">Main Site</a></li>

<div id="navMain"> <ul class="back"> <li><a href="http://your_main_page_url">Main Site</a></li> <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li> <?php if ($_SESSION['customer_id']) { ?> <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li> <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>

On clicking the logo, I still get the shopping cart page (directory) instead of home page.

The part you added is not for your logo. Instead what you did was add a home page link in your navigation bar.

The part you want to edit is below that. Look for the div id of logo. In that line you will see a reference to a href which is what you want to change.

14 Apr 2014, 3:08 PM
#5
gjh42 avatar

gjh42

Black Belt

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

Re: Changing URL link of image with logo from Home Page

Correct. You will need to find the "logo" section of your template's /includes/templates/your_template_name/common/tpl_header.php file (copy it from /includes/templates/template_default/common/tpl_header.php if you don't already have a custom template copy).
Change the link for the logo to your domain root:
<a href="http://your_main_page_url">

Note that you should never edit files in /template_default/, but first copy them to the same location under /your_template/, whatever that is, then edit the file. This will save you headaches next time you upgrade to a new version of Zen Cart.

26 Apr 2014, 2:28 PM
#6
sachin1008 avatar

sachin1008

New Zenner

Join Date:
Mar 2014
Posts:
32
Plugin Contributions:
0

Re: Changing URL link of image with logo from Home Page

I have copied file to /includes/templates/classic as tpl.header.php and edited as follow: txt<div id="logo"><?php echo '<a href="http://www.MySiteName.com" . HTTP_SERVER . DIR_WS_CATALOG . '">' .

I do not think I did the right way as the link is still opening the shopping portal home page instead of main site.

28 Apr 2014, 1:37 AM
#7
gjh42 avatar

gjh42

Black Belt

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

Re: Changing URL link of image with logo from Home Page

HTTP_SERVER has the value of http://www.MySiteName.com, so that is all you need in the link code: ```php

<div id="logo"><?php echo '<a href="' . HTTP_SERVER . '">'?> ```
28 Apr 2014, 6:16 AM
#8
sachin1008 avatar

sachin1008

New Zenner

Join Date:
Mar 2014
Posts:
32
Plugin Contributions:
0

Re: Changing URL link of image with logo from Home Page

Under includes/templates/classic, the following code is posted:

< <div id="logo"><?php echo '<a href="' . HTTP_SERVER . '">'?> DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></div>

Still getting the link taking to home page of shopping portal instead of main site.

28 Apr 2014, 1:24 PM
#9
gjh42 avatar

gjh42

Black Belt

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

Re: Changing URL link of image with logo from Home Page

Seeing the whole section shows several errors. Most importantly, you do not want to have DIR_WS_CATALOG in the output at all, as that points to your Zen Cart. The leading < before <div looks wrong, and knowing that the PHP code continues past the link output means that you do not want the ?> after HTTP_SERVER . '">'```php

<div id="logo"><?php echo '<a href="' . HTTP_SERVER . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></div> ```