Forums / General Questions / Would like to add a countdown clock

Would like to add a countdown clock

Views: 5,488

Results 1 to 14 of 14
2 Nov 2009, 4:31 PM
#1
johnboycr avatar

johnboycr

Zen Follower

Join Date:
Jan 2009
Posts:
201
Plugin Contributions:
2

Would like to add a countdown clock

I my Zen site, I have an announcement of current sales. The
sales are presented using <fieldset>. Works great. However,
when the time left in the current sale is less than X hours, I
would like to add a statement at the bottom of the field that
would announce the number of hours left in the sale.

I believe that I know how to write the PHP code to do this, and
could save said code as say /includes/special/time_left.php
for example). The problem is that I don't know how to get
the results from that code and place it in my main page.

I tried to just insert the code into the _define_main_page.php
code, as <?php CODE ?>, and as you probably already know it
did not work.

Any suggestions / help with this?

2 Nov 2009, 4:45 PM
#3
johnboycr avatar

johnboycr

Zen Follower

Join Date:
Jan 2009
Posts:
201
Plugin Contributions:
2

Re: Would like to add a countdown clock

I had not seen that thread. I had done multiple search in this forum
for countdown closk and saw nothing. I am but an EGG! I will
see if that code can be incorporated. Thanks.

2 Nov 2009, 4:56 PM
#4
haredo avatar

haredo

Totally Zenned

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

Re: Would like to add a countdown clock

Jo,
Your Welcome,

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.

Zen Cart Certified hosting at myZenCartHost.com.

2 Nov 2009, 5:20 PM
#5
johnboycr avatar

johnboycr

Zen Follower

Join Date:
Jan 2009
Posts:
201
Plugin Contributions:
2

Re: Would like to add a countdown clock

haredo,

Tried out the code on my localhost and looks like I can adapt that just fine!
Thanks a bunch (of carrots?) LOL!

John

19 Jan 2010, 11:08 PM
#6
chrismarie avatar

chrismarie

New Zenner

Join Date:
Apr 2009
Location:
Chicago, IL
Posts:
45
Plugin Contributions:
0

Re: Would like to add a countdown clock

I would like to check the link to the other thread that was posted, but every time I try to follow the link, I get the error:

chrismarie, you do not have permission to access this page. This could be due to one of several reasons:

  1. Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  2. If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

I'm not finding another post when I search countdown either, could you tell me who the original poster is so that I can search by their name? Thanks!

20 Jan 2010, 12:03 AM
#7
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,668
Plugin Contributions:
0

Re: Would like to add a countdown clock

Sorry, the posts you are trying to get to have been archived. I think the link to the countdown clock they were pointing to is:

http://elouai.com/countdown-clock.php

Hope this helps.

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

6 Feb 2010, 5:05 AM
#8
chrismarie avatar

chrismarie

New Zenner

Join Date:
Apr 2009
Location:
Chicago, IL
Posts:
45
Plugin Contributions:
0

Re: Would like to add a countdown clock

Duh! I'm an idiot :) Thanks so much for the reply and the link!

13 Jul 2010, 1:29 PM
#9
tobias10 avatar

tobias10

New Zenner

Join Date:
Jun 2010
Posts:
1
Plugin Contributions:
0

Re: Would like to add a countdown clock

I am trying to create a javascript countdown clock that will count the time till the end of my "special". I would like the clock to get its info of when the sale ends from the db.

I tried using the code from here, and adapting it to use with zen cart.

I made the following two pages:
includes/modules/pages/product_info/jscript_countdown.js
includes/modules/pages/product_info/on_load_countdown.js

What I can't figure out is how can I send php variables with the time my "special" ends to the javascript. Is there a way to do it with onload? Am I totally looking in the wrong direction? can someone suggest a better way of doing it?

Thanx a ton
Tobias

3 May 2011, 5:03 AM
#10
scottwww1 avatar

scottwww1

New Zenner

Join Date:
Jun 2009
Location:
Otorohanga, New Zealand
Posts:
25
Plugin Contributions:
0

Re: Would like to add a countdown clock

<script LANGUAGE="JavaScript"> var present; var future; var tseconds; var seconds; var minutes; var hours; var days; ID=setTimeout("countdown();", 1000); function countdown() { present = new Date(); present = present.getTime() + (60000) + (12 * 60 * 60 * 1000); future = new Date("May 8, 2011 23:59:00"); tseconds = (future - present) / 1000; days = tseconds /24/60/60; days = Math.floor(days); tseconds = tseconds - (days * 24 * 60 * 60); hours = tseconds /60/60; hours = Math.floor(hours); tseconds = tseconds - (hours * 60 * 60); minutes = tseconds /60; minutes = Math.floor(minutes); tseconds = tseconds - (minutes * 60); seconds = tseconds; seconds = Math.floor(seconds); document.getElementById('days').innerHTML = days; document.getElementById('hours').innerHTML = hours; document.getElementById('minutes').innerHTML = minutes; document.getElementById('seconds').innerHTML = seconds; ID=setTimeout("countdown();", 1000); } </script> <script LANGUAGE="JavaScript"> today = new Date(); todayEpoch = today.getTime(); target = new Date("8 May, 2011"); targetEpoch = target.getTime(); daysLeft = Math.floor(((targetEpoch - todayEpoch) / (60*60*24)) / 1000); </script> <br> <div style="TEXT-ALIGN: center"> <font size="6"><strong>

<SPAN id="days">0</SPAN> Days.
<SPAN id="hours">0</SPAN> hr.
<SPAN id="minutes">0</SPAN> min,
<SPAN id="seconds">0</SPAN> sec. </font>

</div>

I have added this into the Mainpage

https://www.wholesalewarehouse.co.nz

I have to change it each week at present but working on a solution for that too

R

10 Oct 2011, 10:04 AM
#11
caska avatar

caska

New Zenner

Join Date:
Jul 2011
Posts:
12
Plugin Contributions:
0

Re: Would like to add a countdown clock

I've placed the countdown script by scottwww1 on my define_main_page but weird thing is, when i previewed it on zen, it works fine but on the live site, it doesn't counts down :( what have i done wrong?

site is: http://pinkoholic.co.uk/

10 Oct 2011, 10:23 AM
#12
caska avatar

caska

New Zenner

Join Date:
Jul 2011
Posts:
12
Plugin Contributions:
0

Re: Would like to add a countdown clock

Can't edit my own post for some reason :(
The correct link is: http://pinkoholic.co.uk/index.php?main_page=contact_us

Any help would be much appreciated

12 Oct 2011, 8:32 AM
#13
caska avatar

caska

New Zenner

Join Date:
Jul 2011
Posts:
12
Plugin Contributions:
0

Re: Would like to add a countdown clock

bump. can anyone help with this please..

30 Aug 2013, 7:27 PM
#14
rubi_kauneus_m_rke avatar

rubi_kauneus_m_rke

New Zenner

Join Date:
Aug 2013
Location:
Guadalajara, Mexico
Posts:
3
Plugin Contributions:
0

Re: Would like to add a countdown clock

excuse me, im trying to use this but cant find wheres to put it so, can you please tell me located the mainpage you added to that code ?