auction_checkout_page()
ecommerce-5--4/contrib/auction/auction.module, line 162
Add all auction products that the user won to cart
<?php
function auction_checkout_page() {
global $user;
// Anonyomus users should login first
if ($user->uid < 1) {
drupal_goto('user/login');
}
if (user_access('place bids')) {
$title = t('Checkout');
$result = db_query('SELECT bid.nid, MAX(bid.bid)
FROM {ec_auction_bid} bid
INNER JOIN {ec_product_auction} auc ON bid.nid = auc.nid
WHERE auc.expires < %d AND bid.uid = %d
GROUP BY bid.nid', time(), $user->uid);
while ($item = db_fetch_object($result)) {
if (!db_result(db_query("SELECT qty FROM {ec_cart}
WHERE cookie_id = '%s' AND nid = %d", ec_checkout_get_id(), $item->nid))) {
// Note: cart_add($item->nid) would set a message, so we go straight to the api.
cart_update_item($item->nid, 1, null);
}
}
drupal_goto('checkout/process');
}
}
?>