Version Notes
1) Set API Key as required field.
2) Connect button to check if API key entered is correct or not.
3) Changed API call for Mass Action
Download this release
Release Info
Developer | INinbox.com |
Extension | INinbox_Emailmarketing |
Version | 1.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.2.2
- app/code/local/Ininbox/Emailmarketing/Block/Adminhtml/System/Config/Form/Button.php +63 -0
- app/code/local/Ininbox/Emailmarketing/Helper/Data.php +2 -2
- app/code/local/Ininbox/Emailmarketing/Model/Ininbox/.goutputstream-QK2YCX +121 -0
- app/code/local/Ininbox/Emailmarketing/Model/Ininbox/Base.php +39 -4
- app/code/local/Ininbox/Emailmarketing/Model/Ininbox/Contact.php +11 -0
- app/code/local/Ininbox/Emailmarketing/Model/Ininbox/Customfield.php +10 -0
- app/code/local/Ininbox/Emailmarketing/Model/Ininbox/General.php +23 -0
- app/code/local/Ininbox/Emailmarketing/Model/Observer.php +305 -12
- app/code/local/Ininbox/Emailmarketing/Model/System/Config/Source/Field/List.php +2 -2
- app/code/local/Ininbox/Emailmarketing/controllers/Adminhtml/ButtonController.php +37 -0
- app/code/local/Ininbox/Emailmarketing/controllers/Adminhtml/MassactionController.php +33 -38
- app/code/local/Ininbox/Emailmarketing/etc/config.xml +24 -8
- app/code/local/Ininbox/Emailmarketing/etc/system.xml +15 -24
- app/code/local/Ininbox/Emailmarketing/sql/emailmarketing_setup/mysql4-upgrade-0.1.0-1.2.1.php +17 -0
- app/design/adminhtml/default/default/layout/ininbox.xml +11 -0
- app/design/adminhtml/default/default/template/ininbox/system/config/button.phtml +88 -0
- package.xml +44 -18
- skin/adminhtml/default/default/ininbox/css/ininbox.css +8 -0
- skin/adminhtml/default/default/{images/ininbox → ininbox/images}/ininbox.png +0 -0
app/code/local/Ininbox/Emailmarketing/Block/Adminhtml/System/Config/Form/Button.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ininbox_Emailmarketing_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
/*
|
5 |
+
* Set template
|
6 |
+
*/
|
7 |
+
protected function _construct()
|
8 |
+
{
|
9 |
+
parent::_construct();
|
10 |
+
$this->setTemplate('ininbox/system/config/button.phtml');
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Return element html
|
15 |
+
*
|
16 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
20 |
+
{
|
21 |
+
return $this->_toHtml();
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Return ajax url for button
|
26 |
+
*
|
27 |
+
* @return string
|
28 |
+
*/
|
29 |
+
public function getAjaxCheckUrl()
|
30 |
+
{
|
31 |
+
return Mage::helper('adminhtml')->getUrl('admin_ininbox_emailmarketing/adminhtml_button/check');
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Return config url to redirect
|
36 |
+
*
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
public function getConfigUrl()
|
40 |
+
{
|
41 |
+
return Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit/section/ininbox_emailmarketing_options');
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Generate button html
|
46 |
+
*
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public function getButtonHtml()
|
50 |
+
{
|
51 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
52 |
+
->setData(array(
|
53 |
+
'id' => 'ininbox_connect_button',
|
54 |
+
'label' => $this->helper('adminhtml')->__('Connect'),
|
55 |
+
'class' => 'scalable save',
|
56 |
+
'onclick' => 'javascript:check(); return false;'
|
57 |
+
));
|
58 |
+
|
59 |
+
return $button->toHtml();
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
?>
|
app/code/local/Ininbox/Emailmarketing/Helper/Data.php
CHANGED
@@ -13,7 +13,7 @@ class Ininbox_Emailmarketing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
13 |
*/
|
14 |
public function isEnabled()
|
15 |
{
|
16 |
-
return Mage::getStoreConfig('
|
17 |
}
|
18 |
|
19 |
/**
|
@@ -27,7 +27,7 @@ class Ininbox_Emailmarketing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
27 |
*/
|
28 |
public function getConfig($group, $field)
|
29 |
{
|
30 |
-
return Mage::getStoreConfig('
|
31 |
}
|
32 |
}
|
33 |
?>
|
13 |
*/
|
14 |
public function isEnabled()
|
15 |
{
|
16 |
+
return Mage::getStoreConfig('ininbox_emailmarketing_options/general/enabled', Mage::app()->getStore());
|
17 |
}
|
18 |
|
19 |
/**
|
27 |
*/
|
28 |
public function getConfig($group, $field)
|
29 |
{
|
30 |
+
return Mage::getStoreConfig('ininbox_emailmarketing_options/' . $group . '/' . $field, Mage::app()->getStore());
|
31 |
}
|
32 |
}
|
33 |
?>
|
app/code/local/Ininbox/Emailmarketing/Model/Ininbox/.goutputstream-QK2YCX
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* INinbox Email Marketing
|
4 |
+
* @category INinbox
|
5 |
+
* @package INinbox_Emailmarketing
|
6 |
+
**/
|
7 |
+
class Ininbox_Emailmarketing_Model_Ininbox_Base extends Mage_Core_Model_Abstract {
|
8 |
+
|
9 |
+
protected $api_key = '';
|
10 |
+
protected $curl = true;
|
11 |
+
protected $curlExists = true;
|
12 |
+
protected $api_url = '';
|
13 |
+
|
14 |
+
public $api_isready = false;
|
15 |
+
|
16 |
+
protected function _construct() {
|
17 |
+
|
18 |
+
$this->_init('emailmarketing/ininbox_base');
|
19 |
+
|
20 |
+
$helper = Mage::helper('emailmarketing');
|
21 |
+
if($helper->isEnabled())
|
22 |
+
{
|
23 |
+
$this->api_key = $helper->getConfig($group = 'general', $field = 'key');
|
24 |
+
$this->api_url = $helper->getConfig($group = 'general', $field = 'url');
|
25 |
+
$this->curlExists = function_exists( 'curl_init' ) && function_exists( 'curl_setopt' );
|
26 |
+
|
27 |
+
if($this->api_key != '' && $this->api_url != '' && $this->curlExists)
|
28 |
+
{
|
29 |
+
$this->api_isready = true;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* The direct way to make an API call.
|
36 |
+
*
|
37 |
+
* @param string $action The API call.
|
38 |
+
* @param string $format API call format - json or xml.
|
39 |
+
* @param array $options An associative array of values to send as part of the request.
|
40 |
+
* @return array parsed to array XML or JSON response.
|
41 |
+
*/
|
42 |
+
public function makeCall($action = '', $parameters='' , $format='json', $options = null){
|
43 |
+
|
44 |
+
$postdata = null; $result = null;
|
45 |
+
|
46 |
+
if ( isset( $options['params'] ) ){
|
47 |
+
$postdata = $options['params'];
|
48 |
+
}
|
49 |
+
|
50 |
+
if ($this->api_isready && $this->curl && $this->curlExists ){
|
51 |
+
|
52 |
+
$url=$this->api_url.$action.'.'.$format;
|
53 |
+
if($parameters != '')
|
54 |
+
$url.='?'.$parameters;
|
55 |
+
$ch = curl_init( );
|
56 |
+
|
57 |
+
$postdata = json_encode( $postdata );
|
58 |
+
|
59 |
+
curl_setopt($ch, CURLOPT_URL,$url);
|
60 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
61 |
+
|
62 |
+
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
|
63 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Returns result to a variable instead of echoing
|
64 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // Sets a time limit for curl in seconds (do not set too low)
|
65 |
+
|
66 |
+
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
67 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->api_key.":");
|
68 |
+
|
69 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
|
70 |
+
if($format=='json'){
|
71 |
+
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', 'Content-Length: ' . strlen($postdata)));
|
72 |
+
}
|
73 |
+
|
74 |
+
$result = curl_exec($ch);
|
75 |
+
curl_close($ch);
|
76 |
+
|
77 |
+
if($format=='json'){
|
78 |
+
return json_decode($result, true);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
return $result;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function checkCall($api_url, $api_key, $action = '', $format='json'){
|
85 |
+
|
86 |
+
$postdata = null; $result = null;
|
87 |
+
|
88 |
+
if ($this->api_isready && $this->curl && $this->curlExists ){
|
89 |
+
|
90 |
+
$url=$api_url.$action.'.'.$format;
|
91 |
+
$ch = curl_init( );
|
92 |
+
|
93 |
+
curl_setopt($ch, CURLOPT_URL,$url);
|
94 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
95 |
+
|
96 |
+
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
|
97 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Returns result to a variable instead of echoing
|
98 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // Sets a time limit for curl in seconds (do not set too low)
|
99 |
+
|
100 |
+
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
101 |
+
curl_setopt($ch, CURLOPT_USERPWD, $api_key.":");
|
102 |
+
|
103 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
|
104 |
+
if($format=='json'){
|
105 |
+
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', 'Content-Length: ' . strlen($postdata)));
|
106 |
+
}
|
107 |
+
|
108 |
+
$result = curl_exec($ch);
|
109 |
+
curl_close($ch);
|
110 |
+
|
111 |
+
if($format=='json'){
|
112 |
+
return json_decode($result, true);
|
113 |
+
}
|
114 |
+
|
115 |
+
$result['customurl'] =
|
116 |
+
|
117 |
+
}
|
118 |
+
return $result;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
?>
|
app/code/local/Ininbox/Emailmarketing/Model/Ininbox/Base.php
CHANGED
@@ -15,15 +15,14 @@ class Ininbox_Emailmarketing_Model_Ininbox_Base extends Mage_Core_Model_Abstract
|
|
15 |
|
16 |
protected function _construct() {
|
17 |
|
18 |
-
$this->
|
19 |
|
|
|
20 |
$helper = Mage::helper('emailmarketing');
|
21 |
if($helper->isEnabled())
|
22 |
{
|
23 |
$this->api_key = $helper->getConfig($group = 'general', $field = 'key');
|
24 |
$this->api_url = $helper->getConfig($group = 'general', $field = 'url');
|
25 |
-
$this->curlExists = function_exists( 'curl_init' ) && function_exists( 'curl_setopt' );
|
26 |
-
|
27 |
if($this->api_key != '' && $this->api_url != '' && $this->curlExists)
|
28 |
{
|
29 |
$this->api_isready = true;
|
@@ -59,7 +58,7 @@ class Ininbox_Emailmarketing_Model_Ininbox_Base extends Mage_Core_Model_Abstract
|
|
59 |
curl_setopt($ch, CURLOPT_URL,$url);
|
60 |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
61 |
|
62 |
-
curl_setopt($ch, CURLOPT_FAILONERROR,
|
63 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Returns result to a variable instead of echoing
|
64 |
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // Sets a time limit for curl in seconds (do not set too low)
|
65 |
|
@@ -80,5 +79,41 @@ class Ininbox_Emailmarketing_Model_Ininbox_Base extends Mage_Core_Model_Abstract
|
|
80 |
}
|
81 |
return $result;
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
84 |
?>
|
15 |
|
16 |
protected function _construct() {
|
17 |
|
18 |
+
$this->curlExists = function_exists( 'curl_init' ) && function_exists( 'curl_setopt' );
|
19 |
|
20 |
+
$this->_init('emailmarketing/ininbox_base');
|
21 |
$helper = Mage::helper('emailmarketing');
|
22 |
if($helper->isEnabled())
|
23 |
{
|
24 |
$this->api_key = $helper->getConfig($group = 'general', $field = 'key');
|
25 |
$this->api_url = $helper->getConfig($group = 'general', $field = 'url');
|
|
|
|
|
26 |
if($this->api_key != '' && $this->api_url != '' && $this->curlExists)
|
27 |
{
|
28 |
$this->api_isready = true;
|
58 |
curl_setopt($ch, CURLOPT_URL,$url);
|
59 |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
60 |
|
61 |
+
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
|
62 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Returns result to a variable instead of echoing
|
63 |
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // Sets a time limit for curl in seconds (do not set too low)
|
64 |
|
79 |
}
|
80 |
return $result;
|
81 |
}
|
82 |
+
|
83 |
+
public function checkCall($api_url, $api_key, $action = '', $format='json'){
|
84 |
+
|
85 |
+
$postdata = null; $result = null;
|
86 |
+
|
87 |
+
if ($this->curl && $this->curlExists){
|
88 |
+
|
89 |
+
$url=$api_url.$action.'.'.$format;
|
90 |
+
$ch = curl_init( );
|
91 |
+
|
92 |
+
curl_setopt($ch, CURLOPT_URL,$url);
|
93 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
94 |
+
|
95 |
+
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
|
96 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Returns result to a variable instead of echoing
|
97 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // Sets a time limit for curl in seconds (do not set too low)
|
98 |
+
|
99 |
+
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
100 |
+
curl_setopt($ch, CURLOPT_USERPWD, $api_key.":");
|
101 |
+
|
102 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
|
103 |
+
if($format=='json'){
|
104 |
+
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', 'Content-Length: ' . strlen($postdata)));
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
$result = curl_exec($ch);
|
109 |
+
curl_close($ch);
|
110 |
+
|
111 |
+
if($format=='json'){
|
112 |
+
return json_decode($result, true);
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
116 |
+
return $result;
|
117 |
+
}
|
118 |
}
|
119 |
?>
|
app/code/local/Ininbox/Emailmarketing/Model/Ininbox/Contact.php
CHANGED
@@ -31,5 +31,16 @@ class Ininbox_Emailmarketing_Model_Ininbox_Contact extends Mage_Core_Model_Abstr
|
|
31 |
return Mage::getModel('emailmarketing/ininbox_base')
|
32 |
->makeCall('contacts/create', '', 'json', $params);
|
33 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
?>
|
31 |
return Mage::getModel('emailmarketing/ininbox_base')
|
32 |
->makeCall('contacts/create', '', 'json', $params);
|
33 |
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* use to import contacts in ininbox
|
37 |
+
*
|
38 |
+
* @return response for import from ininbox
|
39 |
+
*/
|
40 |
+
public function import($params)
|
41 |
+
{
|
42 |
+
return Mage::getModel('emailmarketing/ininbox_base')
|
43 |
+
->makeCall('contacts/import', '', 'json', $params);
|
44 |
+
}
|
45 |
}
|
46 |
?>
|
app/code/local/Ininbox/Emailmarketing/Model/Ininbox/Customfield.php
CHANGED
@@ -19,5 +19,15 @@ class Ininbox_Emailmarketing_Model_Ininbox_Customfield extends Mage_Core_Model_A
|
|
19 |
{
|
20 |
return Mage::getModel('emailmarketing/ininbox_base')->makeCall('customfields/list', 'PageSize=500');
|
21 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
?>
|
19 |
{
|
20 |
return Mage::getModel('emailmarketing/ininbox_base')->makeCall('customfields/list', 'PageSize=500');
|
21 |
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* use to get the list of custom fields from ininbox
|
25 |
+
*
|
26 |
+
* @return list of custom fields in json format
|
27 |
+
*/
|
28 |
+
public function getPredefinedList()
|
29 |
+
{
|
30 |
+
return Mage::getModel('emailmarketing/ininbox_base')->makeCall('customfields/predefined', 'PageSize=500');
|
31 |
+
}
|
32 |
}
|
33 |
?>
|
app/code/local/Ininbox/Emailmarketing/Model/Ininbox/General.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* INinbox Email Marketing
|
4 |
+
* @category INinbox
|
5 |
+
* @package INinbox_Emailmarketing
|
6 |
+
**/
|
7 |
+
class Ininbox_Emailmarketing_Model_Ininbox_General extends Mage_Core_Model_Abstract {
|
8 |
+
|
9 |
+
protected function _construct() {
|
10 |
+
$this->_init('emailmarketing/ininbox_general');
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* use to get the list of lists from ininbox
|
15 |
+
*
|
16 |
+
* @return list of lists in json format
|
17 |
+
*/
|
18 |
+
public function getSystemDateTime($api_url, $api_key)
|
19 |
+
{
|
20 |
+
return Mage::getModel('emailmarketing/ininbox_base')->checkCall($api_url, $api_key, 'general/systemdate');
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
app/code/local/Ininbox/Emailmarketing/Model/Observer.php
CHANGED
@@ -6,6 +6,8 @@
|
|
6 |
**/
|
7 |
class Ininbox_Emailmarketing_Model_Observer
|
8 |
{
|
|
|
|
|
9 |
/**
|
10 |
* event listener on customer detail save
|
11 |
*
|
@@ -194,10 +196,7 @@ class Ininbox_Emailmarketing_Model_Observer
|
|
194 |
if($isIninboxSendSubscriberEnabled && !is_null($ininboxSubscriberGroupList))
|
195 |
{
|
196 |
$customersIds = $observer->getCustomersIds();
|
197 |
-
|
198 |
-
$currentCustomer = Mage::getModel('customer/customer')->load($customerId);
|
199 |
-
$this->createIninboxContact($currentCustomer, $ininboxSubscriberGroupList, $ininboxResubscriber, $ininboxSendConfirmationEmail, $ininboxAddContactToAutoresponderCycle);
|
200 |
-
}
|
201 |
}
|
202 |
}
|
203 |
}
|
@@ -237,12 +236,23 @@ class Ininbox_Emailmarketing_Model_Observer
|
|
237 |
|
238 |
$result = Mage::getModel('emailmarketing/ininbox_contact')->add($params);
|
239 |
|
240 |
-
$
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
catch (Exception $e) {
|
244 |
-
|
|
|
245 |
}
|
|
|
|
|
246 |
}
|
247 |
|
248 |
/**
|
@@ -313,13 +323,24 @@ class Ininbox_Emailmarketing_Model_Observer
|
|
313 |
$params['params']['ListIDs'] = array(intval($ininboxGroupList));
|
314 |
|
315 |
$result = Mage::getModel('emailmarketing/ininbox_contact')->add($params);
|
316 |
-
|
317 |
-
$
|
318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
}
|
320 |
catch (Exception $e) {
|
321 |
-
|
|
|
322 |
}
|
|
|
|
|
323 |
}
|
324 |
|
325 |
/**
|
@@ -343,10 +364,282 @@ class Ininbox_Emailmarketing_Model_Observer
|
|
343 |
$params['params']['AddContactToAutoresponderCycle'] = $ininboxAddContactToAutoresponderCycle;
|
344 |
$params['params']['ListIDs'] = array(intval($ininboxGroupList));
|
345 |
$result = Mage::getModel('emailmarketing/ininbox_contact')->add($params);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
}
|
347 |
catch (Exception $e) {
|
348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
}
|
|
|
350 |
}
|
351 |
}
|
352 |
?>
|
6 |
**/
|
7 |
class Ininbox_Emailmarketing_Model_Observer
|
8 |
{
|
9 |
+
protected $_logFile = 'ininbox.log';
|
10 |
+
|
11 |
/**
|
12 |
* event listener on customer detail save
|
13 |
*
|
196 |
if($isIninboxSendSubscriberEnabled && !is_null($ininboxSubscriberGroupList))
|
197 |
{
|
198 |
$customersIds = $observer->getCustomersIds();
|
199 |
+
$this->importIninboxContact($customersIds, $ininboxSubscriberGroupList);
|
|
|
|
|
|
|
200 |
}
|
201 |
}
|
202 |
}
|
236 |
|
237 |
$result = Mage::getModel('emailmarketing/ininbox_contact')->add($params);
|
238 |
|
239 |
+
if(isset($result['Code']) && isset($result['Message']))
|
240 |
+
{
|
241 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR (' . $result['Code'] . '): ' . $result['Message']);
|
242 |
+
Mage::log($error_message, null, $this->_logFile);
|
243 |
+
}
|
244 |
+
else
|
245 |
+
{
|
246 |
+
$currentCustomer->setIninboxContactId($result['ContactID']);
|
247 |
+
$currentCustomer->save();
|
248 |
+
}
|
249 |
}
|
250 |
catch (Exception $e) {
|
251 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR: Error in updating creating in INinbox. <br />' . $e->getMessage());
|
252 |
+
Mage::log($error_message, null, $this->_logFile);
|
253 |
}
|
254 |
+
|
255 |
+
return $error_message;
|
256 |
}
|
257 |
|
258 |
/**
|
323 |
$params['params']['ListIDs'] = array(intval($ininboxGroupList));
|
324 |
|
325 |
$result = Mage::getModel('emailmarketing/ininbox_contact')->add($params);
|
326 |
+
|
327 |
+
if(isset($result['Code']) && isset($result['Message']))
|
328 |
+
{
|
329 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR (' . $result['Code'] . '): ' . $result['Message']);
|
330 |
+
Mage::log($error_message, null, $this->_logFile);
|
331 |
+
}
|
332 |
+
else
|
333 |
+
{
|
334 |
+
$currentCustomer->setIninboxContactId($result['ContactID']);
|
335 |
+
$currentCustomer->save();
|
336 |
+
}
|
337 |
}
|
338 |
catch (Exception $e) {
|
339 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR: Error in creating contact in INinbox. <br />' . $e->getMessage());
|
340 |
+
Mage::log($error_message, null, $this->_logFile);
|
341 |
}
|
342 |
+
|
343 |
+
return $error_message;
|
344 |
}
|
345 |
|
346 |
/**
|
364 |
$params['params']['AddContactToAutoresponderCycle'] = $ininboxAddContactToAutoresponderCycle;
|
365 |
$params['params']['ListIDs'] = array(intval($ininboxGroupList));
|
366 |
$result = Mage::getModel('emailmarketing/ininbox_contact')->add($params);
|
367 |
+
|
368 |
+
if(isset($result['Code']) && isset($result['Message']))
|
369 |
+
{
|
370 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR (' . $result['Code'] . '): ' . $result['Message']);
|
371 |
+
Mage::log($error_message, null, $this->_logFile);
|
372 |
+
}
|
373 |
+
}
|
374 |
+
catch (Exception $e) {
|
375 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR: Error in updating contact in INinbox. <br />' . $e->getMessage());
|
376 |
+
Mage::log($error_message, null, $this->_logFile);
|
377 |
+
}
|
378 |
+
|
379 |
+
return $error_message;
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Use to import contacts on mass action contacts
|
384 |
+
*
|
385 |
+
* @Params
|
386 |
+
* $currentCustomer - customer object for customer details
|
387 |
+
* $ininboxGroupList - group id for which we need to subscribe
|
388 |
+
* $ininboxResubscriber - true or false on resubscribe or not
|
389 |
+
* $ininboxSendConfirmationEmail - true or false on send confirmation or not
|
390 |
+
* $ininboxAddContactToAutoresponderCycle - true or false on add contact to autorespnder cycle or not
|
391 |
+
*/
|
392 |
+
public function importIninboxContact($customersIds, $ininboxGroupList)
|
393 |
+
{
|
394 |
+
try
|
395 |
+
{
|
396 |
+
$ininboxPredefinedCustomFields = Mage::getModel('emailmarketing/system_config_source_field_list')->getPredefinedCustomList();
|
397 |
+
$ininboxMappedCustomFields = unserialize(Mage::helper('emailmarketing')->getConfig($group = 'field_mapping', $field = 'field'));
|
398 |
+
|
399 |
+
// get the settings for mass action miscellaneous section to add customer on mass action
|
400 |
+
$ininboxResubscriber = Mage::helper('emailmarketing')->getConfig($group = 'customer_massaction_settings', $field = 'update_subscriber') ? true : false;
|
401 |
+
$ininboxSendConfirmationEmail = Mage::helper('emailmarketing')->getConfig($group = 'customer_massaction_settings', $field = 'confirm_email') ? true : false;
|
402 |
+
$ininboxAddContactToAutoresponderCycle = Mage::helper('emailmarketing')->getConfig($group = 'customer_massaction_settings', $field = 'send_autoresponder') ? true : false;
|
403 |
+
|
404 |
+
$count = 0;
|
405 |
+
foreach ($customersIds as $customerId)
|
406 |
+
{
|
407 |
+
$currentCustomer = Mage::getModel('customer/customer')->load($customerId);
|
408 |
+
|
409 |
+
$array = array();
|
410 |
+
foreach($ininboxMappedCustomFields as $mappedField)
|
411 |
+
{
|
412 |
+
$customerAttribute = $mappedField['customer_attributes'];
|
413 |
+
$ininboxCustomField = $mappedField['ininbox_custom_fields'];
|
414 |
+
if(array_key_exists($ininboxCustomField, $ininboxPredefinedCustomFields))
|
415 |
+
$array[$ininboxCustomField] = $currentCustomer->getData($customerAttribute);
|
416 |
+
else
|
417 |
+
$array['CustomFields'][] = array('Key' => $ininboxCustomField, 'Value' => $currentCustomer->getData($customerAttribute));
|
418 |
+
}
|
419 |
+
|
420 |
+
$params['params']['Contacts'][$count++] = $array;
|
421 |
+
}
|
422 |
+
$params['params']['Resubscribe'] = $ininboxResubscriber;
|
423 |
+
$params['params']['SendConfirmationEmail'] = $ininboxSendConfirmationEmail;
|
424 |
+
$params['params']['AddContactToAutoresponderCycle'] = $ininboxAddContactToAutoresponderCycle;
|
425 |
+
$params['params']['ListIDs'] = array(intval($ininboxGroupList));
|
426 |
+
|
427 |
+
$result = Mage::getModel('emailmarketing/ininbox_contact')->import($params);
|
428 |
+
|
429 |
+
if(isset($result['Code']) && isset($result['Message']))
|
430 |
+
{
|
431 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR (' . $result['Code'] . '): ' . $result['Message']);
|
432 |
+
Mage::log($error_message, null, $this->_logFile);
|
433 |
+
}
|
434 |
+
}
|
435 |
+
catch (Exception $e) {
|
436 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR: Error in importing contacts to INinbox. <br />' . $e->getMessage());
|
437 |
+
Mage::log($error_message, null, $this->_logFile);
|
438 |
+
}
|
439 |
+
return $error_message;
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* Use to import contacts on mass action newsletter
|
444 |
+
*
|
445 |
+
* @Params
|
446 |
+
* $ininboxCustomerEmail - customer email for subscribtion
|
447 |
+
* $ininboxGroupList - group id for which we need to subscribe
|
448 |
+
* $ininboxResubscriber - true or false on resubscribe or not
|
449 |
+
* $ininboxSendConfirmationEmail - true or false on send confirmation or not
|
450 |
+
* $ininboxAddContactToAutoresponderCycle - true or false on add contact to autorespnder cycle or not
|
451 |
+
*/
|
452 |
+
public function importNewsletterContactGroup($subscribersIds, $ininboxGroupList)
|
453 |
+
{
|
454 |
+
try
|
455 |
+
{
|
456 |
+
$ininboxResubscriber = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_massaction_settings', $field = 'update_subscriber') ? true : false;
|
457 |
+
$ininboxSendConfirmationEmail = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_massaction_settings', $field = 'confirm_email') ? true : false;
|
458 |
+
$ininboxAddContactToAutoresponderCycle = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_massaction_settings', $field = 'send_autoresponder') ? true : false;
|
459 |
+
|
460 |
+
$count = 0;
|
461 |
+
foreach ($subscribersIds as $subscriberId)
|
462 |
+
{
|
463 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->load($subscriberId);
|
464 |
+
$subscribeEmail = $subscriber->getData('subscriber_email');
|
465 |
+
$array['Email'] = $subscribeEmail;
|
466 |
+
$params['params']['Contacts'][$count++] = $array;
|
467 |
+
}
|
468 |
+
|
469 |
+
$params['params']['Resubscribe'] = $ininboxResubscriber;
|
470 |
+
$params['params']['SendConfirmationEmail'] = $ininboxSendConfirmationEmail;
|
471 |
+
$params['params']['AddContactToAutoresponderCycle'] = $ininboxAddContactToAutoresponderCycle;
|
472 |
+
$params['params']['ListIDs'] = array(intval($ininboxGroupList));
|
473 |
+
|
474 |
+
$result = Mage::getModel('emailmarketing/ininbox_contact')->import($params);
|
475 |
+
|
476 |
+
if(isset($result['Code']) && isset($result['Message']))
|
477 |
+
{
|
478 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR (' . $result['Code'] . '): ' . $result['Message']);
|
479 |
+
Mage::log($error_message, null, $this->_logFile);
|
480 |
+
}
|
481 |
+
}
|
482 |
+
catch (Exception $e) {
|
483 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR: Error in importing contacts to INinbox. <br />' . $e->getMessage());
|
484 |
+
Mage::log($error_message, null, $this->_logFile);
|
485 |
+
}
|
486 |
+
|
487 |
+
return $error_message;
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Use to update list on new order place
|
492 |
+
* Here boolean variables varies based on massaction or on single action.
|
493 |
+
*
|
494 |
+
* @Params
|
495 |
+
* $currentOrder - Current order for which you need to subscribe on INinbox
|
496 |
+
* $ininboxGroupList - group id for which we need to subscribe
|
497 |
+
* $ininboxResubscriber - true or false on resubscribe or not
|
498 |
+
* $ininboxSendConfirmationEmail - true or false on send confirmation or not
|
499 |
+
* $ininboxAddContactToAutoresponderCycle - true or false on add contact to autorespnder cycle or not
|
500 |
+
*/
|
501 |
+
public function importIninboxContactForSales($orderIds, $ininboxGroupList)
|
502 |
+
{
|
503 |
+
try
|
504 |
+
{
|
505 |
+
$ininboxPredefinedCustomFields = Mage::getModel('emailmarketing/system_config_source_field_list')->getPredefinedCustomList();
|
506 |
+
$ininboxMappedCustomFields = unserialize(Mage::helper('emailmarketing')->getConfig($group = 'field_mapping', $field = 'field'));
|
507 |
+
|
508 |
+
$ininboxResubscriber = Mage::helper('emailmarketing')->getConfig($group = 'order_massaction_settings', $field = 'update_subscriber') ? true : false;
|
509 |
+
$ininboxSendConfirmationEmail = Mage::helper('emailmarketing')->getConfig($group = 'order_massaction_settings', $field = 'confirm_email') ? true : false;
|
510 |
+
$ininboxAddContactToAutoresponderCycle = Mage::helper('emailmarketing')->getConfig($group = 'order_massaction_settings', $field = 'send_autoresponder') ? true : false;
|
511 |
+
|
512 |
+
$count = 0;
|
513 |
+
foreach ($orderIds as $orderId)
|
514 |
+
{
|
515 |
+
$currentOrder = Mage::getModel('sales/order')->load($orderId);
|
516 |
+
$currentCustomer = $currentOrder->getBillingAddress();
|
517 |
+
|
518 |
+
foreach($ininboxMappedCustomFields as $mappedField)
|
519 |
+
{
|
520 |
+
$customerAttribute = $mappedField['customer_attributes'];
|
521 |
+
if($customerAttribute == 'default_shipping')
|
522 |
+
{
|
523 |
+
$currentCustomer = $currentOrder->getShippingAddress();
|
524 |
+
break;
|
525 |
+
}
|
526 |
+
}
|
527 |
+
|
528 |
+
$array = array();
|
529 |
+
foreach($ininboxMappedCustomFields as $mappedField)
|
530 |
+
{
|
531 |
+
$customerAttribute = $mappedField['customer_attributes'];
|
532 |
+
$ininboxCustomField = $mappedField['ininbox_custom_fields'];
|
533 |
+
if($customerAttribute == 'default_billing' || $customerAttribute == 'default_shipping')
|
534 |
+
{
|
535 |
+
if($ininboxCustomField == 'Address')
|
536 |
+
{
|
537 |
+
$array['Address'] = $currentCustomer->getStreet1() . ' ' . $currentCustomer->getStreet2();
|
538 |
+
$array['CountryCode'] = $currentCustomer->getCountryId();
|
539 |
+
$array['City'] = $currentCustomer->getCity();
|
540 |
+
$array['Zip'] = $currentCustomer->getPostcode();
|
541 |
+
$array['MobilePhone'] = $currentCustomer->getTelephone();
|
542 |
+
$array['Fax'] = $currentCustomer->getFax();
|
543 |
+
}
|
544 |
+
else
|
545 |
+
{
|
546 |
+
if(array_key_exists($ininboxCustomField, $ininboxPredefinedCustomFields))
|
547 |
+
$array[$ininboxCustomField] = $currentCustomer->getStreet1() . ' ' . $currentCustomer->getStreet2();
|
548 |
+
else
|
549 |
+
$array['CustomFields'][] = array('Key' => $ininboxCustomField, 'Value' => ($currentCustomer->getStreet1() . ' ' . $currentCustomer->getStreet2()));
|
550 |
+
}
|
551 |
+
}
|
552 |
+
else
|
553 |
+
{
|
554 |
+
if(array_key_exists($ininboxCustomField, $ininboxPredefinedCustomFields))
|
555 |
+
$array[$ininboxCustomField] = $currentCustomer->getData($customerAttribute);
|
556 |
+
else
|
557 |
+
$array['CustomFields'][] = array('Key' => $ininboxCustomField, 'Value' => $currentCustomer->getData($customerAttribute));
|
558 |
+
}
|
559 |
+
}
|
560 |
+
|
561 |
+
$params['params']['Contacts'][$count++] = $array;
|
562 |
+
}
|
563 |
+
|
564 |
+
$params['params']['Resubscribe'] = $ininboxResubscriber;
|
565 |
+
$params['params']['SendConfirmationEmail'] = $ininboxSendConfirmationEmail;
|
566 |
+
$params['params']['AddContactToAutoresponderCycle'] = $ininboxAddContactToAutoresponderCycle;
|
567 |
+
$params['params']['ListIDs'] = array(intval($ininboxGroupList));
|
568 |
+
|
569 |
+
$result = Mage::getModel('emailmarketing/ininbox_contact')->import($params);
|
570 |
+
|
571 |
+
if(isset($result['Code']) && isset($result['Message']))
|
572 |
+
{
|
573 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR (' . $result['Code'] . '): ' . $result['Message']);
|
574 |
+
Mage::log($error_message, null, $this->_logFile);
|
575 |
+
}
|
576 |
}
|
577 |
catch (Exception $e) {
|
578 |
+
$error_message = Mage::helper('adminhtml')->__('ERROR: Error in importing contacts to INinbox. <br />' . $e->getMessage());
|
579 |
+
Mage::log($error_message, null, $this->_logFile);
|
580 |
+
}
|
581 |
+
|
582 |
+
return $error_message;
|
583 |
+
}
|
584 |
+
|
585 |
+
public function validateIninboxConfig()
|
586 |
+
{
|
587 |
+
if(Mage::helper('emailmarketing')->isEnabled())
|
588 |
+
{
|
589 |
+
$api_url = Mage::helper('emailmarketing')->getConfig($group = 'general', $field = 'url');
|
590 |
+
$api_key = Mage::helper('emailmarketing')->getConfig($group = 'general', $field = 'key');
|
591 |
+
|
592 |
+
$system_date = Mage::getModel('emailmarketing/ininbox_general')->getSystemDateTime($api_url, $api_key);
|
593 |
+
|
594 |
+
if(isset($system_date['Code']) && isset($system_date['Message']))
|
595 |
+
{
|
596 |
+
$message = Mage::helper('adminhtml')->__('ERROR (' . $system_date['Code'] . '): ' . $system_date['Message']);
|
597 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
598 |
+
|
599 |
+
Mage::getConfig()->saveConfig('ininbox_emailmarketing_options/general/key', '');
|
600 |
+
Mage::getConfig()->reinit();
|
601 |
+
Mage::app()->reinitStores();
|
602 |
+
|
603 |
+
$this->message_search('The configuration has been saved.', true, 'adminhtml/session');
|
604 |
+
}
|
605 |
+
else if(is_null($system_date))
|
606 |
+
{
|
607 |
+
$message = Mage::helper('adminhtml')->__('ERROR: Invalid URL or API key.');
|
608 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
609 |
+
|
610 |
+
Mage::getConfig()->saveConfig('ininbox_emailmarketing_options/general/key', '');
|
611 |
+
Mage::getConfig()->reinit();
|
612 |
+
Mage::app()->reinitStores();
|
613 |
+
|
614 |
+
$this->message_search('The configuration has been saved.', true, 'adminhtml/session');
|
615 |
+
}
|
616 |
+
}
|
617 |
+
else
|
618 |
+
{
|
619 |
+
Mage::getConfig()->saveConfig('ininbox_emailmarketing_options/general/key', '');
|
620 |
+
Mage::getConfig()->reinit();
|
621 |
+
Mage::app()->reinitStores();
|
622 |
+
}
|
623 |
+
}
|
624 |
+
|
625 |
+
public function message_search($string, $remove = false, $which = 'core/session' )
|
626 |
+
{
|
627 |
+
$found = false;
|
628 |
+
|
629 |
+
$messages = Mage::getSingleton($which)->getMessages();
|
630 |
+
|
631 |
+
foreach($messages->getItems() as $message)
|
632 |
+
{
|
633 |
+
if(stristr($message->getText(), $string ))
|
634 |
+
{
|
635 |
+
$found = true;
|
636 |
+
if($remove)
|
637 |
+
$message->setIdentifier('this_message_will_be_removed');
|
638 |
+
}
|
639 |
+
if($remove)
|
640 |
+
$messages->deleteMessageByIdentifier('this_message_will_be_removed');
|
641 |
}
|
642 |
+
return $found;
|
643 |
}
|
644 |
}
|
645 |
?>
|
app/code/local/Ininbox/Emailmarketing/Model/System/Config/Source/Field/List.php
CHANGED
@@ -31,9 +31,9 @@ class Ininbox_Emailmarketing_Model_System_Config_Source_Field_List
|
|
31 |
*/
|
32 |
public function toOptionArray()
|
33 |
{
|
34 |
-
$result = $this->_predefinedCustomFields;
|
35 |
|
36 |
-
$data = Mage::getModel('emailmarketing/ininbox_customfield')->getList();
|
37 |
|
38 |
if(!is_null($data))
|
39 |
{
|
31 |
*/
|
32 |
public function toOptionArray()
|
33 |
{
|
34 |
+
$result = $this->_predefinedCustomFields;
|
35 |
|
36 |
+
$data = Mage::getModel('emailmarketing/ininbox_customfield')->getList();
|
37 |
|
38 |
if(!is_null($data))
|
39 |
{
|
app/code/local/Ininbox/Emailmarketing/controllers/Adminhtml/ButtonController.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* INinbox Email Marketing
|
4 |
+
* @category INinbox
|
5 |
+
* @package INinbox_Emailmarketing
|
6 |
+
**/
|
7 |
+
class Ininbox_Emailmarketing_Adminhtml_ButtonController extends Mage_Adminhtml_Controller_Action
|
8 |
+
{
|
9 |
+
public function checkAction()
|
10 |
+
{
|
11 |
+
$data = $this->getRequest()->getParams();
|
12 |
+
|
13 |
+
$system_date = Mage::getModel('emailmarketing/ininbox_general')->getSystemDateTime($data['api_url'], $data['api_key']);
|
14 |
+
/*
|
15 |
+
echo '<pre>';
|
16 |
+
print_r($system_date);
|
17 |
+
echo '</pre>';
|
18 |
+
die('DIED');
|
19 |
+
*/
|
20 |
+
$message = 1;
|
21 |
+
if(isset($system_date['Code']) && isset($system_date['Message']))
|
22 |
+
$message = Mage::helper('adminhtml')->__('ERROR (' . $system_date['Code'] . '): ' . $system_date['Message']);
|
23 |
+
else if(is_null($system_date))
|
24 |
+
$message = Mage::helper('adminhtml')->__('ERROR: Invalid URL or API key.');
|
25 |
+
else
|
26 |
+
{
|
27 |
+
Mage::getConfig()->saveConfig('ininbox_emailmarketing_options/general/enabled', 1);
|
28 |
+
Mage::getConfig()->saveConfig('ininbox_emailmarketing_options/general/url', $data['api_url']);
|
29 |
+
Mage::getConfig()->saveConfig('ininbox_emailmarketing_options/general/key', $data['api_key']);
|
30 |
+
Mage::getConfig()->reinit();
|
31 |
+
Mage::app()->reinitStores();
|
32 |
+
}
|
33 |
+
Mage::app()->getResponse()->setBody($message);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
?>
|
app/code/local/Ininbox/Emailmarketing/controllers/Adminhtml/MassactionController.php
CHANGED
@@ -22,22 +22,20 @@ class Ininbox_Emailmarketing_Adminhtml_MassactionController extends Mage_Adminht
|
|
22 |
{
|
23 |
// Check weather feature is enabled or not and get the INinbox list id for edit.
|
24 |
$isIninboxSendCustomerEnabled = Mage::helper('emailmarketing')->getConfig($group = 'customer_settings', $field = 'send_customer');
|
25 |
-
$ininboxCustomerGroupList = Mage::helper('emailmarketing')->getConfig($group = 'customer_settings', $field = 'customer_group_list');
|
26 |
-
|
27 |
-
// get the settings for mass action miscellaneous section to add customer on mass action
|
28 |
-
$ininboxResubscriber = Mage::helper('emailmarketing')->getConfig($group = 'customer_massaction_settings', $field = 'update_subscriber') ? true : false;
|
29 |
-
$ininboxSendConfirmationEmail = Mage::helper('emailmarketing')->getConfig($group = 'customer_massaction_settings', $field = 'confirm_email') ? true : false;
|
30 |
-
$ininboxAddContactToAutoresponderCycle = Mage::helper('emailmarketing')->getConfig($group = 'customer_massaction_settings', $field = 'send_autoresponder') ? true : false;
|
31 |
|
32 |
if($isIninboxSendCustomerEnabled && !is_null($ininboxCustomerGroupList))
|
33 |
{
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(
|
39 |
-
Mage::helper('adminhtml')->__('Total of %d record(s) were added.', count($customersIds))
|
40 |
-
);
|
41 |
}
|
42 |
}
|
43 |
} catch (Exception $e) {
|
@@ -62,22 +60,20 @@ class Ininbox_Emailmarketing_Adminhtml_MassactionController extends Mage_Adminht
|
|
62 |
if(Mage::helper('emailmarketing')->isEnabled())
|
63 |
{
|
64 |
$isIninboxSendSubscriberEnabled = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_settings', $field = 'send_subscriber');
|
65 |
-
$ininboxSubscriberGroupList = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_settings', $field = 'subscriber_group_list');
|
66 |
-
|
67 |
-
$ininboxResubscriber = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_massaction_settings', $field = 'update_subscriber') ? true : false;
|
68 |
-
$ininboxSendConfirmationEmail = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_massaction_settings', $field = 'confirm_email') ? true : false;
|
69 |
-
$ininboxAddContactToAutoresponderCycle = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_massaction_settings', $field = 'send_autoresponder') ? true : false;
|
70 |
|
71 |
if($isIninboxSendSubscriberEnabled && !is_null($ininboxSubscriberGroupList))
|
72 |
-
{
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
Mage::
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
-
Mage::getSingleton('adminhtml/session')->addSuccess(
|
79 |
-
Mage::helper('adminhtml')->__('Total of %d record(s) were added.', count($subscribersIds))
|
80 |
-
);
|
81 |
}
|
82 |
}
|
83 |
} catch (Exception $e) {
|
@@ -102,21 +98,20 @@ class Ininbox_Emailmarketing_Adminhtml_MassactionController extends Mage_Adminht
|
|
102 |
if(Mage::helper('emailmarketing')->isEnabled())
|
103 |
{
|
104 |
$isIninboxSendOrderEnabled = Mage::helper('emailmarketing')->getConfig($group = 'order_settings', $field = 'send_order');
|
105 |
-
$ininboxOrderGroupList = Mage::helper('emailmarketing')->getConfig($group = 'order_settings', $field = 'order_group_list');
|
106 |
-
|
107 |
-
$ininboxResubscriber = Mage::helper('emailmarketing')->getConfig($group = 'order_massaction_settings', $field = 'update_subscriber') ? true : false;
|
108 |
-
$ininboxSendConfirmationEmail = Mage::helper('emailmarketing')->getConfig($group = 'order_massaction_settings', $field = 'confirm_email') ? true : false;
|
109 |
-
$ininboxAddContactToAutoresponderCycle = Mage::helper('emailmarketing')->getConfig($group = 'order_massaction_settings', $field = 'send_autoresponder') ? true : false;
|
110 |
|
111 |
if($isIninboxSendOrderEnabled && !is_null($ininboxOrderGroupList))
|
112 |
-
{
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
120 |
}
|
121 |
}
|
122 |
} catch (Exception $e) {
|
22 |
{
|
23 |
// Check weather feature is enabled or not and get the INinbox list id for edit.
|
24 |
$isIninboxSendCustomerEnabled = Mage::helper('emailmarketing')->getConfig($group = 'customer_settings', $field = 'send_customer');
|
25 |
+
$ininboxCustomerGroupList = Mage::helper('emailmarketing')->getConfig($group = 'customer_settings', $field = 'customer_group_list');
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
if($isIninboxSendCustomerEnabled && !is_null($ininboxCustomerGroupList))
|
28 |
{
|
29 |
+
$message = Mage::getModel('emailmarketing/observer')->importIninboxContact($customersIds, $ininboxCustomerGroupList);
|
30 |
+
|
31 |
+
if(isset($message) && $message != '')
|
32 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
33 |
+
else
|
34 |
+
{
|
35 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
36 |
+
Mage::helper('adminhtml')->__('Total of %d record(s) were added.', count($customersIds))
|
37 |
+
);
|
38 |
}
|
|
|
|
|
|
|
39 |
}
|
40 |
}
|
41 |
} catch (Exception $e) {
|
60 |
if(Mage::helper('emailmarketing')->isEnabled())
|
61 |
{
|
62 |
$isIninboxSendSubscriberEnabled = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_settings', $field = 'send_subscriber');
|
63 |
+
$ininboxSubscriberGroupList = Mage::helper('emailmarketing')->getConfig($group = 'newsletter_settings', $field = 'subscriber_group_list');
|
|
|
|
|
|
|
|
|
64 |
|
65 |
if($isIninboxSendSubscriberEnabled && !is_null($ininboxSubscriberGroupList))
|
66 |
+
{
|
67 |
+
$message = Mage::getModel('emailmarketing/observer')->importNewsletterContactGroup($subscribersIds, $ininboxSubscriberGroupList);
|
68 |
+
|
69 |
+
if(isset($message) && $message != '')
|
70 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
71 |
+
else
|
72 |
+
{
|
73 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
74 |
+
Mage::helper('adminhtml')->__('Total of %d record(s) were added.', count($subscribersIds))
|
75 |
+
);
|
76 |
}
|
|
|
|
|
|
|
77 |
}
|
78 |
}
|
79 |
} catch (Exception $e) {
|
98 |
if(Mage::helper('emailmarketing')->isEnabled())
|
99 |
{
|
100 |
$isIninboxSendOrderEnabled = Mage::helper('emailmarketing')->getConfig($group = 'order_settings', $field = 'send_order');
|
101 |
+
$ininboxOrderGroupList = Mage::helper('emailmarketing')->getConfig($group = 'order_settings', $field = 'order_group_list');
|
|
|
|
|
|
|
|
|
102 |
|
103 |
if($isIninboxSendOrderEnabled && !is_null($ininboxOrderGroupList))
|
104 |
+
{
|
105 |
+
$message = Mage::getModel('emailmarketing/observer')->importIninboxContactForSales($orderIds, $ininboxOrderGroupList);
|
106 |
+
|
107 |
+
if(isset($message) && $message != '')
|
108 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
109 |
+
else
|
110 |
+
{
|
111 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
112 |
+
Mage::helper('adminhtml')->__('Total of %d record(s) were added.', count($orderIds))
|
113 |
+
);
|
114 |
+
}
|
115 |
}
|
116 |
}
|
117 |
} catch (Exception $e) {
|
app/code/local/Ininbox/Emailmarketing/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Ininbox_Emailmarketing>
|
5 |
-
<version>1.2.
|
6 |
</Ininbox_Emailmarketing>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -11,7 +11,7 @@
|
|
11 |
<use>standard</use>
|
12 |
<args>
|
13 |
<module>Ininbox_Emailmarketing</module>
|
14 |
-
<frontName>
|
15 |
</args>
|
16 |
</emailmarketing>
|
17 |
<newsletter>
|
@@ -37,7 +37,7 @@
|
|
37 |
<use>admin</use>
|
38 |
<args>
|
39 |
<module>Ininbox_Emailmarketing</module>
|
40 |
-
<frontName>
|
41 |
</args>
|
42 |
</emailmarketing>
|
43 |
<adminhtml>
|
@@ -157,6 +157,15 @@
|
|
157 |
</Ininbox_Emailmarketing_Model_Observer>
|
158 |
</observers>
|
159 |
</customer_newsletter_subscribe_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
</events>
|
161 |
</global>
|
162 |
<adminhtml>
|
@@ -167,7 +176,7 @@
|
|
167 |
<children>
|
168 |
<emailmarketing>
|
169 |
<title>Email Marketing Settings</title>
|
170 |
-
<action>adminhtml/system_config/edit/section/
|
171 |
</emailmarketing>
|
172 |
<ininboxlogin>
|
173 |
<title>INinbox Login</title>
|
@@ -186,9 +195,9 @@
|
|
186 |
<children>
|
187 |
<config>
|
188 |
<children>
|
189 |
-
<
|
190 |
<title>Email Marketing Module Section</title>
|
191 |
-
</
|
192 |
</children>
|
193 |
</config>
|
194 |
</children>
|
@@ -197,12 +206,19 @@
|
|
197 |
</admin>
|
198 |
</resources>
|
199 |
</acl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
</adminhtml>
|
201 |
<default>
|
202 |
-
<
|
203 |
<general>
|
204 |
<url>http://api.ininbox.com/v1/</url>
|
205 |
</general>
|
206 |
-
</
|
207 |
</default>
|
208 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Ininbox_Emailmarketing>
|
5 |
+
<version>1.2.2</version>
|
6 |
</Ininbox_Emailmarketing>
|
7 |
</modules>
|
8 |
<frontend>
|
11 |
<use>standard</use>
|
12 |
<args>
|
13 |
<module>Ininbox_Emailmarketing</module>
|
14 |
+
<frontName>ininbox_emailmarketing</frontName>
|
15 |
</args>
|
16 |
</emailmarketing>
|
17 |
<newsletter>
|
37 |
<use>admin</use>
|
38 |
<args>
|
39 |
<module>Ininbox_Emailmarketing</module>
|
40 |
+
<frontName>admin_ininbox_emailmarketing</frontName>
|
41 |
</args>
|
42 |
</emailmarketing>
|
43 |
<adminhtml>
|
157 |
</Ininbox_Emailmarketing_Model_Observer>
|
158 |
</observers>
|
159 |
</customer_newsletter_subscribe_after>
|
160 |
+
<admin_system_config_changed_section_ininbox_emailmarketing_options>
|
161 |
+
<observers>
|
162 |
+
<Ininbox_Emailmarketing_Model_Observer>
|
163 |
+
<type>singleton</type>
|
164 |
+
<class>Ininbox_Emailmarketing_Model_Observer</class>
|
165 |
+
<method>validateIninboxConfig</method>
|
166 |
+
</Ininbox_Emailmarketing_Model_Observer>
|
167 |
+
</observers>
|
168 |
+
</admin_system_config_changed_section_ininbox_emailmarketing_options>
|
169 |
</events>
|
170 |
</global>
|
171 |
<adminhtml>
|
176 |
<children>
|
177 |
<emailmarketing>
|
178 |
<title>Email Marketing Settings</title>
|
179 |
+
<action>adminhtml/system_config/edit/section/ininbox_emailmarketing_options</action>
|
180 |
</emailmarketing>
|
181 |
<ininboxlogin>
|
182 |
<title>INinbox Login</title>
|
195 |
<children>
|
196 |
<config>
|
197 |
<children>
|
198 |
+
<ininbox_emailmarketing_options>
|
199 |
<title>Email Marketing Module Section</title>
|
200 |
+
</ininbox_emailmarketing_options>
|
201 |
</children>
|
202 |
</config>
|
203 |
</children>
|
206 |
</admin>
|
207 |
</resources>
|
208 |
</acl>
|
209 |
+
<layout>
|
210 |
+
<updates>
|
211 |
+
<mobilecase>
|
212 |
+
<file>ininbox.xml</file>
|
213 |
+
</mobilecase>
|
214 |
+
</updates>
|
215 |
+
</layout>
|
216 |
</adminhtml>
|
217 |
<default>
|
218 |
+
<ininbox_emailmarketing_options>
|
219 |
<general>
|
220 |
<url>http://api.ininbox.com/v1/</url>
|
221 |
</general>
|
222 |
+
</ininbox_emailmarketing_options>
|
223 |
</default>
|
224 |
</config>
|
app/code/local/Ininbox/Emailmarketing/etc/system.xml
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<sections>
|
4 |
-
<
|
5 |
<class>separator-top</class>
|
6 |
<tab>customer</tab>
|
7 |
-
<label><![CDATA[<span id="ininbox_tab_options">Email Marketing</span><script>if($('ininbox_tab_options').up().hasClassName('active')) $('ininbox_tab_options').up().setStyle('background:#666;color:#fff;'); else $('ininbox_tab_options').up().setStyle('background:#333;color:#fff;')
|
8 |
<sort_order>700</sort_order>
|
9 |
<show_in_default>1</show_in_default>
|
10 |
<show_in_website>1</show_in_website>
|
@@ -18,27 +18,7 @@
|
|
18 |
<fields>
|
19 |
<enabled translate="label">
|
20 |
<label>Enabled: </label>
|
21 |
-
<comment>
|
22 |
-
Select 'YES' will enable this extension for this Magento Store.
|
23 |
-
<![CDATA[
|
24 |
-
<script type="text/javascript">
|
25 |
-
checkGeneralConfig = function() {
|
26 |
-
var emailmarketing_enabled = $('emailmarketing_options_general_enabled').getValue();
|
27 |
-
var emailmarketing_url = $('emailmarketing_options_general_url').getValue();
|
28 |
-
var emailmarketing_key = $('emailmarketing_options_general_key').getValue();
|
29 |
-
if(emailmarketing_enabled == 0 || emailmarketing_url == '' || emailmarketing_key == '')
|
30 |
-
{
|
31 |
-
$('emailmarketing_options_list').up().hide();
|
32 |
-
$('emailmarketing_options_miscellaneous').up().hide();
|
33 |
-
$('emailmarketing_options_field_mapping').up().hide();
|
34 |
-
}
|
35 |
-
}
|
36 |
-
Event.observe(window, 'load', function() {
|
37 |
-
checkGeneralConfig();
|
38 |
-
})
|
39 |
-
</script>
|
40 |
-
]]>
|
41 |
-
</comment>
|
42 |
<frontend_type>select</frontend_type>
|
43 |
<sort_order>1</sort_order>
|
44 |
<show_in_default>1</show_in_default>
|
@@ -53,6 +33,7 @@
|
|
53 |
<sort_order>2</sort_order>
|
54 |
<show_in_default>1</show_in_default>
|
55 |
<show_in_website>1</show_in_website>
|
|
|
56 |
<depends>
|
57 |
<enabled>1</enabled>
|
58 |
</depends>
|
@@ -64,10 +45,20 @@
|
|
64 |
<sort_order>3</sort_order>
|
65 |
<show_in_default>1</show_in_default>
|
66 |
<show_in_website>1</show_in_website>
|
|
|
67 |
<depends>
|
68 |
<enabled>1</enabled>
|
69 |
</depends>
|
70 |
</key>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
</fields>
|
72 |
</general>
|
73 |
<customer_settings translate="label">
|
@@ -399,6 +390,6 @@
|
|
399 |
</fields>
|
400 |
</field_mapping>
|
401 |
</groups>
|
402 |
-
</
|
403 |
</sections>
|
404 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<sections>
|
4 |
+
<ininbox_emailmarketing_options translate="label" module="emailmarketing">
|
5 |
<class>separator-top</class>
|
6 |
<tab>customer</tab>
|
7 |
+
<label><![CDATA[<span id="ininbox_tab_options">Email Marketing</span><script>if($('ininbox_tab_options').up().hasClassName('active')) $('ininbox_tab_options').up().setStyle('background:#666;color:#fff;'); else $('ininbox_tab_options').up().setStyle('background:#333;color:#fff;');</script>]]></label>
|
8 |
<sort_order>700</sort_order>
|
9 |
<show_in_default>1</show_in_default>
|
10 |
<show_in_website>1</show_in_website>
|
18 |
<fields>
|
19 |
<enabled translate="label">
|
20 |
<label>Enabled: </label>
|
21 |
+
<comment>Select 'YES' will enable this extension for this Magento Store.</comment>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
<frontend_type>select</frontend_type>
|
23 |
<sort_order>1</sort_order>
|
24 |
<show_in_default>1</show_in_default>
|
33 |
<sort_order>2</sort_order>
|
34 |
<show_in_default>1</show_in_default>
|
35 |
<show_in_website>1</show_in_website>
|
36 |
+
<validate>required-entry</validate>
|
37 |
<depends>
|
38 |
<enabled>1</enabled>
|
39 |
</depends>
|
45 |
<sort_order>3</sort_order>
|
46 |
<show_in_default>1</show_in_default>
|
47 |
<show_in_website>1</show_in_website>
|
48 |
+
<validate>required-entry</validate>
|
49 |
<depends>
|
50 |
<enabled>1</enabled>
|
51 |
</depends>
|
52 |
</key>
|
53 |
+
<connect translate="label">
|
54 |
+
<label> </label>
|
55 |
+
<frontend_type>button</frontend_type>
|
56 |
+
<frontend_model>emailmarketing/adminhtml_system_config_form_button</frontend_model>
|
57 |
+
<sort_order>4</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</connect>
|
62 |
</fields>
|
63 |
</general>
|
64 |
<customer_settings translate="label">
|
390 |
</fields>
|
391 |
</field_mapping>
|
392 |
</groups>
|
393 |
+
</ininbox_emailmarketing_options>
|
394 |
</sections>
|
395 |
</config>
|
app/code/local/Ininbox/Emailmarketing/sql/emailmarketing_setup/mysql4-upgrade-0.1.0-1.2.1.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* INinbox Email Marketing
|
4 |
+
* @category INinbox
|
5 |
+
* @package INinbox_Emailmarketing
|
6 |
+
**/
|
7 |
+
$installer = $this;
|
8 |
+
$installer->startSetup();
|
9 |
+
|
10 |
+
$DefaultValues = array(array('customer_attributes' => 'email', 'ininbox_custom_fields' => 'Email'));
|
11 |
+
$DefaultValues = serialize($DefaultValues);
|
12 |
+
Mage::getConfig()->saveConfig('ininbox_emailmarketing_options/field_mapping/field', $DefaultValues);
|
13 |
+
Mage::getConfig()->reinit();
|
14 |
+
Mage::app()->reinitStores();
|
15 |
+
|
16 |
+
$installer->endSetup();
|
17 |
+
?>
|
app/design/adminhtml/default/default/layout/ininbox.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout>
|
2 |
+
<default>
|
3 |
+
<reference name="head">
|
4 |
+
<action method="addItem">
|
5 |
+
<type>skin_css</type>
|
6 |
+
<name>ininbox/css/ininbox.css</name>
|
7 |
+
</action>
|
8 |
+
<action method="addCss"><name>ininbox/css/ininbox.css</name></action>
|
9 |
+
</reference>
|
10 |
+
</default>
|
11 |
+
</layout>
|
app/design/adminhtml/default/default/template/ininbox/system/config/button.phtml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">
|
2 |
+
//<![CDATA[
|
3 |
+
Event.observe(window, "load", function(){
|
4 |
+
$("ininbox_connect_button").up().next().hide();
|
5 |
+
hideShowPanels(false);
|
6 |
+
ajaxCall(true);
|
7 |
+
});
|
8 |
+
|
9 |
+
function check()
|
10 |
+
{
|
11 |
+
ajaxCall(false);
|
12 |
+
}
|
13 |
+
|
14 |
+
function ajaxCall(onload)
|
15 |
+
{
|
16 |
+
var emailmarketing_enabled = $('ininbox_emailmarketing_options_general_enabled').getValue();
|
17 |
+
var emailmarketing_url = $('ininbox_emailmarketing_options_general_url').getValue();
|
18 |
+
var emailmarketing_key = $('ininbox_emailmarketing_options_general_key').getValue();
|
19 |
+
|
20 |
+
if(emailmarketing_enabled != 0 && emailmarketing_url != '' && emailmarketing_key != '')
|
21 |
+
{
|
22 |
+
$('ininbox_connect_button').addClassName('disabled').setAttribute('disabled', 'disabled');;
|
23 |
+
|
24 |
+
new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
|
25 |
+
method: 'post',
|
26 |
+
parameters: 'api_url=' + emailmarketing_url + '&api_key=' + emailmarketing_key,
|
27 |
+
onSuccess: function(transport){
|
28 |
+
if (transport.responseText){
|
29 |
+
if(transport.responseText == 1)
|
30 |
+
{
|
31 |
+
if(onload)
|
32 |
+
hideShowPanels(true)
|
33 |
+
else
|
34 |
+
window.location.href = '<?php $this->getConfigUrl() ?>';
|
35 |
+
}
|
36 |
+
else if(!onload)
|
37 |
+
{
|
38 |
+
hideShowPanels(false);
|
39 |
+
$('ininbox_emailmarketing_options_general_key').setValue('');
|
40 |
+
alert(transport.responseText);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
$('ininbox_connect_button').removeClassName('disabled').removeAttribute('disabled');
|
45 |
+
}
|
46 |
+
});
|
47 |
+
}
|
48 |
+
else if(!onload)
|
49 |
+
alert('Please enter proper details. ');
|
50 |
+
}
|
51 |
+
|
52 |
+
function hideShowPanels(show)
|
53 |
+
{
|
54 |
+
var display = show ? '' : 'none';
|
55 |
+
$('ininbox_emailmarketing_options_customer_settings').setStyle({display: display});
|
56 |
+
$('ininbox_emailmarketing_options_customer_settings-head').up().setStyle({display: display});
|
57 |
+
|
58 |
+
$('ininbox_emailmarketing_options_customer_misc_settings').setStyle({display: display});
|
59 |
+
$('ininbox_emailmarketing_options_customer_misc_settings-head').up().setStyle({display: display});
|
60 |
+
|
61 |
+
$('ininbox_emailmarketing_options_customer_massaction_settings').setStyle({display: display});
|
62 |
+
$('ininbox_emailmarketing_options_customer_massaction_settings-head').up().setStyle({display: display});
|
63 |
+
|
64 |
+
$('ininbox_emailmarketing_options_order_settings').setStyle({display: display});
|
65 |
+
$('ininbox_emailmarketing_options_order_settings-head').up().setStyle({display: display});
|
66 |
+
|
67 |
+
$('ininbox_emailmarketing_options_order_misc_settings').setStyle({display: display});
|
68 |
+
$('ininbox_emailmarketing_options_order_misc_settings-head').up().setStyle({display: display});
|
69 |
+
|
70 |
+
$('ininbox_emailmarketing_options_order_massaction_settings').setStyle({display: display});
|
71 |
+
$('ininbox_emailmarketing_options_order_massaction_settings-head').up().setStyle({display: display});
|
72 |
+
|
73 |
+
$('ininbox_emailmarketing_options_newsletter_settings').setStyle({display: display});
|
74 |
+
$('ininbox_emailmarketing_options_newsletter_settings-head').up().setStyle({display: display});
|
75 |
+
|
76 |
+
$('ininbox_emailmarketing_options_newsletter_misc_settings').setStyle({display: display});
|
77 |
+
$('ininbox_emailmarketing_options_newsletter_misc_settings-head').up().setStyle({display: display});
|
78 |
+
|
79 |
+
$('ininbox_emailmarketing_options_newsletter_massaction_settings').setStyle({display: display});
|
80 |
+
$('ininbox_emailmarketing_options_newsletter_massaction_settings-head').up().setStyle({display: display});
|
81 |
+
|
82 |
+
$('ininbox_emailmarketing_options_field_mapping').setStyle({display: display});
|
83 |
+
$('ininbox_emailmarketing_options_field_mapping-head').up().setStyle({display: display});
|
84 |
+
}
|
85 |
+
//]]>
|
86 |
+
</script>
|
87 |
+
|
88 |
+
<?php echo $this->getButtonHtml() ?>
|
package.xml
CHANGED
@@ -1,27 +1,53 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>INinbox_Emailmarketing</name>
|
4 |
-
<version>1.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
<compatible/>
|
26 |
-
<dependencies><required><php><min>5.
|
27 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>INinbox_Emailmarketing</name>
|
4 |
+
<version>1.2.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Sync your subscribers, customers & orders to an email list of choice and follow up with beautiful newsletters!</summary>
|
10 |
+
<description><strong>What INinbox does?</strong><br />
|
11 |
+
INinbox gives you one central online dashboard where you can send all your marketing emails. And with every email, INinbox shows you real-time statistics like open rates, click rates, spam rates, and much more. At the same time, our entire email platform is designed to get your emails where they belong, IN the inbox.<br />
|
12 |
+
 <br />
|
13 |
+
Since the spam policies of big email platforms like Gmail and Hotmail are getting more and more strict, it might happen that your well-intended marketing emails end up in the spambox.<br />
|
14 |
+
 <br />
|
15 |
+
Where other email providers give you little or no feedback, our Inspired Support Team will help you personally to optimize your email to get your emails in the inbox.<br />
|
16 |
+
 <br />
|
17 |
+
<strong>Benefits of INinbox:</strong><br />
|
18 |
+
√ Send beautiful marketing emails in bulk<br />
|
19 |
+
√ Create multiple email lists<br />
|
20 |
+
√ Easily upload your current email subscribers<br />
|
21 |
+
√ Beautiful email statistics like opens, clicks, bounces, and spam rates<br />
|
22 |
+
√ Optimized so emails will end up IN the inbox, not in the spam folder<br />
|
23 |
+
√ Integrate your favorite business apps in just a few clicks<br />
|
24 |
+
 <br />
|
25 |
+
<strong>How does this FREE Magento Extension help you?</strong><br />
|
26 |
+
This Magento extension connects your Magento webshop with INinbox to easily sync your customers and subscribers to an email list of your choice. This allows you to automatically build powerful relationships by sending beautiful email newsletters.<br />
|
27 |
+
 <br />
|
28 |
+
<strong>The INinbox Extension for Magento helps you:</strong><br />
|
29 |
+
√ Sync new subscribers from Magento in real-time to a list of choice<br />
|
30 |
+
√ Sync new customer details from Magento in real-time to a list of choice<br />
|
31 |
+
√ Sync your order details from Magento in real-time to a list of choice<br />
|
32 |
+
√ Sync extra contact data, like company, gender, country and even custom fields<br />
|
33 |
+
√ Supports single and double opt-in emails<br />
|
34 |
+
√ Supports syncing to multiple lists<br />
|
35 |
+
√ Update existing contacts during syncing (yes/no)<br />
|
36 |
+
√ Send confirmation email for double optin lists (yes/no)<br />
|
37 |
+
√ Add contacts to your autoresponder cycle (yes/no)<br />
|
38 |
+
√ Mass actions to export existing subscribers, customers & orders to a list of choice<br />
|
39 |
+
 <br />
|
40 |
+
You can create your free INinbox account today <a href="https://www.ininbox.com/free-sign-up.html">here</a> with no risks and no commitments. By signing up you can start sending emails within a few minutes.<br />
|
41 |
+
<br />
|
42 |
+
<strong>Is there support available for this Extension?</strong><br />
|
43 |
+
This is an official INinbox extension. If you need support you can contact INspired support here <a href="http://www.INinbox.com/support">http://www.INinbox.com/support</a></description>
|
44 |
+
<notes>1) Set API Key as required field.
|
45 |
+
2) Connect button to check if API key entered is correct or not.
|
46 |
+
3) Changed API call for Mass Action</notes>
|
47 |
+
<authors><author><name>INinbox.com</name><user>INinbox</user><email>inspiredsupport@ininbox.com</email></author></authors>
|
48 |
+
<date>2014-04-10</date>
|
49 |
+
<time>12:42:27</time>
|
50 |
+
<contents><target name="magelocal"><dir name="Ininbox"><dir name="Emailmarketing"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><file name="Grid.php" hash="86d1a54eae6be39062ba283dded1fc74"/></dir><file name="Menu.php" hash="d4392133285bca70425219a11ca073e0"/><dir name="Newsletter"><dir name="Subscriber"><file name="Grid.php" hash="181d4c1264cec1046c3fce78959fd170"/></dir></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="26bb2b0670797ad9f00313efd3a40c6d"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="0ddf67423a255dea6607235a54491ff6"/></dir></dir></dir></dir><file name="Field.php" hash="beed8fad3c2700554d81d56b06f2b84f"/><file name="Select.php" hash="d116f5d18322d15def9f41416c489cc9"/></dir><dir name="Helper"><file name="Data.php" hash="5527375ebf9d821f021568c75ff6a10e"/></dir><dir name="Model"><dir name="Ininbox"><file name="Base.php" hash="2d2217079b82973ab6dd5d5622e3693b"/><file name="Contact.php" hash="5d85cf8a8fa36059685f9b27721e7dbb"/><file name="Customfield.php" hash="03cc50ad57bef11548762bee41425361"/><file name="General.php" hash="84be3f680d5050f89f6fd8a5225c0a41"/><file name="Group.php" hash="901d6a5a34c3ef49b7ab518eb276d0bd"/><file name=".goutputstream-QK2YCX" hash="dd0eae4a36ed0679651000ed78636cd9"/></dir><file name="Observer.php" hash="eaf32e775c73de69267262da3562d725"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Customer"><file name="Attribute.php" hash="b087317b0ec0479bb06b6f5492ec2ea3"/></dir><dir name="Field"><file name="List.php" hash="d47b67045c04f12ef5a1caae7aabb2ac"/></dir><dir name="Group"><file name="List.php" hash="ecbc9d7c8ead7301616570025761957f"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AccountController.php" hash="7ef76d434c3f9a29724ec53176ac06f4"/><dir name="Adminhtml"><file name="ButtonController.php" hash="afabf8082be3321a7075418dd6b61fea"/><file name="CustomerController.php" hash="f55eda498c79e532f931b2b6a25f2c1f"/><file name="MassactionController.php" hash="da21c48b46a5445287741c0ab0846c51"/></dir><file name="ManageController.php" hash="a1afb00c33151ca164ce6a69d08d276f"/><file name="SubscriberController.php" hash="c1ccc8f3c75be9de1f3b2e26a7f730c8"/></dir><dir name="etc"><file name="config.xml" hash="68ac7bc58cbbbe58306d799b6ca847a6"/><file name="system.xml" hash="80f6ffd39392066affd0d68b8732811f"/></dir><dir name="sql"><dir name="emailmarketing_setup"><file name="mysql4-install-0.1.0.php" hash="90441bd504fcde8f0a292e53385ccd53"/><file name="mysql4-upgrade-0.1.0-1.2.1.php" hash="e8b63f7abfe1f414357a630def284140"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ininbox_Emailmarketing.xml" hash="ad90bc3dde0b7f34463702f9e8e8041d"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="ininbox"><dir name="css"><file name="ininbox.css" hash="f3bcef1095d4657aa830aa43e0d3d815"/></dir><dir name="images"><file name="ininbox.png" hash="ad2cecd7c657e4bd2c6d9f99f60389d2"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ininbox.xml" hash="eab17d72e6cf575936bdf69d34153f20"/></dir><dir name="template"><dir name="ininbox"><dir name="system"><dir name="config"><file name="button.phtml" hash="d4b6d99bf1b6179d123442ec530d208f"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
51 |
<compatible/>
|
52 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
53 |
</package>
|
skin/adminhtml/default/default/ininbox/css/ininbox.css
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ininbox_tab_options {
|
2 |
+
background-image: url("../images/ininbox.png");
|
3 |
+
padding: 1px 0px 0px 68px;
|
4 |
+
background-color: transparent;
|
5 |
+
background-size: 62px 14px;
|
6 |
+
background-position: 0px 2px;
|
7 |
+
background-repeat: no-repeat no-repeat;
|
8 |
+
}
|
skin/adminhtml/default/default/{images/ininbox → ininbox/images}/ininbox.png
RENAMED
File without changes
|