I am trying to help out a preschool with their annual fundraising auction. Everything else is fine but when I try to make a view for them so that they can see what the current high bids are it gives the errors below and doesn't show the products. I am adding the "Product: High bid" in Views 2. Everything is current in terms of modules. Latest Drupal 6 etc. Any help would be greatly appreciated.
Thanks,
Michael
Errors:
user warning: Unknown column 'uc_auction.high_bid' in 'on clause' query: SELECT COUNT(*) FROM (SELECT DISTINCT node.nid AS nid FROM node node LEFT JOIN uc_auction_bids uc_auction_bids ON uc_auction.high_bid = uc_auction_bids.bid LEFT JOIN uc_auction uc_auction ON node.nid = uc_auction.nid WHERE (node.status <> 0) AND (node.type IN ('product','auction')) ) count_alias in /XXXXXXXXXXXX/modules/views/includes/view.inc on line 745.
user warning: Unknown column 'uc_auction.high_bid' in 'on clause' query: SELECT DISTINCT node.nid AS nid, node.type AS node_type, node.title AS node_title, uc_auction.start_price AS uc_auction_start_price, uc_auction_bids.amount AS uc_auction_bids_amount FROM node node LEFT JOIN uc_auction_bids uc_auction_bids ON uc_auction.high_bid = uc_auction_bids.bid LEFT JOIN uc_auction uc_auction ON node.nid = uc_auction.nid WHERE (node.status <> 0) AND (node.type IN ('product','auction')) ORDER BY node_title ASC LIMIT 0, 10 in /XXXXXXXXXXXX/modules/views/includes/view.inc on line 771.
Comments
Comment #1
jasonawantHi Michael,
I haven't used this module yet, but I'm currently evaluating it. Your error message makes me think that you need to define a view relationship to use the product: High bid field. I could be wrong though. You'd have to give it a try. Not familiar with view relationships, watch this: http://gotdrupal.com/videos/drupal-views-relationships.
HTH
jwant
Comment #2
acontia commentedHi,
I had the same problem and I have resolved it with a not very clean solution... but works and you don't need to patch the module.
I've installed the Views Custom Field module, which allows you to get custom fields in a view.
Once installed and enabled you can add a new custom field "customfield > Customfield: PHP code". In the "value" field write this php code:
<?php print(custom_high_bid($data->nid)); ?>and then in your template.php or custom module you define the function:
The same works for the high bidder
Comment #3
crandallr commentedLifesaver! Thanks!
Comment #4
zilverdistel commentedTrying to figure this out. The query I get from views is
This gives me the error described in the issue above, but when I swap the 2 joins, the query seems to work:
Comment #5
zilverdistel commentedUsing the filter Product - 'Is an auction' in my view solved my problem. I was hinted by a comment in 'modules/uc_auction/views/uc_auction_handler_filter_is_auc.inc'.
Comment #6
ermannob commentedThanks zilverdistel. Your solution worked for me.
Comment #7
jepster_We have a solution, so I set this issue to fixed.
Comment #8
jepster_closed
Comment #9
Quaranta commentedThe uc_auction_bids table is called too soon in the query (as described in #4).
I fixed this using hook_views_query_alter:
This moves the uc_auction_bids join to the end of the query, problem solved.
Comment #10
gumol commentedI have a problem with sorting by field high_bid. It displays high_bid_amount but sorts by high_bid_id. Any ideas how to fix it to sort by high_bid_amount?