Nothing happens after "add to cart" is clicked

grendzy - November 20, 2008 - 19:40
Project:Ubercart Donation Products
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Hi, I just installed the new uc_donation port for 6.x. Thanks for your work on this!

When I enter a donation amount, and click "add to cart", nothing happens. It just refreshed the donation product node.

Poking at the code a bit, it seems that uc_donation_add_to_cart_form_validate() and uc_donation_add_to_cart_form_submit() are never called.

#1

Sid_M - November 21, 2008 - 21:15

I did some work with this, and I believe it is now working on Drupal 6.

The main changes I made involved updating function signatures which have changed from Drupal 5.

This also resulted in needing to change the way some variables are accessed in arrays.

The biggest change I made is that I am now setting #validate and #submit as part of constructing the add to cart form. This ensures that the correct functions are called for validation and submission of the form. I am not sure, but I suspect that this may mean there is no longer any need to append the nid to the form name. However, I have left that functionality in place since I am unsure whether it is unnecessary.

Finally, I removed a string replacement from the add to cart submit handler because it was redundant with the same replacement being done in the validate handler. Since $form_state is now passed by reference, the change made in the validate handler persists, and thus does not need to be done again in the submit handler.

Hope the attached patch helps.

AttachmentSize
work_in_d6.patch 2.76 KB

#2

grendzy - November 21, 2008 - 21:27

Thanks! I came up with something similar. I also had to comment out a section in uc_donation_cart_view_submit(). The cart update form displays in the wrong place -- I believe because hook_table_alter no longer exists.

AttachmentSize
uc_donation_337040.patch 4.12 KB

#3

greenSkin - November 21, 2008 - 21:37

Thank you for both your work, though I have halted making updates to the module for Drupal 6 until the issue grendzy mentioned about the cart update form displays in the wrong place because hook_table_alter is deprecated. The same issue prevents the field from showing in the catalog as well. There is a method to display these correctly but it is a work around to an existing problem with the current Drupal 6 version of Ubercart. For more information on the issue check http://drupal.org/node/335673. Once this issue is fixed, I will again work on updating the module.

#4

acb - December 16, 2008 - 17:08
Title:Nothing happens after "add to cart" is clicked» TAPIr Fixed?

I just heard from Ryan over at the Ubercart forums that he was "95% sure" that Tapir had been finalized. Any hope of resuscitating this project? It's an AWESOME module; just want to have it good for D6....

#5

acb - December 18, 2008 - 09:16
Title:TAPIr Fixed?» Some headway

Try this....

It seems to work so far...

try adding this:

      $form['nid'] = array(
        '#type' => 'hidden',
        '#id' => 'edit-nid',
        '#value' =>  $node->nid
      );     

just above

      $form['#validate'][] = 'uc_donation_add_to_cart_form_validate';

on or about line 110 of uc_donation/uc_donation.module.

It now adds items to cart... though I can't edit the cart or delete them from it... oddly.

#6

grendzy - December 18, 2008 - 16:57
Title:Some headway» Nothing happens after "add to cart" is clicked

I haven't had a chance to test the Dec. 3 release, but it from the commit messages it looks like this might be fixed:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/uc_donation...

#7

acb - December 18, 2008 - 23:30

Thanks for the reply, Grendzy.

Unfortunately, it isn't fixed.... with the version above, items will not add to cart unless one adds the code-fix I mentioned

            $form['nid'] = array(
        '#type' => 'hidden',
        '#id' => 'edit-nid',
        '#value' =>  $node->nid
      );   

and the cart won't delete or edit products...

I am a bit at wit's end here. I think this could have to do with the D6.8 Upgrade?

6.6 users might not to have the same issues.

I just can't track this one down..

#8

greenSkin - January 13, 2009 - 20:04
Status:active» needs review

A patch has been submitted in #8 at #341819: Allow contrib modules to utilize uc_product_add_to_cart_form that allows donation products to be successfully added to the cart in Drupal 6 and Ubercart 2.

The Ubercart developers haven't been replying to that issue as of late so any help there in getting their attention to commit the patch would benefit uc_donation greatly and any other module which creates their own product type.

#9

greenSkin - March 12, 2009 - 22:53
Status:needs review» fixed

This now works as of todays dev release without needing to patch anything.

@acb your solution would have only suppressed the error but did not fix the issue. The problem was that a function could not be found for the unique form_id of the donation product due to #341819: Allow contrib modules to utilize uc_product_add_to_cart_form. A work around has been used to squash this issue.

#10

System Message - March 26, 2009 - 23:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#11

vacilando - May 4, 2009 - 16:38
Priority:normal» critical
Status:closed» active

Same problem as above: nothing happens after "add to cart" is clicked.

Tried beta2 first, then the dev release, which #9 mentions should work.. but it does not.

Any ideas, please? We cannot use this module at all if adding donations does not work.

Thanks for any feedback --

#12

greenSkin - May 4, 2009 - 20:10
Status:active» postponed (maintainer needs more info)

Do you get any errors? Do you have regular products and do they add to cart like they should? Which 'add to cart' doesn't work if not both, the one on the node view page or in the catalog?

#13

vacilando - May 5, 2009 - 07:43
Status:postponed (maintainer needs more info)» active

Hi, thanks for coming back on this.

We have a donation as a product set up in UC. After selecting it in the dropdown at /admin/store/settings/donate/manage/donation and clicking 'Add' the page changes to /admin/store/settings/donate/manage which says 'No donate items have been added.'

I've just tried it again, watching whether there were any errors generated in the server log but there weren't any.

If you need more info, don't hesitate to ask, I am happy to help with testing etc, of course.

#14

greenSkin - June 8, 2009 - 15:14
Status:active» postponed (maintainer needs more info)

I will be releasing a beta3 today, if you could try that. I can't seem to replicate the problem you are having. You might try resetting the drupal cache.

 
 

Drupal is a registered trademark of Dries Buytaert.