mailchimp pane is not displayed on my checkout page.
And after I click on "continue" button of the ckeckout page I got this error on the shipping page:

Notice: Undefined index: commerce_mailchimp in commerce_mailchimp_pane_checkout_form_validate() (line 89 of /home/drupalpro/websites/cart.com/sites/all/modules/commerce_mailchimp/includes/commerce_mailchimp.checkout_pane.inc).
    Warning: Invalid argument supplied for foreach() in commerce_mailchimp_pane_checkout_form_validate() (line 89 of /home/drupalpro/websites/cart.com/sites/all/modules/commerce_mailchimp/includes/commerce_mailchimp.checkout_pane.inc).

I think I properly configured the pane. See the attachment.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lsolesen’s picture

Experiencing the same thing. Did you solve your issue?

heyyo’s picture

In fact this bug occurs only if I'm connected with my admin account and If my admin account has already subscribed to the list.

lsolesen’s picture

@heyyo - ah, ok. I will check that out. Seems a little odd though.

tr33m4n’s picture

Also experiencing this problem... Any updates?

lsolesen’s picture

Category: bug » feature

For the pane to show, lists should be added in the mailchimp configuration. When administering the mailchimp pane in the checkout flow, there should be custom settings for the pane available. If there is not, no lists has been created.

It would be great if the module would report this :)

Petr Illek’s picture

I've all the setup ok and function for first time. So new customers can subscribe to the newsletter without any warning. But this error occurs for already subscribed users.

rszrama’s picture

Title: mailchimp pane not displayed » MailChimp pane throws notices during checkout form submission if no lists are defined
Category: feature » bug

I got bit by this, too, and the module should definitely be fixed to accommodate scenarios when the checkout pane is not shown (i.e. no lists are available).

I also agree that the checkout pane settings form could be more helpful, too. I didn't know what I had to do until I realized that even though the MailChimp module detected my list in my MC account, I still had to define it and link it locally. Thus I was confused as to why the checkout pane wasn't showing up in my first attempts at checkout. Maybe where the settings would be it should have a message along the lines of,

"This checkout pane will not be displayed until you have configured a MailChimp list."

And link that "configured a MailChimp list" to the lists page.

DYdave’s picture

Hi Ryan,

Thanks a lot for sharing your feedback on the module and reporting back on these issues.

Your comment was particularly helpful in terms of setting a proper direction to solve these issues.

I took a closer look at the problem and it would seem indeed a little bit more efforts could round up a bit further the edges of this useful module.

If I may, I would like to bounce back on your ideas and propose a patch against commerce_mailchimp-7.x-1.x at e0a57df, as an attempt to improve Commerce MailChimp's Checkout Pane configuration form UI (let users know a bit more about what they should do) and fix the notices during checkout form submission.
File attached as: commerce_mailchimp-throws-notices-checkout-form-submission-no-lists-defined-1967836-8.patch.

Quick comments about the modifications on the Checkout Pane configuration form:
I first started by testing with $form['#prefix'], but the message would display between global and Pane specific fieldsets settings, which I found not obvious/clear enough.
Then, I tried with $form['commerce_mailchimp_no_list']['#markup] = t('TEXT MESSAGE');, which was a bit better, since the markup/message displayed in the Pane specific settings, which would make sense, but I personally still found it a bit too obscure (you'd still need to read and dig a bit down the page, definitely something that a "speedy" user would miss).
So I thought to really make it very obvious we might as well go for a drupal_set_message of the Warning type, just to be very clear to users.
The patch does both: Add a message in the Pane specific settings and a Warning message at the top of the page.

Otherwise, for the notices, it would seem that skipping the validation if $form_state['values']['commerce_mailchimp'] is empty would resolve the problem and prevent from raising these errors (at least according to the tests I've made).
 

I would greatly appreciate to have your testing/reporting, reviews, feedbacks, comments, objections, questions, issues or concerns on the attached patch.
Please let me know if you would have any other ideas for the modification of the Checkout Pane form settings UI or the wording of the messages, I would be glad to re-roll and come up with an updated version that would take into account any of your suggestions/ideas.

Feel free to let me know if you would have any questions, comments or suggestions about the code, patch, suggested approach or any other aspects discussed in this ticket, I would be very happy to explain in more details.

Thanks in advance to everyone for your testing, reporting, reviews, comments and feedbacks.
Cheers!

silkogelman’s picture

Status: Needs review » Active

I agree with everything in #7. This definitely should be fixed and could be more user friendly.
A workaround for the checkout error until this is fixed might be to set the 'Subscription Options' pane to disabled.

Update: while I was typing this comment, DYdave made a patch and posted #8! (woot). I'm testing it as we speak.

silkogelman’s picture

Status: Active » Reviewed & tested by the community
FileSize
95.31 KB

This seems to be working very well.
No more error during checkout, and the pane's configuration screen shows helpful info:
Mailchimp Commerce settings pane notices

I can't judge the code as I am not a coder, but from what I can judge from the UI I'd say this issue's mission is accomplished.

Thanks guys, and thanks for the patch DYdave! This DEFINITELY makes this module more user friendly.
Awesome work.

DYdave’s picture

Thanks a lot Sil for your prompt feedback on *all* the tickets updated recently.
Great Testing/Reporting work! (Screenshots are a great idea!!)

All these changes were rather small from a developer's perspective and with everyone's comments/suggestions/ideas I managed creating the patches much quicker than testing them :-).
However, no matter how small these changes may be, I sincerely hope they help further refine, round up the edges to hopefully become more user friendly, gain more trust and make a bigger difference to non tech savvy people.
Unfortunately, many people would give up rather quickly "just" because of a WSOD, Fatal error, or say "I can't make it work", when it would all come down to a few characters of code (developers' perspective).

With a little bit more users, community work and coming down the list of issues, I'm sure we would all be looking forward to seeing a stable version of the module released.

Feel free to let me know at anytime if you would have any more questions from a coding perspective, UI/wording or the overall approach, I would certainly be glad to provide more information or come up with a re-roll of the patch.

Thanks again to everyone for the great feedback, reviews, ideas and testing/reporting!
Cheers!

donquixote’s picture

Issue summary: View changes

Seems to work (after very short testing).

Not a big deal, but

function commerce_mailchimp_pane_checkout_form_validate($form, &$form_state, $checkout_pane, $order) {
  if (!empty($form_state['values']['commerce_mailchimp'])) {
    $lists = mailchimp_lists_load_multiple_by_name();
    ..

I would usually prefer

function commerce_mailchimp_pane_checkout_form_validate($form, &$form_state, $checkout_pane, $order) {
  if (empty($form_state['values']['commerce_mailchimp'])) {
    return TRUE;
  }
  $lists = mailchimp_lists_load_multiple_by_name();
  ..

Less indentation, easier to read imo.

fox mulder’s picture

Hi!

I experienced same problem. I was created a new user through admin/people/create than I was masqueraded to this user and did shopping.

On checkout/ORDER_ID page the subscription checkbox did not appear (it's OK I am subscribed now), but when I was clicked Next, than I become the "Undefined index: commerce_mailchimp in commerce_mailchimp_pane_checkout_form_validate(..." notice.

The solution #12 works great

Drupal Bros’s picture

Agreed, this is a good solution. The module is better with this patch than without it.

pachabhaiya’s picture

I had experienced the same issue. patch #8 works perfect for me.

Anybody’s picture

+1 for a new version! :)

torgosPizza’s picture

Patch works, please consider rolling it into -dev! (Though I might also make sure that $lists = mailchimp_get_lists(); is not an empty array as well...)

Jim.M’s picture

Status: Reviewed & tested by the community » Fixed

Looks like this one was fixed as part of code changes related to the new mailchimp library version.

DYdave+

Status: Fixed » Closed (fixed)

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