Problem/Motivation

If any template is selected, the "Content Sections" area of editing a campaign at /admin/config/services/mailchimp/campaigns/XXXXX/edit is completely empty with all fields removed.

Screenshot

Steps to reproduce

1. install Mailchimp module and add your API key

2. Mailchimp account is a free plan

3. Create a campaign and select any template under "Template" dropdown at /admin/config/services/mailchimp/campaigns/XXXXXXX/edit

----------

I've also tried creating a custom template in Mailchimp and have added custom code blocks to the template containing

<div mc:edit="section1" class="mcnTextContent">Use your own custom HTML</div>

This custom template also does not allow Content Sections data to be added.

Coding my own Mailchimp template is not available as my client has only a free Mailchimp plan.

Comments

endless_wander created an issue. See original summary.

endless_wander’s picture

Issue summary: View changes
endless_wander’s picture

Issue summary: View changes
endless_wander’s picture

Debugging mailchimp_campaign\Form\MailchimpCampaignForm::form at line 251 where the content sections should be found and listed. As expected $mc_template->info->sections is empty

foreach ($mc_template->info->sections as $section => $content) {

where $mc_template was generated from $mc_template = mailchimp_campaign_get_template($form_state->getValue('template_id'));

mailchimp_campaign_get_template is in mailchimp_campaign.module and relevant code is:

          $template->info = $mc_templates->getTemplateContent($template_id);
          $tags = ['cache_mailchimp'];
          \Drupal::cache()->set('template_' . $template_id, $template->info, CacheBackendInterface::CACHE_PERMANENT, $tags);
endless_wander’s picture

Tried this with a different client that has a paid Mailchimp account and a "code-your-own" template. The sections look like this

<div mc:edit="preheader_leftcol_content"><p>Some content here.</p></div>

And these sections do populate the Content Sections area of the Drupal form.

So, it looks like this module will only work with paid Mailchimp accounts. I feel like that should be noted or highlighted on the campaign form.

endless_wander’s picture

Suggested fix for the form description

Change from:

"Select a Mailchimp user template to use. Due to a limitation in the API, only templates that do not contain repeating sections are available. If empty, the default template will be applied."

To:

"Select a Mailchimp user template to use. Due to a limitation in the API, only templates that do not contain repeating sections are available. If empty, the default template will be applied. Only templates built using Mailchimp's "Code Your Own" feature will be able to have content added here."

Michelle’s picture

Well, that is a bummer. I was really hoping to use this to created newsletters from Drupal content but our club can't afford to be paying $15/month just to be able to create one template. Thanks for hunting down the cause of it so I can stop banging my head against trying to make it work.