Zen Cart Logo
Forums / General Questions / change Welcome Guest

change Welcome Guest

Views: 814

Results 1 to 5 of 5
24 May 2011, 7:12 PM
#1
adb34 avatar

adb34

Totally Zenned

Join Date:
Mar 2008
Location:
Brampton, Cumbria, United Kingdom, United Kingdom
Posts:
825
Plugin Contributions:
0

change Welcome Guest

I would like to change "Welcome Guest" in to a 'Time of Greeting and Guest'. I have a javascript ready to go, however, I cannot work out how to and where to put it. File location is

/includes/languages/english/index.php

and the command line 27 reads

define('TEXT_GREETING_GUEST', 'Welcome <span class="greetUser">Guest!</span> please <a href="%s">log yourself in</a>?');

The java script is;

<script language="JavaScript" type="text/javascript"> <!-- var day = new Date(); var hr = day.getHours(); if (hr <= 11) { document.write("Good Morning!"); } else if (hr > 11 && hr < 17) { document.write("Good Afternoon!"); } else { document.write("Good Evening!"); } //--> </script>
24 May 2011, 9:55 PM
#2
soniccc avatar

soniccc

Zen Follower

Join Date:
May 2010
Location:
Cyberspace
Posts:
387
Plugin Contributions:
0

Re: change Welcome Guest

Ok. Here's what I did. Find this part > <!-- eof breadcrumb --> located in your tpl_main_page.php file, under includes/templates/YOUR_TEMPLATE/common/. Directly after this part paste this into your file> <!--<div id="greetingScript">

<script type="text/javascript" src="welcome.js"></script> <script type="text/javascript"> var day = new Date(); var hr = day.getHours(); if (hr <= 11) {document.write("Good Morning!");} else if (hr > 11 && hr < 17) {document.write("Good Afternoon!");} else {document.write("Good Evening!");} </script> </div>You have to do a bit of CSS in order for it to display the way you want. I you want the file to display the greeting in your index.php file you could simply paste the entire message into the script file, like this:

document.write("Good Morning! Welcome Guest");

I'm sure there are also other ways to do this..

Thanks

25 May 2011, 2:02 PM
#3
adb34 avatar

adb34

Totally Zenned

Join Date:
Mar 2008
Location:
Brampton, Cumbria, United Kingdom, United Kingdom
Posts:
825
Plugin Contributions:
0

Re: change Welcome Guest

Thanks for the info.

You are talking about css but you mention index.php could you please expain this bit and could you please let me know where abouts the new line is to go.

Thank you

25 May 2011, 2:55 PM
#4
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,180
Plugin Contributions:
0

Re: change Welcome Guest

Locate this file:

includes/ templates/ YOUR_TEMPLATE/ common/ tpl_main_page.php

You will find this coding:

<!-- bof  breadcrumb -->
<?php if (DEFINE_BREADCRUMB_STATUS == '1' || (DEFINE_BREADCRUMB_STATUS == '2' && !$this_is_home_page) ) { ?>
    <div id="navBreadCrumb"><?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></div>
<?php } ?>
<!-- eof breadcrumb -->

Add this below right after the <!-- eof breadcrumb -->

<div id="greetingScript">
<script type="text/javascript" src="welcome.js"></script>
<script type="text/javascript">
var day = new Date();
var hr = day.getHours();
if (hr <= 11)
{document.write("Good Morning!");}
else if (hr > 11 && hr < 17)
{document.write("Good Afternoon!");}
else {document.write("Good Evening!");}
</script>
</div>
25 May 2011, 3:21 PM
#5
adb34 avatar

adb34

Totally Zenned

Join Date:
Mar 2008
Location:
Brampton, Cumbria, United Kingdom, United Kingdom
Posts:
825
Plugin Contributions:
0

Re: change Welcome Guest

Thanks for the info I now have at this moment in time Good Morning, however it is in the wrong place (sorry).

I would like to replace the wording that is currently

say "Welcome Guest" to say that '[time day greeting] Guest',

then when you are logged to say '[time day greeting] [your first name]'

then after that I do not wish it to appear

https://www.edencraftsupplies.co.uk/shop