$OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage']; } $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "winners\n\t\tWHERE paid = 0 AND winner = :winner_id"; $params = array(); $params[] = array(':winner_id', $user->user_data['id'], 'int'); $db->query($query, $params); $TOTALAUCTIONS = $db->result('COUNT'); $PAGES = $TOTALAUCTIONS == 0 ? 1 : ceil($TOTALAUCTIONS / $system->SETTINGS['perpage']); $query = "SELECT w.id, w.winner, w.auc_title, w.shipping_cost, w.bid, w.qty, w.auction As auc_id, a.shipping_cost_additional, a.shipping FROM " . $DBPrefix . "winners w\n\t\tLEFT JOIN " . $DBPrefix . "auctions a ON (a.id = w.auction)\n\t\tWHERE w.paid = 0 AND w.winner = :user_id\n\t\tLIMIT :OFFSET, :per_page"; $params = array(); $params[] = array(':user_id', $user->user_data['id'], 'int'); $params[] = array(':OFFSET', $OFFSET, 'int'); $params[] = array(':per_page', $system->SETTINGS['perpage'], 'int'); $db->query($query, $params); while ($row = $db->fetch()) { $shipping_data = calculate_shipping_data($row, false); $template->assign_block_vars('to_pay', array('ID' => $row['id'], 'URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $row['auc_id'], 'TITLE' => $system->uncleanvars($row['title']), 'PAY_SHIPPING' => $row['shipping'] == 1, 'SHIPPING' => $system->print_money($shipping_data['shipping_cost']), 'ADDITIONAL_SHIPPING_COST' => $system->print_money($shipping_data['additional_shipping_cost']), 'TOTAL_SHIPPING_COST' => $system->print_money($shipping_data['shipping_total']), 'ADDITIONAL_SHIPPING' => $system->print_money($row['additional_shipping_cost']), 'ADDITIONAL_SHIPPING_PLAIN' => $row['additional_shipping_cost'], 'ADDITIONAL_SHIPPING_QUANTITYS' => $row['qty'] - 1, 'QUANTITY' => $row['qty'], 'BID' => $system->print_money($row['bid'] * $row['qty']), 'TOTAL' => $system->print_money($row['bid'] * $row['qty'] + $shipping_data['shipping_total']), 'AUC_ID' => $row['auc_id'], 'WINID' => $row['id'], 'B_NOTITLE' => empty($row['title']))); } // get pagenation $PREV = intval($PAGE - 1); $NEXT = intval($PAGE + 1); if ($PAGES > 1) { $LOW = $PAGE - 5; if ($LOW <= 0) { $LOW = 1; } $COUNTER = $LOW; while ($COUNTER <= $PAGES && $COUNTER < $PAGE + 6) { $template->assign_block_vars('pages', array('PAGE' => $PAGE == $COUNTER ? '<b>' . $COUNTER . '</b>' : '<a href="' . $system->SETTINGS['siteurl'] . 'outstanding.php?PAGE=' . $COUNTER . '"><u>' . $COUNTER . '</u></a>')); $COUNTER++; }
$ff_paid = 0; } } // work out shipping cost $query = "INSERT INTO " . $DBPrefix . "winners\n\t\t\t\t\t(auction, seller, winner, bid, closingdate, feedback_win, feedback_sel, qty, paid, bf_paid, ff_paid, shipped, auc_title, auc_shipping_cost, auc_payment) VALUES\n\t\t\t\t\t(:auc_id, :seller_id, :winner_id, :buy_now, :time, 0, 0, :quantity, 0, :bf_paid, :ff_paid, 0, :auc_title, :auc_shipping_cost, :auc_payment)"; $params = array(); $params[] = array(':auc_id', $id, 'int'); $params[] = array(':seller_id', $Auction['user'], 'int'); $params[] = array(':winner_id', $Winner['id'], 'int'); $params[] = array(':buy_now', $Auction['buy_now'], 'float'); $params[] = array(':time', $NOW, 'int'); $params[] = array(':quantity', $qty, 'int'); $params[] = array(':bf_paid', $bf_paid, 'float'); $params[] = array(':ff_paid', $ff_paid, 'float'); $params[] = array(':auc_title', $Auction['title'], 'str'); $params[] = array(':auc_shipping_cost', calculate_shipping_data($Auction), 'float'); $params[] = array(':auc_payment', $Auction['payment'], 'str'); $db->query($query, $params); $winner_id = $db->lastInsertId(); // get end string $month = date('m', $Auction['ends'] + $system->tdiff); $ends_string = $MSG['MON_0' . $month] . ' ' . date('d, Y H:i', $Auction['ends'] + $system->tdiff); $Auction['current_bid'] = $Auction['buy_now']; include $include_path . 'endauction_mutli_item_win.php'; include $include_path . 'email_seller_partial_winner.php'; if ($system->SETTINGS['fees'] == 'y' && $system->SETTINGS['fee_type'] == 2 && $fee > 0) { $_SESSION['auction_id'] = $auction_id; header('location: pay.php?a=6'); exit; } if ($Auction['initial_quantity'] == 1 || $Auction['quantity'] - $qty == 0) {
$OFFSET = ($PAGE - 1) * $system->SETTINGS['perpage']; } $query = "SELECT COUNT(id) As COUNT FROM " . $DBPrefix . "winners\n\t\tWHERE paid = 0 AND winner = :winner_id"; $params = array(); $params[] = array(':winner_id', $user->user_data['id'], 'int'); $db->query($query, $params); $TOTALAUCTIONS = $db->result('COUNT'); $PAGES = $TOTALAUCTIONS == 0 ? 1 : ceil($TOTALAUCTIONS / $system->SETTINGS['perpage']); $query = "SELECT w.id, w.winner, w.auc_title, w.auc_shipping_cost, a.shipping_cost, w.bid, w.qty, w.auction As auc_id, a.additional_shipping_cost, a.shipping FROM " . $DBPrefix . "winners w\n\t\tJOIN " . $DBPrefix . "auctions a ON (a.id = w.auction)\n\t\tWHERE w.paid = 0 AND w.winner = :user_id\n\t\tLIMIT :OFFSET, :per_page"; $params = array(); $params[] = array(':user_id', $user->user_data['id'], 'int'); $params[] = array(':OFFSET', $OFFSET, 'int'); $params[] = array(':per_page', $system->SETTINGS['perpage'], 'int'); $db->query($query, $params); while ($row = $db->fetch()) { $shipping_data = calculate_shipping_data($row, $row['qty'], false); $template->assign_block_vars('to_pay', array('ID' => $row['id'], 'URL' => $system->SETTINGS['siteurl'] . 'item.php?id=' . $row['auc_id'], 'TITLE' => htmlspecialchars($row['auc_title']), 'PAY_SHIPPING' => $row['shipping'] == 1, 'SHIPPING' => $system->print_money($shipping_data['shipping_cost']), 'ADDITIONAL_SHIPPING_COST' => $system->print_money($shipping_data['additional_shipping_cost']), 'TOTAL_SHIPPING_COST' => $system->print_money($shipping_data['shipping_total']), 'ADDITIONAL_SHIPPING' => $system->print_money($row['additional_shipping_cost']), 'ADDITIONAL_SHIPPING_PLAIN' => $row['additional_shipping_cost'], 'ADDITIONAL_SHIPPING_QUANTITYS' => $row['qty'] - 1, 'QUANTITY' => $row['qty'], 'BID' => $system->print_money($row['bid'] * $row['qty']), 'TOTAL' => $system->print_money($row['bid'] * $row['qty'] + $shipping_data['shipping_total']), 'AUC_ID' => $row['auc_id'], 'WINID' => $row['id'], 'B_NOTITLE' => empty($row['auc_title']))); } // get pagenation $PREV = intval($PAGE - 1); $NEXT = intval($PAGE + 1); if ($PAGES > 1) { $LOW = $PAGE - 5; if ($LOW <= 0) { $LOW = 1; } $COUNTER = $LOW; while ($COUNTER <= $PAGES && $COUNTER < $PAGE + 6) { $template->assign_block_vars('pages', array('PAGE' => $PAGE == $COUNTER ? '<b>' . $COUNTER . '</b>' : '<a href="' . $system->SETTINGS['siteurl'] . 'outstanding.php?PAGE=' . $COUNTER . '"><u>' . $COUNTER . '</u></a>')); $COUNTER++; }