With Ubercart and Simplenews installed, using Google Checkout results in an error in system log messages, "Attempt to unsubscribe from non existing mailing list ID 0"

Tracked it down to uc_google_checkout.module doing this:

simplenews_unsubscribe_user($order->primary_email,variable_get('uc_google_checkout_simplenews_tid', 0), FALSE);

The problem is nothing is setup to put the variable uc_google_checkout_simplenews_tid in the database or to change it.

I worked around the problem by inserting the correct row into the variables table, setting uc_google_checkout_simplenews_tid to 1. Checkout will now subscribe/unsubscribe from the newsgroup based on "Allow marketing emails" check box when paying at the Google page.

CommentFileSizeAuthor
#1 1926372.patch3.01 KBTR
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TR’s picture

Status: Active » Needs review
FileSize
3.01 KB

IMO code like

if (module_exists('simplenews')) {
 // etc.
}

has absolutely no business being in the uc_google_checkout payment module. All that code about mass marketing preferences doesn't have anything specifically to do with Google Checkout, so it should live in it's own marketing module - that module would then be able to provide this functionality to every payment method, not just uc_google_checkout, and would be able to integrate with modules other than simplenews.

So attached is my "fix". Sorry it doesn't help you directly, but this is clearly just legacy code that was inserted specifically for the needs of just one client before Ubercart was subject to community reviews of proposed code.

jriedel’s picture

I guess I don't have too much heartburn if it is ripped out. I've used simplenews on a site and Ubercart on a differebpnt site, today was the first time they ended up together.

I don't think you should remove the information on the order that the person does or doesn't want marketing emails. At least someone can add them to a list by hand as needed.

longwave’s picture

I think the marketing preferences pane can be removed as well; if the site is sending marketing emails in some way it is likely there are other opt in/out mechanisms than just Google Checkout, so I suspect this data is pretty much useless. Anyone who does need it can still retrieve it from existing orders via $order->data['email_allowed'].

longwave’s picture

Status: Needs review » Fixed

Committed #1.

Status: Fixed » Closed (fixed)

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