Zen Cart Logo
Forums / General Questions / Add local date and time to the Contact Us page

Add local date and time to the Contact Us page

Locked

Views: 778

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
1 Jun 2009, 4:07 AM
#1
lloyd_borrett avatar

lloyd_borrett

Zen Follower

Join Date:
Mar 2006
Location:
Rosebud, Victoria, Australia
Posts:
308
Plugin Contributions:
2

Add local date and time to the Contact Us page

How would I go about having Zen Cart add the local date and time (e.g. Monday, 1st June 2009 2:05 pm) into the text of my Contact Us page?

See http://www.scubadoctor.com.au/diveshop/index.php?main_page=contact_us

Even better, is there a Zen Cart add-on that lets me define physical store opening hours, that then displays them, plus notifies the user if the store is open or closed based on the current local time?

Cheers, Lloyd Borrett.

1 Jun 2009, 12:28 PM
#2
stevesh avatar

stevesh

Black Belt

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

Re: Add local date and time to the Contact Us page

I've seen Zencart sites with the date and time in the header, and I assumed they found a script of some kind from, say, hotscripts, and plugged it into the page. There may also be something available to do the second part of your question.

1 Jun 2009, 1:53 PM
#3
lloyd_borrett avatar

lloyd_borrett

Zen Follower

Join Date:
Mar 2006
Location:
Rosebud, Victoria, Australia
Posts:
308
Plugin Contributions:
2

Re: Add local date and time to the Contact Us page

G'day,

I've worked out how to do this. Turns out you can put PHP code into a defined page. Thus I was able to add the following into define_contact_us.php...

<?php echo date('l, jS F Y g:i a', time() + (TIME_ZONE_OFFSET * 3600)); ?>

My server is in the USA and the shop is in Melbourne, Australia. Therefore it's necessary to convert the server time to local time.

I have the Timesone Offset Module installed and this creates a variable TIME_ZONE_OFFSET being the hours difference between the server time and local time. Applying the offset to the server time gives me the local time.

You can see it in action at http://www.scubadoctor.com.au/diveshop/index.php?main_page=contact_us

Cheers, Lloyd Borrett.