As I understand correctly, for now, end of auction is detect only when somebody visit auction node. Then the commerce_auction_node_view is called and this hook detects if auction ended and if product should be added to cart to winner.
I suggest that it could work with cron, so product is placed in cart without needing to visit node page.

I think it can be achieved to move code from commerce_auction_node_view to hook_cron function and make some simple edits.
If you don't mind, I can write a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pinkonomy’s picture

Could you write a also a patch for this?thanks

pinkonomy’s picture

Also,the best would be to automatically,when an auction ends,the product to be placed inside the cart.What about using a rule firing on this?Since I think waiting for cron to run can take a lot of time.
thanks

swim’s picture

FYI,

if anyone still needs this I had to quickly throw the feature together today. Once I get home I'll upload the patch. The patch will also fix these issues;

  • Saving auction node without product causes fatal error
  • Groups line items belonging to the same user so we don't end up with multiple carts

Cheers,

swim’s picture

Status: Active » Needs review
FileSize
30.42 KB

Needs some more love but for anyone else that needs this.

swim’s picture

Ahhg rerolled without the license.txt.

farhadhf’s picture

Hey,

Thanks for the patch - I'm free for the next 2 days, planning to do some cleanup in commerce_auction issue queue :)

lauriii’s picture

Rerolled last patch

lauriii’s picture

+++ b/commerce_auction.module
@@ -198,39 +205,83 @@ function commerce_auction_find_field_name($entity_type, $bundle, $field_type) {
+  ¶

Removed whitespaces

lauriii’s picture

Removed commerce_product_line_item_new call which wasnt needed

MegaChriz’s picture