Donation Product

Issue tracker: view

Contrib type: 
Module
Status: 
Initial upload
Compatibility: 
Ubercart Beta 4

This module allows the creation of donation products and creates a shipping type of 'donation'.

To install:

  • Unpack in /sites/all/modules/ubercart/contrib folder so that the location is /sites/all/modules/ubercart/contrib/uc_donation
  • Enable module
  • Edit catalog vocabulary to include 'Donation' type

To include an image with donation products, do the following:

  • Make sure CCK and CCK Image Field modules are installed, and Imagecache.
  • Edit donation content type.
  • Add field Image

Couple things

I would like to include the work in the pre-existing donation module that created a pane during checkout for donations, but the module of it I downloaded did not work with Ubercart Alpha 7e. If anyone can help with this, that would be great.

Also, I have a issue in my supplied code. When the order only consists of donation products, on the 'review order' page under the payment method subtotal, the Donation shipping method is not labeled. I have tried to fix this issue but I am at a loss. If someone has a better understanding of shipping methods in Ubercart could take a look for me and tell me how to fix it or supply a patch, I would be thrilled.

To Do

Here is my list of features that I would like to implement in this module. Others are more than welcome to contribute.

  • Check compatibility with Ubercart Alpha8
  • Add SKU textfield to donation content type.
  • A pane for adding a donation to an order as an option over donation products.
  • Unique email message to customer if order only consisted of donations.
  • Unique email message to customer if order included donations.
  • Donation reports.

I'm not sure if any of these requires changes to pre-existing code, I hope not. Any insight and thoughts are more than welcome as are contributions to this module.

Re: Couple things

In uc_donation_quote(), you have the array key as "storepickup", which should probably be "donation", like the accessorial in the shipping method.

For the most part, this module looks pretty good. There's only a couple things I notice that should be cleaned up. uc_donation_forms() shouldn't worry about the 'uc_catalog_buy_it_now_form'. The product module does this already. This reminds me to change that in uc_product_kit_forms() as well. There are also a few unnecessary lines in uc_donation_table_alter().

Good job.

Re: Re: Couple things

Thanks for you input. The 'storepickup' was in-fact the case of the issue I was having, thanks for catching that. I removed the 'uc_catalog_buyt_it_now_form' from uc_donation_forms() and removed a line of useless code from uc_donation_table_alter(). I included the 'uc_catalog_buy_it_now_form' in uc_donation_forms() as your uc_product_kit_forms() also used it and uc_product_kit module was what I was using as an example for my uc_donation module. So I'm glad that my code helped you in some way to better your module.

Core?

I've posted the same question only for a different module (uc_summary) as what I'm about to ask. Any thoughts on this or any variation thereof being added to core? I realize that this is less likely for a donation module to be in core since it might not appeal to the masses. I know every developer ultimately would like their creation added to a package as more than just a contrib item, but not everything is worthy. None the less, I thought I might take a stab, I do not fear rejection. Laughing out loud

I did make same changes to the code that I have not made available on here yet but will when I get the chance like since Alpha8 allows for non-shippable items, my method of using a donation type shipping method as a work-around for a shipping quote is no longer needed so has been removed.

Re: Core?

While I haven't had the chance to really test this one, I think we will probably not put it in core b/c like you said it won't be widely used. I'll consider the summary e-mails down the road. I'd be happy to have a page on the site listing recommended modules for various tasks, or you can submit an FAQ node here on the site for something like "How can I enable donations on my site?" that includes this contrib in the answer.

Re: Donation Product

Does this work on Beta2?
well I guess I will find out Smiling

Re: Re: Donation Product

well I am testing on the drubercat all in one and it did not add a Donation type to the shipping. and I get this error..
I need this for a foundation for Billy Poole who died last week he was a relative and extreme skier.. you can search youtube for his name to see videos of him

any help would be a great help

Eric

AttachmentSize
error01.png11.94 KB

Re: Re: Re: Donation Product

I have removed the Donation type since Ubercart now supports non-shippable options, though the module supplied above is not the most current so it might not contain my changes. I will upload the newest version come Monday, which does work with Beta2.

Re: Re: Re: Re: Donation Product

thank you Smiling

Parse Error...

Parse error: syntax error, unexpected '=', expecting ')' in /site/modules/uc_donation/uc_donation.module on line 307

I am getting this error whenever I put the uc_donation.module in the modules directory. And I have no clue why? Does anybody know?

Re: Parse Error...

I've added my latest version of the Donation Product module to the top. This contains some added modules that I wrote to satisfy a specific need, you might find them helpful and might not.

Re: Donation Product

Incredible work, greenSkin. I was very impressed by the clean code and features you offer in here. Just implemented it on http://supportministry.com. Smiling

I did turn up one minor bug report, and if you're able to, I'd highly recommend posting this up as a project on drupal.org. Smiling

Working?

Ryan;

How did you get this to work? I am using Drupal 5.7 and Ubercart 5.x-1.0-rc4 - but I can't seem to get the installation to take. All necessary support modules are enabled. When I try to install, i get a blank screen.

I noticed when I look at the uc_donation.install file, the function uc_donation_install, is empty.....perhaps that is the issue?

Re: Working?

If you're getting a blank screen, you might check this:

http://www.ubercart.org/faq/3072

As far as I know, there's no installation issue with that contrib. I've used it twice now w/o a problem.

-Ryan

can't delete this comment

I'll leave this as a placeholder for the moment ... sorry

I'm getting a parse error

I've tried the module uc_donation-dev4.zip and also the download from drupal.org and am getting the same error as designbysoil in post #11.

Parse error: syntax error, unexpected '=', expecting ')' in /site/modules/uc_donation/uc_donation.module on line 307

The line number referenced differs with each module but the error text is the same. I'm using drupal 5.7 and ubercart drupal module 5.x-1.0-rc5.

I tried the one from drupal.org first and because of the error I was unable to get to the modules page to disable it. The only way I could get back to my site admin stuff was to delete the module through my FTP app. I'm not sure how clean of an uninstall that was so maybe there is something remaining in the db that is causing problems??

Thanks for the help. This looks like a really nice and extremely helpful module. Basically what I'm going for is the exact same setup as found at http://supportministry.com/donate.

Thanks,

Tim

Re: I'm getting a parse error

I believe this is due to your PHP version. You shouldn't have any side effects by just removing the & before $args on that line.

Re: I'm getting a parse error

Yes, this is a php4 issue. If you can use php5, that would be best otherwise remove the = sign and the value after it on line 307 of uc_donation.module.

Re: Re: I'm getting a parse error

@greenSkin: unless I'm mistaken, it didn't seem like you were changing any values in the $args array in that function, so it's not necessary for you to have the by-reference operator (&) before the variable. If that's all it takes to make it PHP 4/5 compatible, I'd recommend it.

Re: Re: Re: I'm getting a parse error

Good point, I'll make the change. I was also thinking that since the $args array is passed by reference then the default value of it should also be passed and should not need to be specified in the hook function. Correct me if I'm wrong.

Re: Re: Re: Re: I'm getting a parse error

That's correct... I think I just dropped the ball when implementing that, b/c at present I'm not sure that I'm always passing in a value for $args. I just wonder if not having a default value will result in trouble. Puzzled

I'm pulling my hair out here

Ryan and GreenSkin,

I removed the '&' before '$args' and that cleared up the error I posted about earlier. However now I'm getting other errors. First I wanted to ask you guys about the correct version I need to be working with. The version from http://drupal.org/project/uc_donation has the following file structure:

uc_donation/
|          |_uc_donate/
|                     |jquery.highlightFade.js
|                     |uc_donate.css
|                     |uc_donate.info
|                     |uc_donate.install
|                     |uc_donate.js
|                     |uc_donate.module
|                     |uc_donate_pane.js
|_LICENSE.txt
|_uc_donation.info
|_uc_donation.install
|_uc_donation.module

The version downloaded from http://www.ubercart.org/contrib/1678 has the following file structure:

uc_donation/
|          |
|          |_uc_donate/
|          |           |_.svn/
|          |           |      |_5 directories and files here
|          |           |_jquery.highlightFade.js
|          |           |_uc_donate.info
|          |           |_uc_donate.install
|          |           |_uc_donate.js
|          |           |_uc_donate.module
|          |           |_uc_donate_pane.js
|          |_uc_donation_summary/
|          |                     |_.svn/
|          |                     |     |_5 directories and files here 
|          |                     |_uc_donation_summary.info
|          |                     |_uc_donation_summary.install
|          |                     |_uc_donation_summary.module
|          |_.svn/
|          |      |_5 directories and files here
|_uc_donation.info
|_uc_donation.install
|_uc_donation.module
|_.DS_Store

Which version of donation products should I be using? Right now I have the one from http://www.ubercart.org/contrib/1678 installed. I didn't get any errors on install but when I go to the 'Make a Gift' page and enter an amount then click 'Add to Cart' I get the following:

* warning: Invalid argument supplied for foreach() in /home/fumctest/public_html/modules/node/node.module on line 521.
* warning: implode() [function.implode]: Bad arguments. in /home/fumctest/public_html/modules/node/node.module on line 525.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /home/fumctest/public_html/includes/database.mysql.inc on line 172.

I'm using PHP 4 and hopefully that will not be a problem. I've got many modules installed and working and really don't want to change PHP versions now and have to deal with the inevitable issues bound to occur with other modules when I do that.

Thank you very much and sorry for the looooong winded post.

Re: I'm pulling my hair out here

The version on drupal.org is my most current code, so use that one. I'll disable the file attachment here so that it doesn't cause any more confusion.

If I recall correctly, this error is caused by a change Ubercart went through late Alpha or early Beta on how content types are also considered a product. This should be fixed in the code supplied at drupal.org. I remember tracing the error and I'm pretty sure that was the issue.

Re: Re: I'm pulling my hair out here

That did it! I installed the version from drupal.org and all errors disappeared, thanks.

Re: Donation Product

I'm trying to understand how this donation type works. I need to create a page with a few custom fields such as the name of the person donating, what ministry or charity the donation goes to, etc. Some of these fields will be select boxes, textfields, checkboxes, or whatever. I'm sort of guessing my way through here because I'm new to ubercart in general but this is what I did. I created a couple of attributes and gave them options. Example, I created an attribute called 'Ministry Area' and gave the options "Adult Ministry" and "Children's Ministry". Then I created a donation node titled "Donate to Our Church" and assigned the "Ministry Area" attribute to that page.

Now when I go to this new page the select box is there for Ministry Area but there are two things I need to do. First I need to remove the display price since I'm not selling anything, and second I want to change the order of the fields on the page. I can't figure out how to change the Amount textbox position or weight on the page.

Thanks

Error at Checkout

I am getting an error at checkout:

warning: Invalid argument supplied for foreach() in /home/website/public_html/modules/ubercart/contrib/uc_donation/uc_donate/uc_donate.module on line 744.

I am using PHP 4 also, and the most recent code from drupal.org.

It comes up at the "review order" page - and no donation product was being ordered. Aside from the error, it seems that I can't go any further than "Review order."

Suggestions?

Re: Error at Checkout

Please submit an issue at http://drupal.org/node/add/project-issue/uc_donation. Thanks.

Ok

Done - anyone who has any suggestions, please see the issue at:

http://drupal.org/node/275847

Thanks!