Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default 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. #2
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    6,197
    Plugin Contributions
    0

  3. #3
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default 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.

  4. #4
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    6,197
    Plugin Contributions
    0

    Default Re: Would like to add a countdown clock

    Jo,
    Your Welcome,

  5. #5
    Join Date
    Jan 2009
    Posts
    201
    Plugin Contributions
    6

    Default 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

  6. #6
    Join Date
    Apr 2009
    Location
    Chicago, IL
    Posts
    45
    Plugin Contributions
    0

    Default 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!

  7. #7
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default 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.

  8. #8
    Join Date
    Apr 2009
    Location
    Chicago, IL
    Posts
    45
    Plugin Contributions
    0

    Default Re: Would like to add a countdown clock

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

  9. #9
    Join Date
    Jun 2010
    Posts
    1
    Plugin Contributions
    0

    Default 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

  10. #10
    Join Date
    Jun 2009
    Location
    Otorohanga, New Zealand
    Posts
    25
    Plugin Contributions
    0

    Default 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

    www.wholesalewarehouse.co.nz

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

    R

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Countdown Clock
    By gnfb in forum General Questions
    Replies: 2
    Last Post: 13 Jun 2011, 12:46 PM
  2. how to add countdown clock to my special list?
    By snowdance125 in forum General Questions
    Replies: 4
    Last Post: 11 May 2011, 04:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg