Thanx Frank18
I got em all taken care of.
Sidebox works just fine
Printable View
Thanx Frank18
I got em all taken care of.
Sidebox works just fine
Thanks so much for taking care of her! I knew nothing at the time of my initial post that there was a way to update the PHP within the cPanel. The site is now running like a top - instead of churning away, the MailChimp sidebox works great and I can now go buy some Clairol and "wash that gray right out of my hair" and move on! :D
I truly did not mean any offense to you or anyone else on this matter. I am NOT that person.... and I apologize effusively for anything that I said (including the part about the gray hair) that might have offended you.
Thanks again for taking care of her!
All good have a good rest of the week
I'm having a problem. Installed version 4 on a Zen Cart 1.5.5a. PHP 5.6.
When creating an account and checking the subscribe box, I get a 500 server error. Log shows:
[03-Nov-2016 21:08:23 America/Chicago] PHP Fatal error: Uncaught exception 'MailChimpException' with message 'Parameters not set on MailChimp::list_add_subscriber' in /home/chocolateshoppe/public_html/zencart/includes/functions/extra_functions/mailchimp.php:87
The site template has a MailChimp subscribe option for the footer. It works but does not use an API, to the post, U and ID values work and the MailChimp account work (it was created today, so thinking it might take some time before it's fully active).
The sidebox subscribe works.
Thanks for this report, Jim. I will check.
Fixed - please update.
4.0a is the update. I fixed it in place.
Is anything needed for the update besides just copying the files over?
Please follow the instructions in the mod installation package.
I wasn't specific enough, I guess. I've already made all the changes that the Mailchimp integration package calls for. What I'm asking is whether there are other changes needed by the mod.
I'm getting an error on one site (not on my server where there's no problem)
PHP Parse error: syntax error, unexpected '[' in /home/xxxxxx/public_html/includes/functions/extra_functions/mailchimp.php on line 20
In dreamweaver, it also claims that line is a problem. The server where it's a fatal error is running 5.5.30 whereas my server is running 5.5.29.
Any ideas?
Will that work on lower php levels as well?
Yes. What I wrote above will work with PHP 5
It then objects to the brackets in line 26
private function _execute_request($method, $endpoint, Array $payload = [])
Sigh. ya. Having the keyword "Array" in the function declaration isn't allowed in older PHP versions.
Change "Array $payload" to just "$payload".
Probably more issues after that too. /me punts to swguy ...
Thank you, Dr. Byte!
The site this is on isn't actually using mailchimp so not to worry for the moment.
and yup it continues with the brackets on that same line. Will go directly to the source!
Hmmm ... further testing reveals that it should be compatible with 5.4.0 and newer.
The fact that you're getting the errors you mention suggests maybe your pHP version isn't what you think it is?
That's what cPanel says it is but the hosting is a bit screwy. Perhaps I just need to not worry about it since he isn't using it! Thanks for looking at it for me.
So this happened again - this time on a site with 5.2.17 so I think you are correct that the php version was not what it said it was. Once again, Dr Byte rules!
You can easily verify the exact PHP version by creating a small script called test.php
<?php
phpinfo();
Transferring it to your site, then running http://yoursite.com/test.php
I have the Mailchimp module (someone installed it for me i guess because i don't remember installing it myself). I do have a sidebox for visitors to subscribe, but during the checkout process, the customer used to have a checkbox to say if they wanted to be subscribed to the newsletter (it used to be checked by default until CAN-SPAM came into effect several years ago) however, i don't know where it is, yet, some customers still show "Subscribed" in the Newsletter option. My questions are:
- where is that checkbox? or basicaly where are customers choosing that Newsletter option?
- the customers who show "Subscribed: in the Newsletter option are NOT added my MailChimp list; is that expected? or not?
- if it is not supposed to happen like that, where should i look to fix that?
Thanks
It is the checkbox on the Create Account page.
A few possibilities. 1) they signed up before the plugin was installed 2) Something isn't working right 3) They didn't click the link in the email from MailChimp to confirm their email.
I'd suggest re-installing the plugin to be sure everything is done correctly.
Oh duh!! Didn't think of that!
1) the module was installed years ago, but last weeks customers are not added! so this is not the explanation
2) that is what i worry
3) hum... didn't think that would be a possibility but it would not explain why EVERYONE is missing on the MC list!
Thanks. I guess that might be my solution.
As i am trying to fix this issue, I noticed that the various files were installed inside a template folder like this:
includes/languages/english/extra_definitions/cc
instead of the
includes/languages/english/extra_definitions
only. I am now wondering if that is the proper installation (as there is no indication in the readme file) and maybe that would explain why it was not working properly. At the same time, i want to install it correctly if it was not in the first place.
Thanks.
Not sure what you mean by various files. There is one file in extra_definitions called
./languages/english/extra_definitions/mailchimp_sidebox_defines.php
You could customize this and put it in
./languages/english/extra_definitions/YOUR_TEMPLATE/mailchimp_sidebox_defines.php
Yes, I guess that was my question. Since the readme file didn't refer to placing those files in the TEMPLATE folder, I was not sure if they should be there or not. You say I "can customize it", but my question is "should I or shouldn't I?"
You are free to do it. It's fine.
Remember that any folder with a "classic" subfolder is template aware, and any file that goes there can go into a template subfolder if you wish.
OK. I might be doing something wrong because it is not working. I tested with someone creating an account, having the box checked for the Newsletter, BUT there was no confirmation email from MailChimp. The only email received was from Zencart, explaining what they can expect in the store.
I reviewed all the instructions in the readme file, edited all the files, adjusted all the settings in the backend. In fact, I just had to check everything because everything was already correct. Any suggestion where else to look for a fault?
I describe this as a "moderate to difficult" mod to install on the help page. You're welcome to review the help and review the list of common problems at https://www.thatsoftwareguy.com/zenc...ation_problems but you might need someone to do this for you.
I know that if a user subscribes with the side box, they will get a confirmation email from MC. That is now working fine for me.
When a user creates an account and checks the checkbox for the newsletter, are they supposed to ALSO get a confirmation email from MC or does the information automatically populate to MC to add the user to the list?
Yes, that's normal, because they're choosing to sign up to the newsletter list directly.
No, you're adding them to MC via an API call, which assumes you've already verified permission to subscribe ... that's between you and the customer.
Similarly, if you log in to MC and add a subscriber manually, they won't receive an email ... the fine-print on the screen reminds you that it's up to you to verify that you have permission to add them. Same concept.
OK in light of these last couple of posts, what is the expected behavior for this plugin? What is supposed to happen once the account is created inside the zencart store with the checkbox checked for newsletter?
- is the person going to get a confirmation email from MC? In addition to a welcome email from zencart?
- since the checkbox is unchecked by default, shouldn't that be considered express permission and would not need a double-optin sequence from MC?
I believe this module was coded to err on the side of caution, as some people make changes to the create account page to pre-select the check box for the newsletter, and if this module was coded to pass a different status that would not require the opt-in, then customers that didn't notice would be signed up for a newsletter they might not want, and the store owner upon recieving compliants might come back here to whine about it.
OK i understand. However, considering that some store owners are honest :) is there a way to disable to double-optin IF the checkbox is unchecked by default ?
Based on my quick look at the code
includes/functions/extra_functions/mailchimp_functions.php Line 8
Code:
change toCode:'status' => 'pending'
Code:
Code:'status' => 'subscribed'
From Mailchimp API docs
Quote:
Subscriber Status
To add a subscriber, you must include the subscriber’s status in your JSON object.
Use subscribed to add an address right away.
Use pending to send a confirmation email.
Use unsubscribed or cleaned to archive unused addresses.
The unsubscribed option is useful if you import addresses from another service. When you add subscribers to the unsubscribed or cleaned status groups, you’ll have a record of the subscriber, and we’ll prevent sends to that address in the future. That’s ideal for inactive or unsubscribed addresses, which can increase spam complaints if they’re accidentally added as subscribed.
Yes to the first question, No to the second.
Bear in mind that if you do what you're suggesting, and some mischievous guy signs up someone he doesn't like with an account at your store, all of a sudden you are sending spam to the guy he doesn't like. A few complaints, and poof! you lose your Mailchimp account.
Double opt in protects *you*.
^^^^ well there is that...
My "how to" is not a recommendation that you do it, I wouldn't do it myself. It is simply "if you're gonna do it, here is how".
oh my.... this is a bit paranoid.... and that's coming from a paranoid person....
while i am sure mailchimp has suspended accounts, they are in the business of sending emails (and that's how they make money). if a honest store owner operates a mailchimp account, i'm sure they can prevent their account from getting suspended.
spam rules have done little to prevent my inbox from overflowing with spam. people that send true spam rarely use mailchimp.
as long as you have the unsubscribe link (which is part of all mailchimp emails), i really would not worry about bypassing the double opt-in for customers that sign up on your website.
operate your store like a honest store owner, and personally i would not give this a second thought.
just my 2 cents... which may be a violation of CANN-SPAM laws.... but still my opinion.
finally, just because you are paranoid does not mean people are not out to get you... ;)
Simple question: if i have two lists in MC and each one is associated with a different store, which variable will differ? I assume it would be the ID only, while the U and the URL and the API are the same, correct?
I am testing the mod on a test site, with a test list on the same MC account. When testing the sidebox subscription, after the first "window" i had on MC, when clicking on "return to the site", it returned me to the LIVE site, yet, i have not entered that url anywhere. So where is it getting from?
First question: Please just do the install by following the directions instead of trying to take a short cut. Your assertion might be correct, but there's no point in taking a chance.
Second Question: I think the site is an account wide parameter.
I am not using shortcut. I just noticed that several variables were identical, so i wanted to make sure i was actually getting the correct variables. In light of your second answer, that explains then why i was redirected to the live site and it is not because of incorrect variables. Thank you.
Next question is what file will format the look of that specific sidebox? I am using a clone of the responsive_classic themplate.
Sideboxes are controlled by:
- /includes/modules/sideboxes/(optional template folder)/sidebox_name.php -- this is the business logic part
- /includes/templates/your_template/sideboxes/tpl_sidebox_name.php -- this is the template piece, where the visual part is usually contained.
I am still not getting the contact forwarded to MailChimp when they create an account. Looking further, I see that the line I had to add:
if ((int)$newsletter == 1) {
mailchimp_add($email_address);
}
only refers to the email address, but in my MC, for other integration, I have the first name as mandatory. Is it possible that because it only forwards the email address and NOT the first name, that MC simply does not recognize it or accept it?
I would need to add the first name to this, so how would I edit it?
Were you aware I offer a mod installation service?
The help page lists this as a "Moderate to High Difficulty" mod. If you are working with a developer, you should engage them. If you're not, you can hire me or someone else. But it's really not possible for me to debug failed installs on the forum.
This mod is actually easy to install. Your instructions are clear and concise and I managed to install it correctly a long time ago. It works as it should on the Sidebox side, but not on the account creation side.
Before I consider the necessity of "debugging" (I am not sure if it is really a BUG), is it possible that, if MC requires FNAME as a field to be sent to create a contact, that this field being missing from the info forwarded to it would cause the contact to NOT be created?
I know this happened on another site (not a zencart installation) and making sure that the FNAME was forwarded fixed the issue, so I am basing the question on that first hand experience.
MailChimp integration and instructions have been updated to reflect the changes in the Slim form that MailChimp produces.
Update just posted:
Fixes bug in API integration; adds instructions for changing Zen Cart newsletter page; moves log to logs folder; removes double opt in.
i have installed and configured the plugin, but when a new customers creates a customer account and subscribes to the newsletter it is NOT coming through in mailchimp.
i did update the create_account.php.
what is wrong?
from the latest code:
not sure how that removes the double opt-in, as still in a pending status v subscribed status.PHP Code:
function mailchimp_add($email) {
$mailchimp = new MailChimp(BOX_MAILCHIMP_NEWSLETTER_API_KEY);
$reply = $mailchimp->list_add_subscriber([
'id_list' => BOX_MAILCHIMP_NEWSLETTER_ID,
'email' => $email,
'status' => 'pending'
]);
few things:
- this is a nicely done integration. @swguy install instructions on his website are a tad clearer. (https://www.thatsoftwareguy.com/zenc...l#installation)
- correct me if i'm wrong, but it also seems that with an observer, one could eliminate the need to modify core code; except for includes/modules/pages/account_newsletters/header_php.php. that notifier for NOTIFY_HEADER_ACCOUNT_NEWSLETTER_UPDATED seems like it would need the email address. not really sure how that notifier would work with only having a boolean...
- while i am not a fan, one could add another(!) config to indicate whether one wanted customers to double opt-in or be immediately subscribed.
ok, dig in... and you find this:
so the double opt-in is removed. not really sure why it would be done here as opposed to the original call to mailchimp_add.PHP Code:
public function list_add_subscriber(Array $options)
{
// Check required params
if ( ! isset($options['id_list']) OR ! isset($options['email']))
{
throw new MailChimpException('Parameters not set on '.__METHOD__);
}
$endpoint = '/lists/' . $options['id_list'] . '/members/';
$payload = [
'email_address' => $options['email'],
'status' => 'subscribed',
// 'status' => isset($options['status']) ? $options['status'] : 'pending',
];
For those concerned about the upcoming MailChimp API deprecation: if you upgrade your version of my MailChimp integration, you have nothing to worry about; the latest version uses MailChimp 3.0.
Is it compatible with ZC 1.5.6?
Yes. All my mods now work with 1.5.6.
In Europe to comply with GDPR a tick box is now necessary for the use to tick to confirm they want to subscribe so an extra field is required.
In above posts it states extra coding can to added to include any aditional fields but I haven't a clue how to do this.
Has anyone achieved this which is necessary if you have any viewers in the EC.
Thank you.
Trevor
To my knowledge there are no specific requirements for a tick box. Mailchimp does have GDPR fields and there's more information here: https://mailchimp.com/help/collect-c...th-gdpr-forms/ It specifically states that Mailchimp Subscribe is not compatible with GDPR fields and Certain styles of pop-up forms are not compatible with GDPR fields. In other words, these issues lie in mailchimp, not in a sidebox designed to their specs.
My stuff still uses the double opt-in (IIRC) so you get the confirmation of subscribe you are looking for. It's hard for me to believe you have to enter your email *and* check a box.
This is what is required to comply with GDPR.
Subscribe
email address
Consent to receive further information and Newsletters.
Gift Ideas Online will use the information you provide on this form to be in touch with you and to provide updates on new products, sales, special offers and Newsletters.
Tick to consent
You can change your mind at any time by clicking the unsubscribe link in the footer of any email you receive from us, or by contacting us at [email protected]. We will treat your information with respect. For more information about our privacy practices please visit our website. By clicking below, you agree that we may process your information in accordance with these terms.
We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.
Ok, here's the thing: you can add a checkbox to the form if you want.
I just don't think you need it. It's a double opt-in system. They get an email saying "Are you sure you want this?" that they have to click a button on.
If you want to hire someone to add a checkbox to the form, go to the commercial help wanted forum at the bottom of this page.
Oh OK I get it now.
You went to mailchimp and their form generator has changed to include the checkbox.
You can use their form instead and integrate it yourself if you want to.
Hello!
I am having issues with the newsletter side box appearing on the top of the mobile version of my website www.oldpatterns.com ever since I downloaded the mod. The newsletter sidebox is appearing on all pages other than my main page (side boxes are not set to display on that site) and I would like it to only appear in the slideout. I am using the default responsive classic template, Zen Cart version 1.5.7b, and PHP 7.3.25.
I followed all of the instructions on the readme for installation, and it is working properly on the computer version of my site. I wasn't able to find another solution, so help would be appreciated!
Attachment 19315
I love your site! It reminds me of the patterns my mom used to have around the house when I was a kid. LOL.
OK here's how to solve your problem:
edit includes/templates/responsive_classic/css/responsive_default.css
where it says
div#documentcategories {display:none;visibility:hidden;}
add below that
div#mailchimpsidebox {display:none;visibility:hidden;}
(you have to do this twice because there's a portrait block and a landscape block.)
[/QUOTE]Quote:
div#documentcategories {display:none;visibility:hidden;}
add below that
div#mailchimpsidebox {display:none;visibility:hidden;}
(you have to do this twice because there's a portrait block and a landscape block.)
Thank you! I am glad you enjoy the site too! I have edited this file with the above quote twice and unfortunately it still is showing even after refreshing and clearing my cache etc. Any other help advice would be appreciated!
same change but in
includes/templates/responsive_classic/css/responsive_tablet.css
(2 places again).
In includes/templates/responsive_classic/jscript/jscript_responsive_framework.php under lines 35 and 82, copy the line for documentcategories and change that to mailchimpsidebox.
Beautiful it works now! Thank you so much for your help and prompt responses!
When will this mod be updated to work with 1.5.7b? Does anyone have it currently working with this version of ZC?
Should be fine with 1.5.7b.
I've been using Mailchimp for years, but need to add it now to our new website that uses the Fluorspar template. So far I have not been successful. When I enable it in the Layout Boxes Controller, it wipes out the center box in the Fluorspar display. Has anyone else been able to install this in a Fluorspar template?
You might want to check in https://www.zen-cart.com/showthread....late-Fluorspar also.
ok is this suppose to have a box to put an email in, it goes to another page to add info...
did i do something wrong...
i followed software guys instructions on his web site.
in the attachments shows the subscribe box
and when clicking the subscribe it goes to a second page
now when creating forms on mailchimp,, i did the condensed verson so only the email was suppose to show up.
ok.. any more info you need please ask..
thank you so much.
This is a bit of an ask but would anyone be able to share how, using v3 of the API, to update a members email address in the MailChimp list when it is edited in ZC's account_edit page. I believe this can be achieved by using the API's 'PATCH' command. This post has a solution for an earlier API version - which I've attempted to adapt, without success.
Here's what I have so far:
templates/tpl_account_edit_default.php
pages/account_edit/header_php.phpCode:<?php echo zen_draw_hidden_field('email_address_old', $account->fields['customers_email_address'], 'id="email-address-old"') ?>
extra_functions/mailchimp_functions.phpCode:mailchimp_update($email_address_old, $email_address);
$zco_notifier->notify('NOTIFY_HEADER_ACCOUNT_EDIT_UPDATES_COMPLETE');
extra_functions/mailchimp.phpCode:function mailchimp_update($email_address_old, $email) {
$mailchimp = new MailChimp(BOX_MAILCHIMP_NEWSLETTER_API_KEY);
$reply = $mailchimp->list_update_subscriber([
'id_list' => BOX_MAILCHIMP_NEWSLETTER_ID,
'email' => $email,
'status' => 'subscribed'
]);
if (isset($reply->type)) {
$errorMessage = "Unable to run update_subscriber command()!\n" .
"\tMsg=" . print_r($reply, true) . "\n";
$file = DIR_FS_LOGS . '/' . 'MailChimp.log';
if ($fp = @fopen($file, 'a')) {
fwrite($fp, $errorMessage);
fclose($fp);
}
}
}
If I use 'PUT' instead of 'PATCH' it adds the new address to the Mailchimp members list - so I guess something is working.Code:public function list_update_subscriber(Array $options)
{
// Check required params
if ( ! isset($options['id_list']) OR ! isset($options['email']))
{
throw new MailChimpException('Parameters not set on '.__METHOD__);
}
$subscriber_hash = md5(strtolower($options['email']));
$endpoint = '/lists/' . $options['id_list'] . '/members/' . $subscriber_hash;
$payload = [
'email_address' => $options['email'],
'status' => 'subscribed'
];
return $this->_execute_request('PATCH', $endpoint, $payload);
}
ZC v1.5.7c
PHP v7.3
I've updated my mailchimp.php with the patch for PATCH from @swguy's github contribution. I'm guessing that the issue lies somewhere in the other three edited files.
I've had to give up on being able to have changes of email address in ZC updated on Mailchimp's member's list (although I've confirmed that PATCH is functioning I'm unable to get the change of email to work). I thought I would post my documentation on this tweak to @swguy's mod.
Mailchimp allows for a list of subscribers to be segregated (into Groups) based on the selection made when completing the sign-up form, such as:
This is useful for sending different newsletters to different subscribers. However, if a subscriber signs up for newsletters on a ZC website, no groups are transferred to Mailchimp - meaning those subscribers will be missed if solely relying on groups to send newsletters.
Until I manage (not guaranteed) to add the relevant checkboxes to the account_newsletters page I have assumed that a subscriber on my website will automatically be signed up for both groups (wording the descriptive text on the signup page accordingly). To achieve this here are the relevant code additions (in red):
includes/languages/english/extra_definitions/mailchimp_sidebox_defines.php
includes/functions/extra_functions/mailchimp_functions.phpCode:define('BOX_MAILCHIMP_NEWSLETTER_ID','xxxxxxxxxx');
define('BOX_MAILCHIMP_NEWSLETTER_U','yyyyyyyyyy');
define('BOX_MAILCHIMP_NEWSLETTER_URL','http://YourSite.us1.list-manage.com/subscribe/post');
define('BOX_MAILCHIMP_NEWSLETTER_API_KEY','xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
define('MAILCHIMP_INTEREST_ID_A','aaaaaaaaaaa');
define('MAILCHIMP_INTEREST_ID_B','bbbbbbbbbbb');
// Language defines for newsletter sidebox
define('BOX_HEADING_MAILCHIMP_SIDEBOX', 'Newsletter');
define('BOX_MAILCHIMP_PITCH', 'Subscribe to our newsletter for periodic updates and valuable coupons.');
define('BOX_MAILCHIMP_SUBSCRIBE', 'Subscribe');
includes/functions/extra_functions/mailchimp.phpCode:function mailchimp_add($email) {
$mailchimp = new MailChimp(BOX_MAILCHIMP_NEWSLETTER_API_KEY);
$reply = $mailchimp->list_add_subscriber([
'id_list' => BOX_MAILCHIMP_NEWSLETTER_ID,
'interest_id_A' => MAILCHIMP_INTEREST_ID_A,
'interest_id_B' => MAILCHIMP_INTEREST_ID_B,
'email' => $email,
'status' => 'pending'
]);
Notes: Groups in Mailchimp dev talk are 'interests'. Finding the appropriate id of an interest (to add to the language file) is not straightforward. These days the only way to find these out is via an API call. Add the following code to a new php file in the root directory of your website and run it in a browser e.g. mywebsite[dot]com/mynewfile.php. The code is on this page, but I'll include it here in case it disappears.Code:public function list_add_subscriber(Array $options)
{
// Check required params
if ( ! isset($options['id_list']) OR ! isset($options['email']))
{
throw new MailChimpException('Parameters not set on '.__METHOD__);
}
$endpoint = '/lists/' . $options['id_list'] . '/members/';
$payload = [
'email_address' => $options['email'],
'status' => 'subscribed',
'interests' => array(
$options['interest_id_A'] => true,
$options['interest_id_B'] => true
)
// 'status' => isset($options['status']) ? $options['status'] : 'pending',
];
if (isset($options['merge_fields']) AND $options['merge_fields'])
{
$payload['merge_fields'] = $options['merge_fields'];
}
return $this->_execute_request('POST', $endpoint, $payload);
}
Code:<?php
$api_key = 'xxxxxxxxxxxxxxxxxxx-us13'; // your api key
$server = 'us13.'; // your server
$list_id = 'xxxxxxxxxxxxx'; // your list id
$group_id = 'xxxxxxxxxxxx'; // your group id
$auth = base64_encode( 'user:'.$api_key );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://'.$server.'api.mailchimp.com/3.0/lists/'.$list_id.'/interest-categories/'.$group_id.'/interests');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
'Authorization: Basic '.$auth));
curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
$result_obj = json_decode($result);
foreach ($result_obj->interests as $obj) {
echo $obj->id . ' - ' . $obj->name;
echo '<br />';
}
echo '<pre>'; print_r($result_obj); echo '</pre>';
?>
I believe <<<This is of course MY opinion>>> that updating and developing the MooSend module is the way to go. They already have a module to sync with ZC and do some automations (like abandoned cart or getting into a list). Their service is cheaper and you can create different lists (groups like you call them) for your newsletters, without paying extra. Much more of a selection of templates and some free features that Mailchimp doesn't offer on their free tier.
The only feature that Mailchip offers for free that MooSend doesn't is the "post on social media" after a newsletter is sent.
@ideasgirl The more the merrier. When I did this work, MailChimp was the only game in town for SMBs; now there are lots of options.
I'd love to see more integration work. In the specific case of MooSend though, please coordinate with them, since they did the integration for us.
Yes, I understand. The problem is that these "service suppliers" (not only MooSend) are not getting much interest from Zen Cart users (since the user-base has gone down). So they kinda abandoned these updates and development.Quote:
In the specific case of MooSend though, please coordinate with them, since they did the integration for us.
I installed that module a couple of months ago and I had to disable it because it was not compatible (it made my cart inoperable, it will not let you checkout). There was no error logs so I couldn't tell them what exactly was happening. Since there are not a lot of people asking and/or using it, they would not proceed to update the module.
I know, and that's why I mentioned MooSend because there's also an integration for ZC but nobody talks about it.Quote:
The more the merrier. When I did this work, MailChimp was the only game in town for SMBs; now there are lots of options.
I'd love to see more integration work.
Passing Marketing Permissions (GDPR) from ZC customer account to Mailchimp
In Mailchimp there is an option to enable compulsory Marketing Permissions (GDPR) checkbox(es) on a sign-up form in order to capture explicit consent to receive emails - this basically 'time-stamps' the consent for later use if needed. It would be useful to pass this explicit consent from a ZC customer account (once they have accepted the relevant GDPR privacy notice) to Mailchimps member list, so see the code below.
It is common for the explicit consent to be captured by selecting from various marketing avenues such as:
Attachment 19882
at least one of these HAS to be selected. In my case I only have one avenue (email) so the following code reflects this:
The relevant marketing permission has a 'marketing_permission_id' field which is needed and can be obtained from the output of an API call. Paste this code (updating the xxxxx) into a new php file and visit it in a browser.
includes/functions/extra_functions/mailchimp.phpCode:<?php
$api_key = 'xxxxxxxxxxxxxxxxxxxx'; // your api key
$server = 'xxxx.'; // your server - something like 'us20', usually found at the end of the API key
$list_id = 'xxxxxxxx'; // your list id
$email = 'xxxmy_email_addressxxxxx';
$auth = base64_encode( 'user:'.$api_key );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://'.$server.'api.mailchimp.com/3.0/lists/'.$list_id.'/members');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
'Authorization: Basic '.$auth));
curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
$result_obj = json_decode($result);
foreach ($result_obj->member as $obj) {
echo $obj->id . ' - ' . $obj->name;
echo '<br />';
}
echo '<pre>'; print_r($result_obj); echo '</pre>';
?>
There may be a tidier way to do it, that's all I could manage.Code:public function list_add_subscriber(Array $options)
{
// Check required params
if ( ! isset($options['id_list']) OR ! isset($options['email']))
{
throw new MailChimpException('Parameters not set on '.__METHOD__);
}
$endpoint = '/lists/' . $options['id_list'] . '/members/';
$payload = [
'email_address' => $options['email'],
'status' => 'subscribed',
'marketing_permissions' => array([
'marketing_permission_id' => 'xxxxxxxxx',
'enabled' => true
])
// 'status' => isset($options['status']) ? $options['status'] : 'pending',
];
if (isset($options['merge_fields']) AND $options['merge_fields'])
{
$payload['merge_fields'] = $options['merge_fields'];
}
return $this->_execute_request('POST', $endpoint, $payload);
}
This now passes the marketing permission consent from a customers ZC account to Mailchimps members list.
If your customers or products can be easily segmented, you might want to look at MailChimp's Groups feature. You can add Groups to your audience and allow people to self-segment. The signup form when groups are configured will include radio buttons/checkboxes so people can indicate the groups they want to join; then you can segment your audience by groups when creating and sending a newsletter.
Will this version work for 1.5.7d?
Thanks!
Yes it does.
Thanks Scott!
Hi,
I am trying to configure this on Zen Cart v1.5.6c. I am stuck on the Mailchimp side of it as my Form does not have any bot prevention code at the bottom as per your instructions. Here is a link to my Form. What am I doing wrong please?
Kind regards :-)