Hello,

I have created an initial port of this module with the help of the Coder module, plus some follow-up code cleanup pertaining to database queries and Javascript compatibility with D7.

Attached is a tarball of the initial port. Looking for some people to help test this and continue debugging. I have not tested thoroughly, although I have had functionality on the pages I've looked at so far.

There's a weird issue with the highlightFade jQuery plugin highlighting all the donation rows at once on the donate page (path /donate). I will keep working on it, just wanted to get this up initially so others can benefit from it and help make it better.

Can the maintainer create a 7.x branch?

Thanks,
Noah Lively

Comments

noahlively’s picture

StatusFileSize
new16.11 KB

Here is a working version of the uc_donation module for Drupal 7.

I have been tweaking it since my last post 8 days ago, and I have a functional implementation with no crash errors at https://www.familycc.org/online-giving.

I have ported key API changes from ubercart 7.x-3.x, including renaming all the ubercart hooks from hook_X to hook_uc_X.
Other key changes include porting of the JS files to compatiblity with D7's JS api and rewriting the implementation of hook_load().

If we can get this into the git tree, it will be easier to track changes.

justaname’s picture

If I click "Manage Donate Products"

Warning: Missing argument 1 for uc_donate_load(), called in sites/all/modules/uc_donation/uc_donate/uc_donate.admin.inc on line 45 and defined in uc_donate_load() (line 276 of sites/all/modules/uc_donation/uc_donate/uc_donate.module).

If I click "Add Donation"
PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined: SELECT n.nid FROM {node} AS n WHERE n.type = :n.type AND n.nid NOT IN (SELECT d.nid FROM {uc_donate} AS d); Array ( [:n.type] => donation ) in uc_donate_donation() (line 129 of sites/all/modules/uc_donation/uc_donate/uc_donate.admin.inc).

If I click "Add Group"
Notice: Undefined index: donate_id in uc_donate_group_form() (line 195 of sites/all/modules/uc_donation/uc_donate/uc_donate.admin.inc).

vivefree’s picture

Category: bug » feature
Priority: Normal » Major

Has any one got this working? I'm having the exact same problems as 'justaname'.

coolestdude1’s picture

Bump I would also like a D7 port can we get an update?

noahlively’s picture

StatusFileSize
new16.24 KB

Give this a try... I have addressed the 3 issues mentioned in the last bug report.

sksmithson’s picture

Installed tarball re #5 and get following errors when I try to create a donation product on a clean D7 install...

Notice: Undefined property: stdClass::$nid in uc_donation_forms() (line 162 of /home/smithson/abaseentest/sites/all/modules/ubercart/uc_donation/uc_donation.module).
Notice: Undefined property: stdClass::$nid in uc_donation_forms() (line 163 of /home/smithson/abaseentest/sites/all/modules/ubercart/uc_donation/uc_donation.module).
Warning: Missing argument 2 for uc_product_form(), called in /home/smithson/abaseentest/sites/all/modules/ubercart/uc_donation/uc_donation.module on line 173 and defined in uc_product_form() (line 396 of /home/smithson/abaseentest/sites/all/modules/ubercart/uc_product/uc_product.module).

Hoping to get our charity site upgraded from D6 to 7.

noahlively’s picture

StatusFileSize
new16.28 KB

Try this...

ptnguyen’s picture

When I tried to create a product group, I got this

Fatal error: [] operator not supported for strings in /home4/foutomor/public_html/includes/theme.inc on line 1730

and when I tried to add a donation product, I got this

Fatal error: Call to undefined function db_fetch_object() in /home4/foutomor/public_html/sites/all/modules/uc_donation/uc_donate/uc_donate.admin.inc on line 131

jeffreymb’s picture

I fixed an issue with #7.

Line 105 of uc_donation.module should be changed to:
$node = $form['node']['#value'];

alauzon’s picture

Category: feature » bug

I'va had the exact same problem as ptnguyen in post #8. And now that I've tried to add a donate product group and a donate product when I try to go into "Mange Donate Products" I get this:

Warning : array_merge() [function.array-merge]: Argument #1 is not an array dans _form_set_class() (ligne 3968 dans /home/.../public_html/includes/form.inc).
Warning : array_merge() [function.array-merge]: Argument #1 is not an array dans _form_set_class() (ligne 3968 dans /home/.../public_html/includes/form.inc).
Warning : array_merge() [function.array-merge]: Argument #1 is not an array dans _form_set_class() (ligne 3968 dans /home/.../public_html/includes/form.inc).
Warning : array_merge() [function.array-merge]: Argument #1 is not an array dans _form_set_class() (ligne 3968 dans /home/.../public_html/includes/form.inc).

It repeats the same message 4 times.

zealny’s picture

i am getting error as

Warning: Parameter 2 to uc_donation_uc_cart_item() expected to be a reference, value given in module_invoke_all() (line 819 of /var/www/drupal-7.2/includes/module.inc).
Warning: Parameter 2 to uc_donation_uc_cart_item() expected to be a reference, value given in module_invoke_all() (line 819 of /var/www/drupal-7.2/includes/module.inc).
Deprecated function: Function ereg_replace() is deprecated in uc_donation_cart_view_validate() (line 261 of /var/www/drupal-7.2/sites/abc/modules/uc_donation/uc_donation.module).

I am using drupal 7.2

aditya.mukhopadhyay’s picture

StatusFileSize
new15.08 KB

Here's a (hopefully) complete port. Please try...

linkingarts’s picture

Priority: Major » Normal

Drupal 7.7 errs:

Notice: Undefined index: #parameters in uc_donation_form_alter() (line 105 of /home/user/www/sites/all/modules/uc_donation/uc_donation.module).
Notice: Trying to get property of non-object in uc_donation_form_alter() (line 106 of /home/user/www/sites/all/modules/uc_donation/uc_donation.module).
Notice: Undefined index: donate_amount in uc_donation_uc_add_to_cart_data() (line 390 of /home/user/www/sites/all/modules/uc_donation/uc_donation.module).

happens On Add to Cart...

Buckminster_Bond’s picture

Port #12, same as errors as #13 - D7.7

Notice: Undefined index: #parameters in uc_donation_form_alter() (line 105 of /home/wwwqrcoc/public_html/sites/all/modules/uc_donation/uc_donation.module).
Notice: Trying to get property of non-object in uc_donation_form_alter() (line 106 of /home/wwwqrcoc/public_html/sites/all/modules/uc_donation/uc_donation.module).
Notice: Undefined index: donate_amount in uc_donation_uc_add_to_cart_data() (line 390 of /home/wwwqrcoc/public_html/sites/all/modules/uc_donation/uc_donation.module).
brant’s picture

subscribe

vgriffin’s picture

Category: feature » bug
Priority: Major » Normal

subscribe

IKE0088’s picture

Subscribe

Feet’s picture

Subscribe

earlenehughes’s picture

Has anyone been able to get uc_donation and uc_donate working? I have tried the uploaded modules that have been posted here, and cannot get uc_donation to work for me.

dazrour’s picture

Using the version posted in #12 i can add products to the cart from the /donate page.
However when trying to add them from the /catalog page I get the following errors and the page just reloads.

   Warning: Missing argument 3 for uc_catalog_buy_it_now_form(), called in /homepages/9/d384199911/htdocs/sites/all/modules/uc_donation/uc_donation.module on line 237 and defined in uc_catalog_buy_it_now_form() (line 1254 of /homepages/9/d384199911/htdocs/sites/all/modules/ubercart/uc_product/uc_product.module).

    Warning: array_unshift() [function.array-unshift]: The first argument should be an array in uc_donation_buy_it_now_form() (line 250 of /homepages/9/d384199911/htdocs/sites/all/modules/uc_donation/uc_donation.module).

I will look into fixing this myself but it will probably be trial and error as I am fairly new to ubercar/drupal.

Great work in getting the port out.

grayb’s picture

I've been working on this port. I took what was in #12, fixed the bugs reported in this thread since, in addition to a handful I found myself.

Source is public here: https://github.com/IMAmuseum/uc_donation_7x_2x

tscadfx’s picture

Grayb and everyone else thanks for working on porting this.

One issue that I've noticed is that the value of the donation never makes it to the cart or the top of the checkout page. It does however show up the the total in the UC checkout towards the bottom. Not having the value show in the cart or at the top of the page can make check out very confusing.

I'll look into it myself and see if I can't provide a patch if someone doesn't beat me to it.

julia_g’s picture

grayb - when trying to edit the donation product, I get this:
Fatal error: Call to undefined function uc_product_validate() in .../sites/all/modules/uc_donation/uc_donation.module on line 187 . Looks like uc_product_validate in not in D7 any more, but I don't know what should be used instead.

davidsheart02’s picture

Subscribing

ZuluWarrior’s picture

Bump,

I'm going to need a donation based module for a production site in the next 2 months, so would be greatful for any progress on this.

Of course I will grab the latest branch for this and test for you. If I can help fix things (i've hacked through Ubercart module code a ferw times before in D6 times lol) on this port I will, but are the maintainers of this branch still active on this port?

Anonymous’s picture

Thanks for your work on this guys. I can confirm the error mentioned in #23 in Ubercart 3.0, this seems to render the module unusable as we can't add donation products.

Any chance we could get this looked at please?

Anonymous’s picture

Quick update for those looking for a workaround for the issue above. By commenting out line 182 of the uc_donation.module file we can successfully create donation products:

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

For now this means I am circumventing any form validation, but for my purpose (there's only one 'donation' product which I'll be creating) it works just fine.

Anonymous’s picture

Uh oh, I just upgraded to Ubercart 3.1 and it's broken the donation module. There are no errors or anything, the product just gets added to the cart at $0 no matter what you put in the price field.

Has anyone got any insight as to what might have changed here?

Anonymous’s picture

OK so after a couple of hours of painful digging, I've discovered that in recent versions of Ubercart they have removed hook_uc_cart_item() which is being used in our uc_donation.module. It has been replaced with the UcCartItemController controller in /ubercart/uc_cart/uc_cart.controller.inc.

My solution was to override this in my template.php. For me this is a quick fix and obviously some work needs to be done to update the actual Donation module. My code for template.php is as follows:

<?php

// Override to fix a bug with the donate module and make it play nice with recent versions of Ubercart
// This overrides /sites/all/modules/ubercart/uc_cart/uc_cart.controller.inc

class UcCartItemController extends UcOrderProductController {

  public function attachLoad(&$items, $revision_id = FALSE) {
    foreach ($items as &$item) {
      $product = uc_product_load_variant($item->nid, $item->data);
      // Merge in fields from the product.
      foreach ($product as $key => $value) {
        $item->$key = $value;
      }
      $item->module = $item->data['module'];
      
      // The override for donate module
      if ($item->type == 'donation') {
      	if ($item->data['donate_amount'] != NULL) {
			$item->price = $item->data['donate_amount'];
		}
	  }
	  
    }
    parent::attachLoad($items, $revision_id);
  }
}
?>
a.knutson’s picture

Does anyone have any plans to port this to D7 UC3? I'm compiling a list of Ubercart related modules and trying to get an idea of what still needs to get ported over.

Thanks in advance!!

RaRi’s picture

subscribe ..

RaRi’s picture

Any new branch available?

rooby’s picture

@RaRi:
You can subscribe using the "Follow" button at the top without commenting.

iwant2fly’s picture

I am willing to chip in a little bit to make this happen for D7 UC3.

Barry Tielkes’s picture

This module works fine so far:
http://drupal.org/project/uc_varprice

boon4376’s picture

I'd like to confirm that UC_Varprice http://drupal.org/project/uc_varprice has worked for me on a test run with Authorize.net developer account on Drupal 7 with Ubercart 7.x - 3.3, as well as with UC_Recurring using authorize.net CIM.

Looks like a good replacement for the donations module.

Anonymous’s picture

Based on the amount of activity over 2013, this project seems dead. Perhaps it's time to retire this project and devote efforts to https://drupal.org/project/uc_varprice ? That project appears to be slightly better supported and more frequently used.