Desactivate a BUY button on countdown timer's Time Limit

Discussion in 'PHP' started by gabaozin, Jan 21, 2011.

  1. #1
    Greetings,

    I hope I find you in a good moment.


    I'm working on a project where the client wants to reproduce the format of a group-buying site, like Groupon and so many others, in a Wordpress environment.

    I'm showing prices and discounts information through Custom Field, and using a Countdown Timer Plugin to do the job of counting down (obviously).

    I have tried several Countdown Timer Plugins and all of them just echo "Time Out" when it reaches the Time Limit.

    The problem with such a simple action at the event is that end-clients would be able to continue buying even after the Daily Deal is over, resulting in financial problems with the supplier.

    I'm trying to generate a code where the BUY button would be desactivated once Time Limit is reached, but I must confess that I'm kind of stucked here.

    I'm hoping to find a good soul here to help me move on with this project.


    The actual code is something like this:

    if(($time_left < 0)&&($timeSince==1)&&((($time_left + $timeSinceTime) > 0)||($timeSinceTime == 0))){

    if($eventText){
    $content .= $eventTitle;
    }
    $content .= $timePrefix.sprintf(__("%s ago", 'fergcorp_countdownTimer'), fergcorp_countdownTimer_fuzzyDate((time() + $offset), $time, $time))."</abbr>";
    if(!$standalone)
    $content .= "</li>\r\n";
    return $content;
    }
    elseif($time_left > 0){ //If the event has not yet happened yet
    $fergcorp_countdownTimer_noEventsPresent = FALSE; //Set to FALSE so we know there's an event to display
    $fergcorp_countdownTimer_jsUID[count($fergcorp_countdownTimer_jsUID)] = array("id" => $nonceTracker,
    "targetDate" => $time,
    );


    I can't wait to see some ideas on how to achieve the end result I'm looking for.

    Thanks so much in advance!

    Gabriel Leveau
     
    gabaozin, Jan 21, 2011 IP
  2. Alex Roxon

    Alex Roxon Active Member

    Messages:
    424
    Likes Received:
    11
    Best Answers:
    7
    Trophy Points:
    80
    #2
    Personally I'd just give each event an expiry field in the database - it can be a simple timestamp. When you go to purchase, make sure the event hasn't expired.

    if( time() > $Event['expiry'] ) {
        // Expired
    }
    PHP:
    I haven't actually used these kind of sites before, so I'm not sure exactly how they work.
     
    Alex Roxon, Jan 21, 2011 IP