Skip to content

Instantly share code, notes, and snippets.

Created March 1, 2013 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5066277 to your computer and use it in GitHub Desktop.
Save anonymous/5066277 to your computer and use it in GitHub Desktop.
By default, Commerce Auction (http://drupal.org/project/commerce_auction) puts the bid form on a separate page/tab from the auction node. The code below can be added to your theme's template.php file, and updated [minimally] to work with your site.
<?php
// 1. put your theme name below
function YOURTHEMENAME_preprocess_node(&$variables) {
// 2. put your content type below
if ($variables['type'] == 'auction_listing') {
if ($variables['auction_timeout'][0]['value'] > time()) {
if (user_access('place bids', $variables['user'])) {
// display the bid form
$node = $variables['node'];
module_load_include('inc', 'commerce_auction', 'includes/commerce_auction.pages');
$bidform = drupal_get_form('commerce_auction_place_bid_form', $node);
unset($bidform['warnings']);
$variables['content']['auction_bid_form'] = $bidform;
$variables['content']['auction_bid_form']['#weight'] = 6;
} else {
$variables['content']['auction_bid_form'] = array(
'#markup' => "<div class='loginmsg'>Please <a href='/user'>Log in</a> or <a href='/user/register'>Register</a> to place your bid.</div>",
'#weight' => 6,
);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment