==============================================================================
"MailChimp Integration Pro" Instructions

Author: Clear Thinking, LLC
E-mail: johnathan@getclearthinking.com
Website: http://www.getclearthinking.com
==============================================================================

1. Backup your OpenCart installation, just to be safe.



2. If you're using OpenCart 2.x and are upgrading from an older version of the
extension, you'll first need to delete the old ocMod file. To do that,
navigate to Extensions > Modifications, click the checkbox next to the
extension's name, and then click the red trash icon. 

Once you've done that, navigate to Extensions > Extension Installer. Click
"Upload" and then choose the appropriate .ocmod.zip bundle for your OpenCart
version.

If using OpenCart 4.0, you will need to first unzip the bundle called
"OpenCart 4.0 Versions.zip" and then upload the .ocmod.zip bundle inside.



3. If using OpenCart 2 or OpenCart 3, navigate to Extensions > Modifications
and click "Refresh". You may need to do this twice, depending on the other
mods you have installed.



4. If you prefer the extension be installed for you as a paid service, contact
Clear Thinking at the above e-mail address for details.



5. If updating from a previous version, make sure to click "Save" in the
admin panel to apply any new settings. You can ignore the rest of the
following instructions.



6. If installing for the first time, navigate to:
Extensions > Modules > MailChimp Integration Pro > click Install



7. All documentation for the extension is built into the admin panel itself, in
the form of help text and tooltips. Please make sure you read all of that
information carefully for each admin panel setting. If you have further
questions about any specific setting, or any problems using the extension,
please contact Clear Thinking at the above e-mail address.



8. If you want to add a checkbox to the guest checkout as well, you can use
the following edit in OpenCart 2 or 3. The info will then be passed on to
MailChimp appropriately during guest checkout. If you have "Auto-Create
Customers" enabled, a new customer will also be automatically created in
OpenCart when MailChimp sends the webhook back to OpenCart after the sign up
is processed.

------------------------------------------------------------------------------
IN:
/catalog/view/theme/default/template/checkout/guest.tpl or guest.twig

BEFORE:
<div class="buttons">

ADD:
<label><input type="checkbox" name="newsletter" value="1" /> Subscribe to our newsletter</label>
------------------------------------------------------------------------------



9. If you want to add a checkbox to the default theme's contact form as well,
you can use the following edit in OpenCart 2 or 3. For custom themes, ask your
theme designer for the appropriate edit.

------------------------------------------------------------------------------
IN:
/catalog/view/theme/default/template/information/contact.tpl or contact.twig

AFTER:
<div class="buttons">

ADD:
<label><input type="checkbox" name="newsletter" value="1" /> Subscribe to our newsletter</label>
------------------------------------------------------------------------------



10. To hook other e-mail modules or extensions into the MailChimp Integration,
you can paste the following code in wherever the e-mail address is used on the
server. If you don't know where that is, you should ask the developer of the
extension you are trying to hook it into.

The $email variable should contain the e-mail address you want to subscribe to
your MailChimp list.

------------------------------------------------------------------------------
if (version_compare(VERSION, '2.1', '<')) {
	$this->load->library($this->name);
} elseif (version_compare(VERSION, '4.0', '>=')) {
	require_once(DIR_EXTENSION . $this->name . '/system/library/' . $this->name . '.php');
}
$mailchimp_integration = new \MailChimp_Integration($this->registry);
$mailchimp_integration->send(array('email' => $email, 'newsletter' => 1));
------------------------------------------------------------------------------



11. If you've enabled the "Send Cart Data" setting and are using a custom
checkout, you'll need to place this code somewhere in your checkout extension
code, to send abandoned carts to MailChimp. You should ask the developer
of your checkout extension if you do not know where to place it:

------------------------------------------------------------------------------
if ($this->customer->isLogged()) {
	$customer_id = (int)$this->customer->getId();
} elseif (!empty($this->session->data['mailchimp_signup_email'])) {
	$customer_id = $this->session->data['mailchimp_signup_email'];
} elseif (!empty($this->session->data['guest']['email'])) {
	$customer_id = $this->session->data['guest']['email'];
}
if (!empty($customer_id)) {
	if (version_compare(VERSION, '2.1', '<')) {
		$this->load->library($this->name);
	} elseif (version_compare(VERSION, '4.0', '>=')) {
		require_once(DIR_EXTENSION . $this->name . '/system/library/' . $this->name . '.php');
	}
	$mailchimp_integration = new \MailChimp_Integration($this->registry);
	$mailchimp_integration->sendCart($this->cart, $customer_id);
}
------------------------------------------------------------------------------
