Show Winners Full Name
Archived from the Web Auction Discussion forum.
zedimus — Wed Dec 10, 2008 10:26 am
I have been trying to show the winners Full Name in the Reports section and on the product page for the admin, i cant get them to work, I just want one to work.
On the product page i have tryed this
- Code: Select all
{if isAdmin()}The high bidder is {$record->val('firstname')}{/if}
that just give me a blank space after The high bidder is
and i have tryed this
- Code: Select all
{if isAdmin()}The high bidder is {$users->val('firstname')}{/if}
and that just breaks the site template and gives me a sql error.
Do i have to add something else to another file so it knows to take the first and last name or the full name from the high bidder.?
Thanks
David
shannah — Wed Dec 10, 2008 2:49 pm
Hi Zedimus,
Where were you trying to add this code? If it was in the templates/view_product.html template, then you’re on the right track. You just need to notice that the product record is stored in a variable called $product in that template and not $record.
Now in order to get the winner’s full name you’ll also need to add a calculated field in the products delegate class to return the full name. Something like:
- Code: Select all
function field__winner_full_name(&$record){ $winner = df_get_record('users', array('username'=>'='.$record->val('high_bidder'))); if ( !$winner ) return null; return $winner->val('firstname').' '.$winner->val('lastname'); }
(assuming that the firstname and lastname columns exist in the users table).
Then in your template you would be able to use this field:
- Code: Select all
{$product->val('winner_full_name')}
-Steve
zedimus — Thu Dec 11, 2008 9:04 am
Thank you steve That worked perfect.
David