Hello.
There comes moments when you want to implement a hook_block to render the auction bidding table.
When calling the uc_auction_bid_table_form, I get the table rendered and ready but with no bidding textfield

// custom module
function mymodule_auction_bidder($nid) {
  $node = node_load($nid);

  return drupal_get_form('uc_auction_bid_table_form', $node, $node->teaser); // no bidding field
}

And I solved it by the following

// custom module
function mymodule_auction_bidder($nid) {
  $node = node_load($nid);

  return drupal_get_form('uc_auction_bid_table_form', $node, NULL); // this works
}

As you can see, I solved this by replacing $node->teaser with NULL. What strikes me as weird is that the $teaser variable is only a set of string to be displayed in the node a nodefield, not an auctionfield.

Hope this helps, and that it should be enough to call the function with $node as parameter.

Comments

jepster_’s picture

Thank's for your solution. Yes, it's a workaround and the code-behaviour is not very intuitive. That's a matter how Ubercart Auction was developed. It was always extended, without real refactoring..

Have you tried to debug uc_auction_bid_table_form(); with devel or breakpoints, using xdebug?

jepster_’s picture

Status: Needs review » Postponed (maintainer needs more info)

Status change.

adnasa’s picture

I've tried this using devel. I wasn't able to find anything very useful at the time, sorry.

I'm not sure what you expect me to find but here's something: the $node->teaser hasn't been passed/received in the uc_auction_bid_table_form(). Even if $node->teaser wasn't null, the form gets an empty string either way. Is this what you're trying to find out?

What I would suggest is that the uc_auction_bid_table_form shouldn't handle any $node fields at all (such as teaser). just to check if it is an auction, render a table or else nothing. I think this would help in reducing the need to override each time. :-P

adnasa’s picture

Title: Unexpected behavior using uc_auction_bid_table_form » Another bizarre behavior
Component: Code » User interface
Category: task » bug

Another bizarre behavior on this bid table is during the node submission.

When the user submits an auction there are a couple steps to be done.
If the user leaves the auction date on it's default value, the node being displayed later shows a completely different result. Date shows wrong (mostly "42 years ago".)
Bug when

  • - set an auction price
  • - leaves the auction date field on it's default value
  • - submit

Correct when

  • - set an auction price
  • - set an auction date
  • - submit

I checked through the $form_state, validation statements, and even the DB. They show correctly. Only during the node display, it's incorrect. I'm currently trying to fix this bug right now. Hopefully I can come back with some useful feedback, or perhaps a patch.

adnasa’s picture

Title: Another bizarre behavior » Bizarre behavior with uc_auction_bid_table_form
adnasa’s picture

Status: Postponed (maintainer needs more info) » Needs work

Turns out.
That the $expiry variable at the uc_auction.module line 478 is NULL during an insert in your nodeapi hook.

Wasn't the nicest fix, but I wrote strtotime($node->expiry)

adnasa’s picture

Issue summary: View changes

typo