$current_time = strtotime(date("Y-m-d H:i:s")); $data['sold_out'] = null; if ($next_date <= $current_time) { $max_price = get_maxprice($post_id); if ($max_price == 0) { $next_new_time = $next_date + 60 * 5; $new_date = date("Y-m-d H:i:s", $next_new_time); update_post_meta($post_id, "expire_time", $new_date); } else { update_post_meta($post_id, "sold_out", "yes"); $win_data = get_winner_data($post_id); $win_user_id = $win_data['uid']; $msg = "You win product with your bid " . $win_data['price']; $headers = 'From: Online Auction <*****@*****.**>' . "\r\n"; $attachments = ""; $data['sold_out'] = 1; $data['winner_price'] = $win_data['price']; $data['winner_uid'] = $win_data['uid']; $data['winner_name'] = get_the_author_meta("first_name", $win_user_id) . " " . get_the_author_meta("last_name", $win_user_id); } } $data['max_bid_userid'] = 1; $data['number_of_bids'] = get_number_of_bids($post_id); $data['max_bid'] = get_maxprice($post_id); $data['get_nextbid_price'] = get_nextbid_price($post_id); $data['post_view'] = getPostViews($post_id); echo json_encode($data); ?>
if (is_user_logged_in()) { ?> <button class="btn btn-primary btn-lg" href="javascript:void(0);" onclick="jQuery('.biddingbox').show();">Make Bid</button> <?php } else { echo "you have to sing-in first for bid here"; } ?> </div> </div> </li> <li class="list-group-item"> <span class="winner_price"> <pre> <i class="fa fa-check-square-o"></i> Current max bid is $<span id="current_max_price"><?php echo get_maxprice($post_id); ?> </span></pre> </li> </span> <li class="list-group-item biddingbox" style="display: none;"> <span class="label label-default pull-right" onclick="jQuery('.biddingbox').hide();">Hide Form</span> <form method="post" action="" class="row clearfix" onsubmit="return CheckBidding();"> <input type="hidden" name="post_id" value="<?php echo get_the_ID(); ?> "> <input type="hidden" name="user_id" value="<?php echo get_current_user_id(); ?> " /> <input type="hidden" name="auction_action" value="newbid"> <input type="hidden" name="bidtype" value="bid">
function get_maxprice_should($postID) { $cuprice = get_maxprice($postID); if ($cuprice == 0) { return get_post_meta($postID, "base_price", true); } else { return $cuprice; } }