Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

MailChimp + SilverStripe


Go to End


35 Posts   11920 Views

Avatar
Nivanka

Community Member, 400 Posts

10 May 2011 at 2:01pm

Use the subscribe widget. and if you want you can upgrade / add new codes too.

also you can get the code from here https://github.com/fonsekaean/silverstripe_chimpy

Avatar
Bstarr

Community Member, 25 Posts

27 May 2011 at 3:22am

Thanks!

Avatar
dacar

Community Member, 173 Posts

8 July 2011 at 9:59pm

Edited: 08/07/2011 10:28pm

Hi Nivanka, hi forum members,

again i came across to insert a newsletter solution into a silverstripe website. I am using SS 2.4.5 and the latest silverstripe_chimpy. I have added an acount to mailchimp, insert some lists, templates and campaigns. I also added the SubscribeWidget.ss successfuly. But at that point i don't know how to make it all work? Here are some general qustions and problems:

1. backend->campaigns->content: is this part only to show the template code or should an admin change the HTML here? Will the changes being saved to the mailchimp server? is it possible to show the html within any HTML Editor (HTMLEditorField)?

2. backend->campaigns->templates: there are some pictures of templates i have generated within mailchimp. But there is nothing todo with it. Should't i be able to choose one? What should i being able to do here?

3. backend->lists: I have added to lists to my mailchimp account. Both lists are showen in the SS mailchimp admin pannel on the left hand side. But in the frontend form there is no possibility to select a list .$listField = new DropdownField('List', 'List', $listsForDropDown); is not populated?

4. if i try to subsribe to the newsletter, the page is reloaded but nothing is saved to the database.

I like mailchimp very much and it would be greate to get some help and documentation to integrate it. i really hope that there is someone who can help.

Greetings, Carsten.

EDIT: just tried to add or delete a member from a list using the SS administartion. Both without succsess. Sorry, this one seems to be working. It took about 15 min and then the registration was saved to the mailchimp server. The activation Mail has been sent and activation worked fine.

EDIT2: What ist the table MailchimpMemberTableField for? there is nothing saved into it?

Avatar
dacar

Community Member, 173 Posts

8 July 2011 at 11:47pm

Hi, iam not sure, but i just saw that the mailchimp api has changed from 1.2 to 1.3. If i apply 1.3 to MCAPI.php then i get some errors in SS Admin...

Avatar
juneallison

Community Member, 110 Posts

17 September 2011 at 5:03am

Hi,

I am trying to get this module set up and have some basic questions:

1. What should the module folder be called? I've name it "chimpy" ...is that correct?
2. I've entered the API key and email but when I click on the mailchimp tab in the admin, I don't get much. I see three links/areas on the left but clicking on those doesn't do anything.
3. I saw someone else say that they have added the Subscribe Widget. Is there a way to do this via the admin or do I need to call this from the code?

Any help would be great. Thanks!

Avatar
kindleman.com.au

Community Member, 70 Posts

19 September 2011 at 5:42pm

Hello,

I have installed chimpy, gone to the mailchimp tab and entered my api key & email.

Nothing shows up in the lists, campaigns or mailchimp credentials LHS nav or the main area. the subscribe widget boxes seem to work though.

What could be wrong? Does this module have any documentation?

Thanks

i'm running 2.4.5 and downloaded the latest copy of chimpy.

Avatar
dany_doo

Community Member, 13 Posts

16 November 2011 at 11:34pm

I had the same problem.. Then I downloaded the zip from http://code.google.com/p/silverstripechimpy/downloads/list and called the module mailchimp (not chimpy or anything else) and now it works.

I am about to create template in mailchimp directly (as far as I could check it, doing the template on SilverStripe side is very very hard thing).

Avatar
tv

Community Member, 44 Posts

9 December 2011 at 10:48am

Edited: 09/12/2011 10:54am

I am wanting to add a Mailchimp signup widget to my site.I don't need all the extra functionality that the current ss Mailchimp modules provide (i.e., ability to manage lists in Silverstripe, etc) I pretty much used the Model and Controller from the smartchimp module:

class SmartChimpSignup extends Widget {

	static $db = array(
		'MCApiKey'			=> 'Varchar(50)',	//	api_key
		'MCListKey'			=> 'Varchar(50)',	//	list_unique_id
		'MCSuccessContent'	=> 'HTMLText'
	);

	function getCMSFields() {

		return new FieldSet(
			new TextField('MCApiKey', _t('SmartChimp.MCAPIKEY', 'Username')),
			new TextField('MCListKey', _t('SmartChimp.MCLISTKEY', 'Unique ID for List')),
			new HTMLEditorField('MCSuccessContent', _t('SmartChimp.MCSuccessContent', 'Signup Success Content'))
		));

	}

}


class SmartChimpSignup_Controller extends Widget_Controller {

	function Form() {
		if (Session::get('SmartChimp.SUCCESS')) {
			Session::clear('SmartChimp.SUCCESS');
			return false;
		}

		$form = new Form($this, 'Form',
			new FieldSet(
				new TextField('email', 'Email Address'),
				new TextField('fname', 'First Name'),
				new HTMLEditorField('lname', 'Last Name')
			),
			new FieldSet(
				new FormAction('SignupAction', 'Sign Up')
			),
			new RequiredFields('email')
		);

		return $form;
	}

	public function mcsuccess() {
		if (Session::get('SmartChimp.SUCCESS'))
			$this->Content = $this->MCSuccessContent;

		return $this;
	}

	function SignupAction($raw_data, $form) {
		$data = Convert::raw2sql($raw_data);

		require_once('MCAPI.class.php');

		$api = new MCAPI("$this->MCApiKey");
		$list_key = $this->MCListKey;
		$mergeVars = array(
			'FNAME'	=> $data['fname'],
			'LNAME'	=> $data['lname']
		);

		if (true === $api->listSubscribe($list_key, $data['email'], $mergeVars)) {
			//	success!
			Session::set('SmartChimp.SUCCESS', true);
			return $this->mcsuccess();
		}
		else {
			//	failure!
			$form->sessionMessage($api->errorMessage, 'warning');
			return $this;
		}
	}

}

After adding the appropriate $has_one and getCMSFields to Page.php I ma able to get the form in my sidebar.

I have two problems though.
1. There seems to be an issue with Widget_Controller not having the right controller methods to re-direct the page on successful submission. I would like to keep this a widget as this seems to make the most sense.

2. How would I implement the ajax functionality that comes with the php example provided by Mailchimp:

$(document).ready(function() {
	$('#signup').submit(function() {
		// update user interface
		$('#response').html('Adding email address...');
		
		// Prepare query string and send AJAX request
		$.ajax({
			url: 'inc/store-address.php',
			data: 'ajax=true&email=' + escape($('#email').val()),
			success: function(msg) {
				$('#response').html(msg);
			}
		});
	
		return false;
	});
});

Or more accurately, what would the url be in the ajax call?

thanks in advance.