Needs work
Project:
Ubercart Auction
Version:
6.x-1.0
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Jan 2012 at 14:04 UTC
Updated:
7 Feb 2012 at 14:42 UTC
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
Comment #1
jepster_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?
Comment #2
jepster_Status change.
Comment #3
adnasa commentedI'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
Comment #4
adnasa commentedAnother 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
Correct when
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.
Comment #5
adnasa commentedComment #6
adnasa commentedTurns 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 s
trtotime($node->expiry)Comment #6.0
adnasa commentedtypo