-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #882 from mailchimp/pre_release-1.1.15
Merge release 1.1.15
- Loading branch information
Showing
53 changed files
with
4,523 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
app/code/community/Ebizmarts/MailChimp/Block/Adminhtml/Customer/Edit/Tab/Mailchimp.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
/** | ||
* mc-magento Magento Component | ||
* | ||
* @category Ebizmarts | ||
* @package mc-magento | ||
* @author Ebizmarts Team <[email protected]> | ||
* @copyright Ebizmarts (http://ebizmarts.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @date: 6/10/16 12:38 AM | ||
* @file: Grid.php | ||
*/ | ||
class Ebizmarts_MailChimp_Block_Adminhtml_Customer_Edit_Tab_Mailchimp extends Mage_Adminhtml_Block_Widget_Grid | ||
{ | ||
|
||
protected $_lists = array(); | ||
protected $_info = array(); | ||
protected $_myLists = array(); | ||
protected $_generalList = array(); | ||
protected $_form; | ||
protected $_api; | ||
protected $_customer; | ||
/** | ||
* @var Ebizmarts_MailChimp_Helper_Data | ||
*/ | ||
protected $helper; | ||
protected $storeId; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->setTemplate('ebizmarts/mailchimp/customer/tab/mailchimp.phtml'); | ||
$this->helper = $this->makeHelper(); | ||
$customerId = (int) $this->getRequest()->getParam('id'); | ||
if ($customerId) { | ||
$this->_customer = $this->getCustomerModel()->load($customerId); | ||
$this->storeId = $this->getCustomer()->getStoreId(); | ||
} | ||
} | ||
|
||
public function getInterest() | ||
{ | ||
$customer = $this->getCustomer(); | ||
$subscriber = $this->getSubscriberModel(); | ||
$subscriber->loadByEmail($customer->getEmail()); | ||
$subscriberId = $subscriber->getSubscriberId(); | ||
$customerId = $customer->getId(); | ||
$storeId = $this->getStoreId(); | ||
$interest = $this->helper->getInterestGroups($customerId, $subscriberId, $storeId); | ||
|
||
return $interest; | ||
} | ||
|
||
/** | ||
* @return Mage_Newsletter_Model_Subscriber | ||
*/ | ||
protected function getSubscriberModel() | ||
{ | ||
return Mage::getModel('newsletter/subscriber'); | ||
} | ||
|
||
/** | ||
* @return Ebizmarts_MailChimp_Helper_Data | ||
*/ | ||
protected function makeHelper() | ||
{ | ||
return Mage::helper('mailchimp'); | ||
} | ||
|
||
/** | ||
* @return false|Mage_Core_Model_Abstract | ||
*/ | ||
protected function getCustomerModel() | ||
{ | ||
return Mage::getModel('customer/customer'); | ||
} | ||
|
||
/** | ||
* @return Mage_Core_Model_Abstract | ||
*/ | ||
protected function getCustomer() | ||
{ | ||
return $this->_customer; | ||
} | ||
|
||
/** | ||
* If customer was created in admin panel use the store view selected for MailChimp. | ||
* | ||
* @return mixed | ||
*/ | ||
protected function getStoreId() | ||
{ | ||
$storeId = $this->storeId; | ||
if (!$storeId) { | ||
$storeId = $this->_customer->getMailchimpStoreView(); | ||
} | ||
return $storeId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
app/code/community/Ebizmarts/MailChimp/Block/Checkout/Success/Groups.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
/** | ||
* Checkout subscribe interest groups block renderer | ||
* | ||
* @category Ebizmarts | ||
* @package Ebizmarts_MailChimp | ||
* @author Ebizmarts Team <[email protected]> | ||
* @license http://opensource.org/licenses/osl-3.0.php | ||
*/ | ||
class Ebizmarts_MailChimp_Block_Checkout_Success_Groups extends Mage_Core_Block_Template | ||
{ | ||
protected $_currentIntesrest; | ||
/** | ||
* @var Ebizmarts_MailChimp_Helper_Data | ||
*/ | ||
protected $helper; | ||
protected $storeId; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->helper = Mage::helper('mailchimp'); | ||
$this->storeId = Mage::app()->getStore()->getId(); | ||
} | ||
|
||
public function getFormUrl() | ||
{ | ||
return $this->getSuccessInterestUrl(); | ||
} | ||
|
||
public function getSuccessInterestUrl() | ||
{ | ||
$url = 'mailchimp/group/index'; | ||
return Mage::app()->getStore()->getUrl($url); | ||
} | ||
|
||
public function getInterest() | ||
{ | ||
$subscriber = $this->getSubscriberModel(); | ||
$order = $this->getSessionLastRealOrder(); | ||
$subscriber->loadByEmail($order->getCustomerEmail()); | ||
$subscriberId = $subscriber->getSubscriberId(); | ||
$customerId = $order->getCustomerId(); | ||
$helper = $this->getMailChimpHelper(); | ||
$interest = $helper->getInterestGroups($customerId, $subscriberId, $order->getStoreId()); | ||
return $interest; | ||
} | ||
|
||
public function getMessageBefore() | ||
{ | ||
$storeId = $this->storeId; | ||
$message = $this->getMailChimpHelper()->getCheckoutSuccessHtmlBefore($storeId); | ||
return $message; | ||
} | ||
|
||
public function getMessageAfter() | ||
{ | ||
$storeId = $this->storeId; | ||
$message = $this->getMailChimpHelper()->getCheckoutSuccessHtmlAfter($storeId); | ||
return $message; | ||
} | ||
|
||
/** | ||
* @return false|Mage_Core_Model_Abstract | ||
*/ | ||
protected function getSubscriberModel() | ||
{ | ||
return Mage::getModel('newsletter/subscriber'); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
protected function getSessionLastRealOrder() | ||
{ | ||
return Mage::getSingleton('checkout/session')->getLastRealOrder(); | ||
} | ||
|
||
/** | ||
* @return Ebizmarts_MailChimp_Helper_Data|Mage_Core_Helper_Abstract | ||
*/ | ||
protected function getMailChimpHelper() | ||
{ | ||
return $this->helper; | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
app/code/community/Ebizmarts/MailChimp/Block/Customer/Newsletter/Index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
/** | ||
* Customer account subscribe interest groups block renderer | ||
* | ||
* @category Ebizmarts | ||
* @package Ebizmarts_MageMonkey | ||
* @author Ebizmarts Team <[email protected]> | ||
* @license http://opensource.org/licenses/osl-3.0.php | ||
*/ | ||
class Ebizmarts_MailChimp_Block_Customer_Newsletter_Index extends Mage_Customer_Block_Newsletter | ||
{ | ||
|
||
protected $_lists = array(); | ||
protected $_info = array(); | ||
protected $_myLists = array(); | ||
protected $_generalList = array(); | ||
protected $_form; | ||
protected $_api; | ||
protected $_template = "ebizmarts/mailchimp/customer/newsletter/index.phtml"; | ||
/** | ||
* @var Ebizmarts_MailChimp_Helper_Data | ||
*/ | ||
protected $helper; | ||
protected $storeId; | ||
|
||
public function __construct() | ||
{ | ||
$this->setTemplate('ebizmarts/mailchimp/customer/newsletter/index.phtml'); | ||
$this->helper = Mage::helper('mailchimp'); | ||
$this->storeId = Mage::app()->getStore()->getId(); | ||
} | ||
|
||
public function getInterest() | ||
{ | ||
$subscriber = $this->getSubscriberModel(); | ||
$subscriber->loadByEmail($this->_getEmail()); | ||
$helper = $this->getMailChimpHelper(); | ||
$customerSession = $this->getCustomerSession(); | ||
if (!$helper->isAdmin() && $customerSession->isLoggedIn()) { | ||
$customer = $customerSession->getCustomer(); | ||
$customerId = $customer->getId(); | ||
$storeId = ($subscriber->getStoreId()) ? $subscriber->getStoreId() : $customer->getStoreId(); | ||
} else { | ||
$customerId = null; | ||
$storeId = $subscriber->getStoreId(); | ||
} | ||
$interest = $helper->getInterestGroups($customerId, $subscriber->getSubscriberId(), $storeId); | ||
return $interest; | ||
} | ||
|
||
/** | ||
* Retrieve email from Customer object in session | ||
* | ||
* @return string Email address | ||
*/ | ||
protected function _getEmail() | ||
{ | ||
return $this->helper('customer')->getCustomer()->getEmail(); | ||
} | ||
|
||
/** | ||
* @return Ebizmarts_MailChimp_Helper_Data | ||
*/ | ||
protected function getMailChimpHelper() | ||
{ | ||
return $this->helper; | ||
} | ||
|
||
/** | ||
* @return Mage_Customer_Model_Session | ||
*/ | ||
protected function getCustomerSession() | ||
{ | ||
return Mage::getSingleton('customer/session'); | ||
} | ||
|
||
/** | ||
* @return Mage_Newsletter_Model_Subscriber | ||
*/ | ||
protected function getSubscriberModel() | ||
{ | ||
return Mage::getModel('newsletter/subscriber'); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
app/code/community/Ebizmarts/MailChimp/Block/Group/Type.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* Interest group type template selector block | ||
* | ||
* @category Ebizmarts | ||
* @package Ebizmarts_MageMonkey | ||
* @author Ebizmarts Team <[email protected]> | ||
* @license http://opensource.org/licenses/osl-3.0.php | ||
*/ | ||
class Ebizmarts_MailChimp_Block_Group_Type extends Mage_Core_Block_Template | ||
{ | ||
protected $_currentInterest; | ||
|
||
public function __construct(array $args = array()) | ||
{ | ||
if (isset($args['interests'])) { | ||
$this->_currentInterest = $interests = $args['interests']; | ||
$type = $interests['interest']['type']; | ||
$this->setTemplate("ebizmarts/mailchimp/group/type/$type.phtml"); | ||
} | ||
parent::__construct($args); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
protected function getCurrentInterest() | ||
{ | ||
return $this->_currentInterest; | ||
} | ||
} |
Oops, something went wrong.