Version Notes
Version 2.0.0 Release Notes
- Added WebsiteID and StoreID data management
- Added Customer custom fields detection
- Multi store support
Download this release
Release Info
| Developer | 4Marketing.it |
| Extension | 4Dem_Integration_community |
| Version | 2.0.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.0 to 2.0.0
- app/code/community/FourMarketing/FourDem/Block/Adminhtml/{Users.php → FourDem.php} +4 -4
- app/code/community/FourMarketing/FourDem/Block/Adminhtml/{Users → FourDem}/Grid.php +14 -12
- app/code/community/FourMarketing/FourDem/Block/Adminhtml/System/Config/Form/Field/Mapfields.php +3 -4
- app/code/community/FourMarketing/FourDem/Helper/Data.php +15 -6
- app/code/community/FourMarketing/FourDem/Model/FourDem.php +8 -0
- app/code/community/FourMarketing/FourDem/Model/Mysql4/FourDem.php +8 -0
- app/code/community/FourMarketing/FourDem/Model/Mysql4/FourDem/Collection.php +8 -0
- app/code/community/FourMarketing/FourDem/Model/Mysql4/Users.php +0 -8
- app/code/community/FourMarketing/FourDem/Model/Mysql4/Users/Collection.php +0 -8
- app/code/community/FourMarketing/FourDem/Model/Observer.php +475 -273
- app/code/community/FourMarketing/FourDem/Model/System/Config/Source/List.php +3 -3
- app/code/community/FourMarketing/FourDem/Model/Users.php +0 -8
- app/code/community/FourMarketing/FourDem/controllers/Adminhtml/FourDemController.php +196 -0
- app/code/community/FourMarketing/FourDem/controllers/UsersController.php +0 -201
- app/code/community/FourMarketing/FourDem/etc/{adminhtml.xml → adminhtml.old} +3 -3
- app/code/community/FourMarketing/FourDem/etc/config.xml +201 -134
- app/code/community/FourMarketing/FourDem/etc/system.xml +59 -27
- app/code/community/FourMarketing/FourDem/sql/{fourmarketing_fourdem_setup → fourdem_setup}/mysql4-install-0.1.0.php +3 -2
- app/design/adminhtml/default/default/layout/fourdem.xml +8 -0
- app/design/adminhtml/default/default/layout/fourmarketing/fourdem.xml +8 -0
- app/design/frontend/default/default/template/fourdem/subscribe.phtml +36 -0
- package.xml +10 -10
app/code/community/FourMarketing/FourDem/Block/Adminhtml/{Users.php → FourDem.php}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
<?php
|
| 2 |
-
class
|
| 3 |
{
|
| 4 |
public function __construct()
|
| 5 |
{
|
| 6 |
-
$this->_blockGroup = '
|
| 7 |
-
$this->_controller = '
|
| 8 |
$this->_headerText = $this->__('Clienti Sincronizzati');
|
| 9 |
|
| 10 |
$this->_addButton('button_synchronize', array(
|
| 11 |
-
'label' => Mage::helper('fourdem')->__('Sincronizza Magento/
|
| 12 |
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/synchronize') .'\')',
|
| 13 |
'class' => 'remove',
|
| 14 |
));
|
| 1 |
<?php
|
| 2 |
+
class FourMarketing_FourDem_Block_Adminhtml_FourDem extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 3 |
{
|
| 4 |
public function __construct()
|
| 5 |
{
|
| 6 |
+
$this->_blockGroup = 'fourdem';
|
| 7 |
+
$this->_controller = 'adminhtml_fourdem';
|
| 8 |
$this->_headerText = $this->__('Clienti Sincronizzati');
|
| 9 |
|
| 10 |
$this->_addButton('button_synchronize', array(
|
| 11 |
+
'label' => Mage::helper('fourdem')->__('Sincronizza Magento/4Marketing'),
|
| 12 |
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/synchronize') .'\')',
|
| 13 |
'class' => 'remove',
|
| 14 |
));
|
app/code/community/FourMarketing/FourDem/Block/Adminhtml/{Users → FourDem}/Grid.php
RENAMED
|
@@ -1,25 +1,27 @@
|
|
| 1 |
<?php
|
| 2 |
-
class
|
| 3 |
{
|
| 4 |
public function __construct()
|
| 5 |
{
|
| 6 |
parent::__construct();
|
| 7 |
|
| 8 |
-
$this->setDefaultSort('
|
| 9 |
-
$this->setId('
|
| 10 |
$this->setDefaultDir('desc');
|
| 11 |
$this->setSaveParametersInSession(true);
|
| 12 |
}
|
| 13 |
|
| 14 |
protected function _getCollectionClass()
|
| 15 |
{
|
| 16 |
-
return '
|
| 17 |
}
|
| 18 |
|
| 19 |
protected function _prepareCollection()
|
| 20 |
{
|
|
|
|
| 21 |
// Get and set our collection for the grid
|
| 22 |
-
|
|
|
|
| 23 |
$this->setCollection($collection);
|
| 24 |
|
| 25 |
return parent::_prepareCollection();
|
|
@@ -27,39 +29,39 @@ class FourMarketing_FourDem_Block_Adminhtml_Users_Grid extends Mage_Adminhtml_Bl
|
|
| 27 |
|
| 28 |
protected function _prepareColumns()
|
| 29 |
{
|
| 30 |
-
$this->addColumn('
|
| 31 |
array(
|
| 32 |
-
'header'=>
|
| 33 |
'align' =>'right',
|
| 34 |
'width' => '50px',
|
| 35 |
-
'index' => '
|
| 36 |
)
|
| 37 |
);
|
| 38 |
|
| 39 |
$this->addColumn('firstname',
|
| 40 |
array(
|
| 41 |
-
'header'=>
|
| 42 |
'index' => 'firstname'
|
| 43 |
)
|
| 44 |
);
|
| 45 |
|
| 46 |
$this->addColumn('lastname',
|
| 47 |
array(
|
| 48 |
-
'header'=>
|
| 49 |
'index' => 'lastname'
|
| 50 |
)
|
| 51 |
);
|
| 52 |
|
| 53 |
$this->addColumn('email_address',
|
| 54 |
array(
|
| 55 |
-
'header'=>
|
| 56 |
'index' => 'email_address'
|
| 57 |
)
|
| 58 |
);
|
| 59 |
|
| 60 |
$this->addColumn('own_list',
|
| 61 |
array(
|
| 62 |
-
'header' =>
|
| 63 |
'index' => 'own_list'
|
| 64 |
)
|
| 65 |
);
|
| 1 |
<?php
|
| 2 |
+
class FourMarketing_FourDem_Block_Adminhtml_FourDem_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 3 |
{
|
| 4 |
public function __construct()
|
| 5 |
{
|
| 6 |
parent::__construct();
|
| 7 |
|
| 8 |
+
$this->setDefaultSort('fourdem_id');
|
| 9 |
+
$this->setId('fourdemGrid');
|
| 10 |
$this->setDefaultDir('desc');
|
| 11 |
$this->setSaveParametersInSession(true);
|
| 12 |
}
|
| 13 |
|
| 14 |
protected function _getCollectionClass()
|
| 15 |
{
|
| 16 |
+
return 'fourdem/fourdem';
|
| 17 |
}
|
| 18 |
|
| 19 |
protected function _prepareCollection()
|
| 20 |
{
|
| 21 |
+
|
| 22 |
// Get and set our collection for the grid
|
| 23 |
+
//$collection = Mage::getResourceModel($this->_getCollectionClass());
|
| 24 |
+
$collection = Mage::getModel('fourdem/fourdem')->getCollection();
|
| 25 |
$this->setCollection($collection);
|
| 26 |
|
| 27 |
return parent::_prepareCollection();
|
| 29 |
|
| 30 |
protected function _prepareColumns()
|
| 31 |
{
|
| 32 |
+
$this->addColumn('fourdem_id',
|
| 33 |
array(
|
| 34 |
+
'header'=> Mage::helper('fourdem')->__('ID 4MARKETING'),
|
| 35 |
'align' =>'right',
|
| 36 |
'width' => '50px',
|
| 37 |
+
'index' => 'fourdem_id'
|
| 38 |
)
|
| 39 |
);
|
| 40 |
|
| 41 |
$this->addColumn('firstname',
|
| 42 |
array(
|
| 43 |
+
'header'=> Mage::helper('fourdem')->__('Nome Cliente'),
|
| 44 |
'index' => 'firstname'
|
| 45 |
)
|
| 46 |
);
|
| 47 |
|
| 48 |
$this->addColumn('lastname',
|
| 49 |
array(
|
| 50 |
+
'header'=> Mage::helper('fourdem')->__('Cognome Cliente'),
|
| 51 |
'index' => 'lastname'
|
| 52 |
)
|
| 53 |
);
|
| 54 |
|
| 55 |
$this->addColumn('email_address',
|
| 56 |
array(
|
| 57 |
+
'header'=> Mage::helper('fourdem')->__('Email Cliente'),
|
| 58 |
'index' => 'email_address'
|
| 59 |
)
|
| 60 |
);
|
| 61 |
|
| 62 |
$this->addColumn('own_list',
|
| 63 |
array(
|
| 64 |
+
'header' => Mage::helper('fourdem')->__('Lista di Appartenenza'),
|
| 65 |
'index' => 'own_list'
|
| 66 |
)
|
| 67 |
);
|
app/code/community/FourMarketing/FourDem/Block/Adminhtml/System/Config/Form/Field/Mapfields.php
CHANGED
|
@@ -4,16 +4,15 @@
|
|
| 4 |
* System configuration form field renderer for mapping MergeVars fields with Magento
|
| 5 |
* attributes.
|
| 6 |
*
|
| 7 |
-
* @category
|
| 8 |
-
* @package
|
| 9 |
-
* @author
|
| 10 |
*/
|
| 11 |
class FourMarketing_FourDem_Block_Adminhtml_System_Config_Form_Field_Mapfields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
| 12 |
{
|
| 13 |
|
| 14 |
public function __construct()
|
| 15 |
{
|
| 16 |
-
|
| 17 |
$this->addColumn('magento', array(
|
| 18 |
'label' => Mage::helper('fourdem')->__('Magento'),
|
| 19 |
'style' => 'width:120px',
|
| 4 |
* System configuration form field renderer for mapping MergeVars fields with Magento
|
| 5 |
* attributes.
|
| 6 |
*
|
| 7 |
+
* @category DevTrade
|
| 8 |
+
* @package DevTrade_FourDem
|
| 9 |
+
* @author DevTrade Team <devandtrade@devandtrade.it>
|
| 10 |
*/
|
| 11 |
class FourMarketing_FourDem_Block_Adminhtml_System_Config_Form_Field_Mapfields extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
| 12 |
{
|
| 13 |
|
| 14 |
public function __construct()
|
| 15 |
{
|
|
|
|
| 16 |
$this->addColumn('magento', array(
|
| 17 |
'label' => Mage::helper('fourdem')->__('Magento'),
|
| 18 |
'style' => 'width:120px',
|
app/code/community/FourMarketing/FourDem/Helper/Data.php
CHANGED
|
@@ -3,9 +3,9 @@
|
|
| 3 |
/**
|
| 4 |
* Helper - Wrap Connection To 4Marketing
|
| 5 |
*
|
| 6 |
-
* @category
|
| 7 |
-
* @package
|
| 8 |
-
* @author
|
| 9 |
*/
|
| 10 |
class FourMarketing_FourDem_Helper_Data extends Mage_Core_Helper_Abstract
|
| 11 |
{
|
|
@@ -17,11 +17,20 @@ class FourMarketing_FourDem_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 17 |
|
| 18 |
public function __construct()
|
| 19 |
{
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
| 22 |
$params = array(
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
'password' => '&Password='.Mage::getStoreConfig('fourdem/system_access/password')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
);
|
| 26 |
|
| 27 |
$resultJSON = $this->_getRequestApi('User.Login', $params);
|
| 3 |
/**
|
| 4 |
* Helper - Wrap Connection To 4Marketing
|
| 5 |
*
|
| 6 |
+
* @category DevTrade
|
| 7 |
+
* @package DevTrade_FourDem
|
| 8 |
+
* @author DevTrade Team <devandtrade@devandtrade.it>
|
| 9 |
*/
|
| 10 |
class FourMarketing_FourDem_Helper_Data extends Mage_Core_Helper_Abstract
|
| 11 |
{
|
| 17 |
|
| 18 |
public function __construct()
|
| 19 |
{
|
| 20 |
+
|
| 21 |
+
$this->consoleUrl = Mage::getStoreConfig('fourdem/system_access/url_console');
|
| 22 |
+
|
| 23 |
+
//$this->consoleUrl = 'http://mailchef.4dem.it/api.php';
|
| 24 |
+
|
| 25 |
$params = array(
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
'username' => '&Username='.Mage::getStoreConfig('fourdem/system_access/username'),
|
| 29 |
'password' => '&Password='.Mage::getStoreConfig('fourdem/system_access/password')
|
| 30 |
+
/*
|
| 31 |
+
'username' => '&Username=andreabardi',
|
| 32 |
+
'password' => '&Password=andrea'
|
| 33 |
+
*/
|
| 34 |
);
|
| 35 |
|
| 36 |
$resultJSON = $this->_getRequestApi('User.Login', $params);
|
app/code/community/FourMarketing/FourDem/Model/FourDem.php
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class FourMarketing_FourDem_Model_FourDem extends Mage_Core_Model_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function _construct()
|
| 5 |
+
{
|
| 6 |
+
$this->_init('fourdem/fourdem');
|
| 7 |
+
}
|
| 8 |
+
}
|
app/code/community/FourMarketing/FourDem/Model/Mysql4/FourDem.php
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class FourMarketing_FourDem_Model_Mysql4_FourDem extends Mage_Core_Model_Mysql4_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function _construct()
|
| 5 |
+
{
|
| 6 |
+
$this->_init('fourdem/fourdem', 'fourdem_id');
|
| 7 |
+
}
|
| 8 |
+
}
|
app/code/community/FourMarketing/FourDem/Model/Mysql4/FourDem/Collection.php
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class FourMarketing_FourDem_Model_Mysql4_FourDem_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function _construct()
|
| 5 |
+
{
|
| 6 |
+
$this->_init('fourdem/fourdem');
|
| 7 |
+
}
|
| 8 |
+
}
|
app/code/community/FourMarketing/FourDem/Model/Mysql4/Users.php
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class FourMarketing_FourDem_Model_Mysql4_Users extends Mage_Core_Model_Mysql4_Abstract
|
| 3 |
-
{
|
| 4 |
-
protected function _construct()
|
| 5 |
-
{
|
| 6 |
-
$this->_init('fourmarketing_fourdem/users', 'id_fourdem');
|
| 7 |
-
}
|
| 8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/FourMarketing/FourDem/Model/Mysql4/Users/Collection.php
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class FourMarketing_FourDem_Model_Mysql4_Users_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 3 |
-
{
|
| 4 |
-
protected function _construct()
|
| 5 |
-
{
|
| 6 |
-
$this->_init('fourmarketing_fourdem/users');
|
| 7 |
-
}
|
| 8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/FourMarketing/FourDem/Model/Observer.php
CHANGED
|
@@ -3,278 +3,480 @@
|
|
| 3 |
/**
|
| 4 |
* Events Observer Model
|
| 5 |
*
|
| 6 |
-
* @category
|
| 7 |
-
* @package
|
| 8 |
-
* @author
|
| 9 |
*/
|
| 10 |
-
class FourMarketing_FourDem_Model_Observer
|
| 11 |
-
{
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
}
|
| 3 |
/**
|
| 4 |
* Events Observer Model
|
| 5 |
*
|
| 6 |
+
* @category DevTrade
|
| 7 |
+
* @package DevTrade_FourDem
|
| 8 |
+
* @author DevTrade Team <devandtrade@devandtrade.it>
|
| 9 |
*/
|
| 10 |
+
class FourMarketing_FourDem_Model_Observer {
|
| 11 |
+
public function changeSystemConfig(Varien_Event_Observer $observer) {
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* CUSTOM FIELD MODEL IS
|
| 15 |
+
* <firstname translate="comment">
|
| 16 |
+
* <label>Nome</label>
|
| 17 |
+
* <frontend_type>select</frontend_type>
|
| 18 |
+
* <sort_order>1</sort_order>
|
| 19 |
+
* <show_in_default>1</show_in_default>
|
| 20 |
+
* <show_in_website>1</show_in_website>
|
| 21 |
+
* <show_in_store>1</show_in_store>
|
| 22 |
+
* <source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 23 |
+
* </firstname>
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
// get init sections and tabs
|
| 27 |
+
$config = $observer->getConfig ();
|
| 28 |
+
|
| 29 |
+
// get tab 'advanced', change sort order and label
|
| 30 |
+
$advancedTab = $config->getNode ( 'tabs/fourdem_config' );
|
| 31 |
+
$advancedTab->sort_order = 1;
|
| 32 |
+
// $advancedTab->label .= ' (on top TOTAL)';
|
| 33 |
+
|
| 34 |
+
// Get extension custom field section
|
| 35 |
+
$adminCustomFields = $config->getNode ( 'sections/fourdem/groups/fourdem_mapping/fields' );
|
| 36 |
+
$adminFieldsCollection = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->getItems ();
|
| 37 |
+
foreach ( $adminFieldsCollection as $modelField ) {
|
| 38 |
+
$adminFieldsToAddXmlString = '
|
| 39 |
+
<' . $modelField->getAttributeCode () . ' translate="comment">
|
| 40 |
+
<label>' . $modelField->getFrontendLabel () . '</label>
|
| 41 |
+
<frontend_type>select</frontend_type>
|
| 42 |
+
<sort_order>100</sort_order>
|
| 43 |
+
<show_in_default>1</show_in_default>
|
| 44 |
+
<show_in_website>1</show_in_website>
|
| 45 |
+
<show_in_store>1</show_in_store>
|
| 46 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 47 |
+
</' . $modelField->getAttributeCode () . '>';
|
| 48 |
+
// Create an xml formatted string for custom fields to add
|
| 49 |
+
$adminFieldsToAddXml = new Mage_Core_Model_Config_Element ( $adminFieldsToAddXmlString );
|
| 50 |
+
$adminCustomFields->appendChild ( $adminFieldsToAddXml );
|
| 51 |
+
}
|
| 52 |
+
// Create an xml formatted string for custom fields to add
|
| 53 |
+
// $adminFieldsToAddXml = new Mage_Core_Model_Config_Element ( $adminFieldsToAddXmlString );
|
| 54 |
+
|
| 55 |
+
// Append new fields to section
|
| 56 |
+
// $adminCustomFields->appendChild ( $adminFieldsToAddXml );
|
| 57 |
+
|
| 58 |
+
return $this;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Controllo Credenziali inserite dall'utente dal pannello di configurazione
|
| 63 |
+
*
|
| 64 |
+
* @author Raffaele Capasso
|
| 65 |
+
* @version 1.0
|
| 66 |
+
* @copyright Dev And Trade
|
| 67 |
+
*/
|
| 68 |
+
public function check4demConfiguration() {
|
| 69 |
+
try {
|
| 70 |
+
$isEnabled = Mage::getStoreConfig ( 'fourdem/system_access/active' );
|
| 71 |
+
|
| 72 |
+
if ($isEnabled) {
|
| 73 |
+
if (empty ( Mage::helper ( 'fourdem' )->sessionID )) {
|
| 74 |
+
throw new Exception ( 'Nome Utente o Password Errati! Controlla le tue credenziali di accesso.' );
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
return;
|
| 79 |
+
} catch ( Exception $e ) {
|
| 80 |
+
Mage::getSingleton ( 'core/session' )->addError ( $e->getMessage () );
|
| 81 |
+
return;
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* Iscrivo il cliente nella lista "Clienti" durante la registrazione.
|
| 87 |
+
*
|
| 88 |
+
* @author Raffaele Capasso
|
| 89 |
+
* @version 1.0
|
| 90 |
+
* @copyright Dev And Trade
|
| 91 |
+
*/
|
| 92 |
+
public function subscribeCustomer(Varien_Event_Observer $observer) {
|
| 93 |
+
$customer = $observer->getCustomer ();
|
| 94 |
+
$listID = Mage::getStoreConfig ( 'fourdem/system_access/customer_list' );
|
| 95 |
+
$mapFields = Mage::getStoreConfig ( 'fourdem/fourdem_mapping' );
|
| 96 |
+
$email = $customer->getEmail ();
|
| 97 |
+
$ipAddress = $_SERVER ['REMOTE_ADDR'];
|
| 98 |
+
$customFields = array ();
|
| 99 |
+
|
| 100 |
+
foreach ( $mapFields as $label => $customFieldID ) {
|
| 101 |
+
if (! empty ( $customFieldID )) {
|
| 102 |
+
$customerValueField = $customer->getData ( $label );
|
| 103 |
+
// ************************** INIZIO MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 104 |
+
// Step 1 - Verifica se il campo è personalizzato e di tipo select
|
| 105 |
+
$Custom_Var = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->addFieldToFilter ( 'attribute_code', $label )->addFieldToFilter ( 'frontend_input', 'select' )->getItems ();
|
| 106 |
+
// Step 2 - Carica il valore testuale della selezione (il campo contiene l'ID della option selezionata dall'utente
|
| 107 |
+
if (! empty ( $Custom_Var ) && isset ( $Custom_Var )) {
|
| 108 |
+
$customerModel = Mage::getModel ( 'customer/customer' ); /* ->setStoreId ( $modelCustomer->getData ( 'store_id' ) ); */
|
| 109 |
+
$attr = $customerModel->getResource ()->getAttribute ( $label );
|
| 110 |
+
if ($attr->usesSource ()) {
|
| 111 |
+
$currentStore = Mage::app ()->getStore ()->getCode ();
|
| 112 |
+
Mage::app ()->getStore ()->setId ( 0 );
|
| 113 |
+
$billingValueField = $attr->getSource ()->getOptionText ( $billingValueField );
|
| 114 |
+
Mage::app ()->getStore ()->setId ( $currentStore );
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
// ************************** FINE MODIFICA CAMPI PERSONALIZZATI SELECT ************************************
|
| 118 |
+
// Website and WebStore names
|
| 119 |
+
if ($label == "website_id") {
|
| 120 |
+
$customerValueField = Mage::app ()->getWebsite ( $customerValueField )->getName ();
|
| 121 |
+
}
|
| 122 |
+
if ($label == "store_id") {
|
| 123 |
+
$customerValueField = Mage::app ()->getStore ( $customerValueField )->getName ();
|
| 124 |
+
}
|
| 125 |
+
// ----- end ---
|
| 126 |
+
|
| 127 |
+
if (! empty ( $customerValueField )) {
|
| 128 |
+
$key = 'CustomField' . $customFieldID;
|
| 129 |
+
$customFields [$key] = '&CustomField' . $customFieldID . '=' . $customerValueField;
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
Mage::helper ( 'fourdem' )->newSubscriber ( $listID, $email, $ipAddress, $customFields, true, true );
|
| 135 |
+
return;
|
| 136 |
+
}
|
| 137 |
+
public function collectionDataMapping(Varien_Event_Observer $observer) {
|
| 138 |
+
$mapFields = Mage::getStoreConfig ( 'fourdem/fourdem_mapping' );
|
| 139 |
+
$customFields = array ();
|
| 140 |
+
$listID = Mage::getStoreConfig ( 'fourdem/system_access/customer_list' );
|
| 141 |
+
$defaultBillingAddress = $observer->getCustomerAddress ()->getData ();
|
| 142 |
+
$emailCustomer = Mage::getModel ( 'customer/customer' )->load ( $defaultBillingAddress ['parent_id'] )->getEmail ();
|
| 143 |
+
|
| 144 |
+
foreach ( $mapFields as $label => $customFieldID ) {
|
| 145 |
+
if (! empty ( $customFieldID )) {
|
| 146 |
+
$billingValueField = $defaultBillingAddress [$label];
|
| 147 |
+
|
| 148 |
+
// ************************** INIZIO MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 149 |
+
// Step 1 - Verifica se il campo è personalizzato e di tipo select
|
| 150 |
+
$Custom_Var = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->addFieldToFilter ( 'attribute_code', $label )->addFieldToFilter ( 'frontend_input', 'select' )->getItems ();
|
| 151 |
+
// Step 2 - Carica il valore testuale della selezione (il campo contiene l'ID della option selezionata dall'utente
|
| 152 |
+
if (! empty ( $Custom_Var ) && isset ( $Custom_Var )) {
|
| 153 |
+
$customerModel = Mage::getModel ( 'customer/customer' ); /* ->setStoreId ( $modelCustomer->getData ( 'store_id' ) ); */
|
| 154 |
+
$attr = $customerModel->getResource ()->getAttribute ( $label );
|
| 155 |
+
if ($attr->usesSource ()) {
|
| 156 |
+
$currentStore = Mage::app ()->getStore ()->getCode ();
|
| 157 |
+
Mage::app ()->getStore ()->setId ( 0 );
|
| 158 |
+
$billingValueField = $attr->getSource ()->getOptionText ( $billingValueField );
|
| 159 |
+
Mage::app ()->getStore ()->setId ( $currentStore );
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
// ************************** FINE MODIFICA CAMPI PERSONALIZZATI SELECT ************************************
|
| 163 |
+
// Website and WebStore names
|
| 164 |
+
if ($label == "website_id") {
|
| 165 |
+
$billingValueField = Mage::app ()->getWebsite ( $billingValueField )->getName ();
|
| 166 |
+
}
|
| 167 |
+
if ($label == "store_id") {
|
| 168 |
+
$billingValueField = Mage::app ()->getStore ( $billingValueField )->getName ();
|
| 169 |
+
}
|
| 170 |
+
// ----- end ---
|
| 171 |
+
|
| 172 |
+
$key = 'Fields' . $customFieldID;
|
| 173 |
+
$customFields [$key] = '&Fields[CustomField' . $customFieldID . ']=' . $billingValueField;
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
// echo '<pre>'; print_r($customFields); echo '</pre>'; die();
|
| 178 |
+
Mage::helper ( 'fourdem' )->updateSubscriber ( $emailCustomer, $emailCustomer, $listID, $customFields, true );
|
| 179 |
+
return;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/**
|
| 183 |
+
* Cambio le impostazioni date dall'utente inserite nella fase di registrazione.
|
| 184 |
+
*
|
| 185 |
+
* @author Raffaele Capasso
|
| 186 |
+
* @version 1.0
|
| 187 |
+
* @copyright Dev And Trade
|
| 188 |
+
*/
|
| 189 |
+
public function changeSubscribeEmail(Varien_Event_Observer $observer) {
|
| 190 |
+
$mapFields = Mage::getStoreConfig ( 'fourdem/fourdem_mapping' );
|
| 191 |
+
$customFields = array ();
|
| 192 |
+
$oldDataCustomer = $observer->getCustomer ()->getOrigData ();
|
| 193 |
+
$newDataCustomer = $observer->getCustomer ()->getData ();
|
| 194 |
+
|
| 195 |
+
$listID = Mage::getStoreConfig ( 'fourdem/system_access/customer_list' );
|
| 196 |
+
$oldEmailCustomer = $oldDataCustomer ['email'];
|
| 197 |
+
$newEmailCustomer = $newDataCustomer ['email'];
|
| 198 |
+
$customerModel = Mage::getModel ( 'customer/customer' )->load ( $newDataCustomer ['entity_id'] );
|
| 199 |
+
|
| 200 |
+
if (empty ( $oldEmailCustomer )) {
|
| 201 |
+
return;
|
| 202 |
+
$oldEmailCustomer = $newEmailCustomer;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
foreach ( $mapFields as $label => $customFieldID ) {
|
| 206 |
+
if (! empty ( $customFieldID )) {
|
| 207 |
+
$billingValueField = $customerModel->getData ( $label );
|
| 208 |
+
|
| 209 |
+
if (! empty ( $billingValueField )) {
|
| 210 |
+
|
| 211 |
+
// ************************** INIZIO MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 212 |
+
// Step 1 - Verifica se il campo è personalizzato e di tipo select
|
| 213 |
+
$Custom_Var = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->addFieldToFilter ( 'attribute_code', $label )->addFieldToFilter ( 'frontend_input', 'select' )->getItems ();
|
| 214 |
+
// Step 2 - Carica il valore testuale della selezione (il campo contiene l'ID della option selezionata dall'utente
|
| 215 |
+
if (! empty ( $Custom_Var ) && isset ( $Custom_Var )) {
|
| 216 |
+
$customerModel = Mage::getModel ( 'customer/customer' ); /* ->setStoreId ( $modelCustomer->getData ( 'store_id' ) ); */
|
| 217 |
+
$attr = $customerModel->getResource ()->getAttribute ( $label );
|
| 218 |
+
if ($attr->usesSource ()) {
|
| 219 |
+
$currentStore = Mage::app ()->getStore ()->getCode ();
|
| 220 |
+
Mage::app ()->getStore ()->setId ( 0 );
|
| 221 |
+
$billingValueField = $attr->getSource ()->getOptionText ( $billingValueField );
|
| 222 |
+
Mage::app ()->getStore ()->setId ( $currentStore );
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
// ************************** FINE MODIFICA CAMPI PERSONALIZZATI SELECT ************************************
|
| 226 |
+
// Website and WebStore names
|
| 227 |
+
if ($label == "website_id") {
|
| 228 |
+
$billingValueField = Mage::app ()->getWebsite ( $billingValueField )->getName ();
|
| 229 |
+
}
|
| 230 |
+
if ($label == "store_id") {
|
| 231 |
+
$billingValueField = Mage::app ()->getStore ( $billingValueField )->getName ();
|
| 232 |
+
}
|
| 233 |
+
// ----- end ---
|
| 234 |
+
|
| 235 |
+
$key = 'Fields' . $customFieldID;
|
| 236 |
+
$customFields [$key] = '&Fields[CustomField' . $customFieldID . ']=' . $billingValueField;
|
| 237 |
+
} else {
|
| 238 |
+
if (is_object ( $customerModel->getDefaultBillingAddress () )) {
|
| 239 |
+
$billingDefaultAddress = $customerModel->getDefaultBillingAddress ()->getData ();
|
| 240 |
+
$billingValueField = $billingDefaultAddress [$label];
|
| 241 |
+
|
| 242 |
+
// ************************** INIZIO MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 243 |
+
// Step 1 - Verifica se il campo è personalizzato e di tipo select
|
| 244 |
+
$Custom_Var = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->addFieldToFilter ( 'attribute_code', $label )->addFieldToFilter ( 'frontend_input', 'select' )->getItems ();
|
| 245 |
+
// Step 2 - Carica il valore testuale della selezione (il campo contiene l'ID della option selezionata dall'utente
|
| 246 |
+
if (! empty ( $Custom_Var ) && isset ( $Custom_Var )) {
|
| 247 |
+
$customerModel = Mage::getModel ( 'customer/customer' ); /* ->setStoreId ( $modelCustomer->getData ( 'store_id' ) ); */
|
| 248 |
+
$attr = $customerModel->getResource ()->getAttribute ( $label );
|
| 249 |
+
if ($attr->usesSource ()) {
|
| 250 |
+
$currentStore = Mage::app ()->getStore ()->getCode ();
|
| 251 |
+
Mage::app ()->getStore ()->setId ( 0 );
|
| 252 |
+
$billingValueField = $attr->getSource ()->getOptionText ( $billingValueField );
|
| 253 |
+
Mage::app ()->getStore ()->setId ( $currentStore );
|
| 254 |
+
}
|
| 255 |
+
}
|
| 256 |
+
// ************************** FINE MODIFICA CAMPI PERSONALIZZATI SELECT ************************************
|
| 257 |
+
// Website and WebStore names
|
| 258 |
+
if ($label == "website_id") {
|
| 259 |
+
$billingValueField = Mage::app ()->getWebsite ( $billingValueField )->getName ();
|
| 260 |
+
}
|
| 261 |
+
if ($label == "store_id") {
|
| 262 |
+
$billingValueField = Mage::app ()->getStore ( $billingValueField )->getName ();
|
| 263 |
+
}
|
| 264 |
+
// ----- end ---
|
| 265 |
+
|
| 266 |
+
$key = 'Fields' . $customFieldID;
|
| 267 |
+
$customFields [$key] = '&Fields[CustomField' . $customFieldID . ']=' . $billingValueField;
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
if (isset ( $newDataCustomer ['is_subscribed'] ) && ! $newDataCustomer ['is_subscribed']) {
|
| 274 |
+
// Se l'utente disabilita la newsletter lo disiscrivo da 4Marketing.it..
|
| 275 |
+
$resource = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
|
| 276 |
+
$email = $newDataCustomer ['email'];
|
| 277 |
+
$user = $resource->query ( "SELECT * FROM devtrade_fourdem_users WHERE email_address = '" . $email . "'" );
|
| 278 |
+
$userRow = array_pop ( $user );
|
| 279 |
+
$idUser = $userRow ['fourdem_id'];
|
| 280 |
+
|
| 281 |
+
Mage::helper ( 'fourdem' )->unsubscribeSubscriber ( $listID, $idUser, $email, true );
|
| 282 |
+
return;
|
| 283 |
+
} elseif (isset ( $newDataCustomer ['is_subscribed'] ) && $newDataCustomer ['is_subscribed']) {
|
| 284 |
+
// Se l'utente abilita la newsletter lo iscrivo nella lista 4Marketing.it impostata dall'utente.
|
| 285 |
+
$email = $newDataCustomer ['email'];
|
| 286 |
+
$ipAddress = $_SERVER ['REMOTE_ADDR'];
|
| 287 |
+
|
| 288 |
+
//Mage::helper ( 'fourdem' )->newSubscriber ( $listID, $email, $ipAddress, $customFields, true, true );
|
| 289 |
+
Mage::helper ( 'fourdem' )->updateSubscriber ( $oldEmailCustomer, $newEmailCustomer, $listID, $customFields, true );
|
| 290 |
+
return;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
Mage::helper ( 'fourdem' )->updateSubscriber ( $oldEmailCustomer, $newEmailCustomer, $listID, $customFields, true );
|
| 294 |
+
return;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
/**
|
| 298 |
+
* Quando il cliente effettua un'acquisto viene iscritto alla lista "Clienti" presente su 4Marketing.
|
| 299 |
+
*
|
| 300 |
+
* @author Raffaele Capasso
|
| 301 |
+
* @version 1.0
|
| 302 |
+
* @copyright Dev And Trade
|
| 303 |
+
*/
|
| 304 |
+
public function subscribeCustomerAfterCheckout(Varien_Event_Observer $observer) {
|
| 305 |
+
$mapFields = Mage::getStoreConfig ( 'fourdem/fourdem_mapping' );
|
| 306 |
+
$listID = Mage::getStoreConfig ( 'fourdem/system_access/customer_list' );
|
| 307 |
+
$customerQuote = $observer->getEvent ()->getQuote ()->getData ();
|
| 308 |
+
$billingInformation = $observer->getEvent ()->getQuote ()->getBillingAddress ()->getData ();
|
| 309 |
+
$customFields = array ();
|
| 310 |
+
|
| 311 |
+
if ($customerQuote ['checkout_method'] === 'guest') {
|
| 312 |
+
$email = $customerQuote ['customer_email'];
|
| 313 |
+
$ipAddress = $_SERVER ['REMOTE_ADDR'];
|
| 314 |
+
$isMessageSuppressed = true;
|
| 315 |
+
$isCustomerRegistered = Mage::getModel ( 'customer/customer' )->setWebsiteId ( 1 )->loadByEmail ( $email )->getId ();
|
| 316 |
+
|
| 317 |
+
if ($isCustomerRegistered) {
|
| 318 |
+
foreach ( $mapFields as $label => $customFieldID ) {
|
| 319 |
+
if (! empty ( $customFieldID )) {
|
| 320 |
+
$billingValueField = $billingInformation [$label];
|
| 321 |
+
|
| 322 |
+
// ************************** INIZIO MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 323 |
+
// Step 1 - Verifica se il campo è personalizzato e di tipo select
|
| 324 |
+
$Custom_Var = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->addFieldToFilter ( 'attribute_code', $label )->addFieldToFilter ( 'frontend_input', 'select' )->getItems ();
|
| 325 |
+
// Step 2 - Carica il valore testuale della selezione (il campo contiene l'ID della option selezionata dall'utente
|
| 326 |
+
if (! empty ( $Custom_Var ) && isset ( $Custom_Var )) {
|
| 327 |
+
$customerModel = Mage::getModel ( 'customer/customer' ); /* ->setStoreId ( $modelCustomer->getData ( 'store_id' ) ); */
|
| 328 |
+
$attr = $customerModel->getResource ()->getAttribute ( $label );
|
| 329 |
+
if ($attr->usesSource ()) {
|
| 330 |
+
$currentStore = Mage::app ()->getStore ()->getCode ();
|
| 331 |
+
Mage::app ()->getStore ()->setId ( 0 );
|
| 332 |
+
$billingValueField = $attr->getSource ()->getOptionText ( $billingValueField );
|
| 333 |
+
Mage::app ()->getStore ()->setId ( $currentStore );
|
| 334 |
+
}
|
| 335 |
+
}
|
| 336 |
+
// ************************** FINE MODIFICA CAMPI PERSONALIZZATI SELECT ************************************
|
| 337 |
+
// Website and WebStore names
|
| 338 |
+
if ($label == "website_id") {
|
| 339 |
+
$billingValueField = Mage::app ()->getWebsite ( $billingValueField )->getName ();
|
| 340 |
+
}
|
| 341 |
+
if ($label == "store_id") {
|
| 342 |
+
$billingValueField = Mage::app ()->getStore ( $billingValueField )->getName ();
|
| 343 |
+
}
|
| 344 |
+
// ----- end ---
|
| 345 |
+
|
| 346 |
+
$key = 'Fields' . $customFieldID;
|
| 347 |
+
$customFields [$key] = '&Fields[CustomField' . $customFieldID . ']=' . $billingValueField;
|
| 348 |
+
}
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
Mage::helper ( 'fourdem' )->updateSubscriber ( $email, $email, $listID, $customFields );
|
| 352 |
+
return;
|
| 353 |
+
} else {
|
| 354 |
+
foreach ( $mapFields as $label => $customFieldID ) {
|
| 355 |
+
if (! empty ( $customFieldID )) {
|
| 356 |
+
$billingValueField = $billingInformation [$label];
|
| 357 |
+
// ************************** INIZIO MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 358 |
+
// Step 1 - Verifica se il campo è personalizzato e di tipo select
|
| 359 |
+
$Custom_Var = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->addFieldToFilter ( 'attribute_code', $label )->addFieldToFilter ( 'frontend_input', 'select' )->getItems ();
|
| 360 |
+
// Step 2 - Carica il valore testuale della selezione (il campo contiene l'ID della option selezionata dall'utente
|
| 361 |
+
if (! empty ( $Custom_Var ) && isset ( $Custom_Var )) {
|
| 362 |
+
$customerModel = Mage::getModel ( 'customer/customer' ); /* ->setStoreId ( $modelCustomer->getData ( 'store_id' ) ); */
|
| 363 |
+
$attr = $customerModel->getResource ()->getAttribute ( $label );
|
| 364 |
+
if ($attr->usesSource ()) {
|
| 365 |
+
$currentStore = Mage::app ()->getStore ()->getCode ();
|
| 366 |
+
Mage::app ()->getStore ()->setId ( 0 );
|
| 367 |
+
$billingValueField = $attr->getSource ()->getOptionText ( $billingValueField );
|
| 368 |
+
Mage::app ()->getStore ()->setId ( $currentStore );
|
| 369 |
+
}
|
| 370 |
+
}
|
| 371 |
+
// ************************** FINE MODIFICA CAMPI PERSONALIZZATI SELECT ************************************
|
| 372 |
+
// Website and WebStore names
|
| 373 |
+
if ($label == "website_id") {
|
| 374 |
+
$billingValueField = Mage::app ()->getWebsite ( $billingValueField )->getName ();
|
| 375 |
+
}
|
| 376 |
+
if ($label == "store_id") {
|
| 377 |
+
$billingValueField = Mage::app ()->getStore ( $billingValueField )->getName ();
|
| 378 |
+
}
|
| 379 |
+
// ----- end ---
|
| 380 |
+
|
| 381 |
+
if (! empty ( $billingValueField )) {
|
| 382 |
+
$key = 'CustomField' . $customFieldID;
|
| 383 |
+
$customFields [$key] = '&CustomField' . $customFieldID . '=' . $billingValueField;
|
| 384 |
+
}
|
| 385 |
+
}
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
Mage::helper ( 'fourdem' )->newSubscriber ( $listID, $email, $ipAddress, $customFields, false, $isMessageSuppressed );
|
| 389 |
+
return;
|
| 390 |
+
}
|
| 391 |
+
} else {
|
| 392 |
+
$customerOrder = $observer->getEvent ()->getOrder ();
|
| 393 |
+
$customer = $customerOrder->getCustomer ();
|
| 394 |
+
// echo '<pre>'; print_r($customer->getData()); echo '</pre>'; die();
|
| 395 |
+
$customerModel = Mage::getModel ( 'customer/customer' )->load ( $customer->getData ( 'entity_id' ) );
|
| 396 |
+
$billingAddress = $customerOrder->getBillingAddress ();
|
| 397 |
+
$email = $customerOrder->getCustomer ()->getEmail ();
|
| 398 |
+
$isCustomerRegistered = Mage::getModel ( 'customer/customer' )->setWebsiteId ( 1 )->loadByEmail ( $email )->getId ();
|
| 399 |
+
$ipAddress = $_SERVER ['REMOTE_ADDR'];
|
| 400 |
+
|
| 401 |
+
if ($isCustomerRegistered) {
|
| 402 |
+
foreach ( $mapFields as $label => $customFieldID ) {
|
| 403 |
+
if (! empty ( $customFieldID ) && $label != 'billing_address') {
|
| 404 |
+
$billingValueField = $billingAddress->getData ( $label );
|
| 405 |
+
|
| 406 |
+
// ************************** INIZIO MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 407 |
+
// Step 1 - Verifica se il campo è personalizzato e di tipo select
|
| 408 |
+
$Custom_Var = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->addFieldToFilter ( 'attribute_code', $label )->addFieldToFilter ( 'frontend_input', 'select' )->getItems ();
|
| 409 |
+
// Step 2 - Carica il valore testuale della selezione (il campo contiene l'ID della option selezionata dall'utente
|
| 410 |
+
if (! empty ( $Custom_Var ) && isset ( $Custom_Var )) {
|
| 411 |
+
$customerModel = Mage::getModel ( 'customer/customer' ); /* ->setStoreId ( $modelCustomer->getData ( 'store_id' ) ); */
|
| 412 |
+
$attr = $customerModel->getResource ()->getAttribute ( $label );
|
| 413 |
+
if ($attr->usesSource ()) {
|
| 414 |
+
$currentStore = Mage::app ()->getStore ()->getCode ();
|
| 415 |
+
Mage::app ()->getStore ()->setId ( 0 );
|
| 416 |
+
$billingValueField = $attr->getSource ()->getOptionText ( $billingValueField );
|
| 417 |
+
Mage::app ()->getStore ()->setId ( $currentStore );
|
| 418 |
+
}
|
| 419 |
+
}
|
| 420 |
+
// ************************** FINE MODIFICA CAMPI PERSONALIZZATI SELECT ************************************
|
| 421 |
+
// Website and WebStore names
|
| 422 |
+
if ($label == "website_id") {
|
| 423 |
+
$billingValueField = Mage::app ()->getWebsite ( $billingValueField )->getName ();
|
| 424 |
+
}
|
| 425 |
+
if ($label == "store_id") {
|
| 426 |
+
$billingValueField = Mage::app ()->getStore ( $billingValueField )->getName ();
|
| 427 |
+
}
|
| 428 |
+
// ----- end --
|
| 429 |
+
$key = 'Fields' . $customFieldID;
|
| 430 |
+
$customFields [$key] = '&Fields[CustomField' . $customFieldID . ']=' . $billingValueField;
|
| 431 |
+
}
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
// echo '<pre>'; print_r($customFields); echo '</pre>'; die();
|
| 435 |
+
Mage::helper ( 'fourdem' )->updateSubscriber ( $email, $email, $listID, $customFields, true );
|
| 436 |
+
return;
|
| 437 |
+
} else {
|
| 438 |
+
foreach ( $mapFields as $label => $customFieldID ) {
|
| 439 |
+
if (! empty ( $customFieldID )) {
|
| 440 |
+
$billingValueField = $billingAddress->getData ( $label );
|
| 441 |
+
|
| 442 |
+
// ************************** INIZIO MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 443 |
+
// Step 1 - Verifica se il campo è personalizzato e di tipo select
|
| 444 |
+
$Custom_Var = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->addFieldToFilter ( 'attribute_code', $label )->addFieldToFilter ( 'frontend_input', 'select' )->getItems ();
|
| 445 |
+
// Step 2 - Carica il valore testuale della selezione (il campo contiene l'ID della option selezionata dall'utente
|
| 446 |
+
if (! empty ( $Custom_Var ) && isset ( $Custom_Var )) {
|
| 447 |
+
$customerModel = Mage::getModel ( 'customer/customer' ); /* ->setStoreId ( $modelCustomer->getData ( 'store_id' ) ); */
|
| 448 |
+
$attr = $customerModel->getResource ()->getAttribute ( $label );
|
| 449 |
+
if ($attr->usesSource ()) {
|
| 450 |
+
$currentStore = Mage::app ()->getStore ()->getCode ();
|
| 451 |
+
Mage::app ()->getStore ()->setId ( 0 );
|
| 452 |
+
$billingValueField = $attr->getSource ()->getOptionText ( $billingValueField );
|
| 453 |
+
Mage::app ()->getStore ()->setId ( $currentStore );
|
| 454 |
+
}
|
| 455 |
+
}
|
| 456 |
+
// ************************** FINE MODIFICA CAMPI PERSONALIZZATI SELECT ************************************
|
| 457 |
+
// Website and WebStore names
|
| 458 |
+
if ($label == "website_id") {
|
| 459 |
+
$billingValueField = Mage::app ()->getWebsite ( $billingValueField )->getName ();
|
| 460 |
+
}
|
| 461 |
+
if ($label == "store_id") {
|
| 462 |
+
$billingValueField = Mage::app ()->getStore ( $billingValueField )->getName ();
|
| 463 |
+
}
|
| 464 |
+
// ----- end --
|
| 465 |
+
|
| 466 |
+
if (! empty ( $billingValueField )) {
|
| 467 |
+
$key = 'CustomField' . $customFieldID;
|
| 468 |
+
$customFields [$key] = '&CustomField' . $customFieldID . '=' . $billingValueField;
|
| 469 |
+
} else {
|
| 470 |
+
$key = 'CustomField' . $customFieldID;
|
| 471 |
+
$customerValueField = $customerModel->getData ( $label );
|
| 472 |
+
$customFields [$key] = '&CustomField' . $customFieldID . '=' . $customerValueField;
|
| 473 |
+
}
|
| 474 |
+
}
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
Mage::helper ( 'fourdem' )->newSubscriber ( $listID, $email, $ipAddress, $customFields );
|
| 478 |
+
return;
|
| 479 |
+
}
|
| 480 |
+
}
|
| 481 |
+
}
|
| 482 |
}
|
app/code/community/FourMarketing/FourDem/Model/System/Config/Source/List.php
CHANGED
|
@@ -3,9 +3,9 @@
|
|
| 3 |
/**
|
| 4 |
* 4Marketing lists source file
|
| 5 |
*
|
| 6 |
-
* @category
|
| 7 |
-
* @package
|
| 8 |
-
* @author
|
| 9 |
*/
|
| 10 |
class FourMarketing_FourDem_Model_System_Config_Source_List
|
| 11 |
{
|
| 3 |
/**
|
| 4 |
* 4Marketing lists source file
|
| 5 |
*
|
| 6 |
+
* @category DevTrade
|
| 7 |
+
* @package DevTrade_FourDem
|
| 8 |
+
* @author DevTrade Team <devandtrade@devandtrade.it>
|
| 9 |
*/
|
| 10 |
class FourMarketing_FourDem_Model_System_Config_Source_List
|
| 11 |
{
|
app/code/community/FourMarketing/FourDem/Model/Users.php
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class FourMarketing_FourDem_Model_Users extends Mage_Core_Model_Abstract
|
| 3 |
-
{
|
| 4 |
-
protected function _construct()
|
| 5 |
-
{
|
| 6 |
-
$this->_init('fourmarketing_fourdem/users');
|
| 7 |
-
}
|
| 8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/FourMarketing/FourDem/controllers/Adminhtml/FourDemController.php
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Magento Class For 4Marketing Magento ADMIN
|
| 4 |
+
*/
|
| 5 |
+
class FourMarketing_FourDem_Adminhtml_FourDemController extends Mage_Adminhtml_Controller_Action {
|
| 6 |
+
protected function _initAction() {
|
| 7 |
+
$this->loadLayout ()->_setActiveMenu ( 'fourdem/items' )->_title ( $this->__ ( 'Iscritti Newsletter' ) )->_title ( $this->__ ( '4Marketing' ) );
|
| 8 |
+
|
| 9 |
+
return $this;
|
| 10 |
+
}
|
| 11 |
+
public function indexAction() {
|
| 12 |
+
$this->_initAction ();
|
| 13 |
+
$this->_addContent ( $this->getLayout ()->createBlock ( 'fourdem/adminhtml_fourdem' ) );
|
| 14 |
+
$this->renderLayout ();
|
| 15 |
+
}
|
| 16 |
+
public function deleteAction() {
|
| 17 |
+
$params = $this->getRequest ()->getParams ();
|
| 18 |
+
$idUser = $params ['id'];
|
| 19 |
+
$user = Mage::getModel ( 'fourdem/fourdem' )->load ( $idUser );
|
| 20 |
+
|
| 21 |
+
preg_match_all ( "/\d+/", $user->getOwnList (), $matches );
|
| 22 |
+
$listID = $matches [0] [0];
|
| 23 |
+
$email = $user->getData ( 'email_address' );
|
| 24 |
+
|
| 25 |
+
try {
|
| 26 |
+
// Cancello l'utente da Magento e dalla tabella di riferimento..
|
| 27 |
+
$response = Mage::helper ( 'fourdem' )->unsubscribeSubscriber ( $listID, $idUser, $email );
|
| 28 |
+
|
| 29 |
+
if ($response->Success) {
|
| 30 |
+
$user->delete ();
|
| 31 |
+
|
| 32 |
+
$message = $this->__ ( "L'utente $email è stato cancellato con successo!" );
|
| 33 |
+
Mage::getSingleton ( 'core/session' )->addSuccess ( $message );
|
| 34 |
+
$this->_redirectReferer ();
|
| 35 |
+
} else {
|
| 36 |
+
throw new Exception ( "L'utente $email non è presente in 4Marketing. Può darsi che sia già stato cancellato." );
|
| 37 |
+
}
|
| 38 |
+
} catch ( Exception $e ) {
|
| 39 |
+
$message = $e->getMessage ();
|
| 40 |
+
Mage::getSingleton ( 'core/session' )->addError ( $message );
|
| 41 |
+
$this->_redirectReferer ();
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
public function synchronizeAction() {
|
| 45 |
+
$start = microtime ( true );
|
| 46 |
+
|
| 47 |
+
try {
|
| 48 |
+
// Clean Magento Table..
|
| 49 |
+
$resource = Mage::getSingleton ( 'core/resource' );
|
| 50 |
+
$writeConnection = $resource->getConnection ( 'core_write' );
|
| 51 |
+
$writeConnection->query ( "TRUNCATE fourdem_users" );
|
| 52 |
+
|
| 53 |
+
$collection = Mage::getModel ( 'customer/customer' )->getCollection ()->addAttributeToSelect ( '*' );
|
| 54 |
+
$customers = $collection->getData ();
|
| 55 |
+
|
| 56 |
+
// echo '<pre>'; print_r($customers); echo '</pre>'; die();
|
| 57 |
+
|
| 58 |
+
$mapFields = Mage::getStoreConfig ( 'fourdem/fourdem_mapping' );
|
| 59 |
+
$customFields = array ();
|
| 60 |
+
$customFieldsUpdate = array ();
|
| 61 |
+
|
| 62 |
+
$customerListID = Mage::getStoreConfig ( 'fourdem/system_access/customer_list' );
|
| 63 |
+
$newsletterListID = Mage::getStoreConfig ( 'fourdem/system_access/newsletter_list' );
|
| 64 |
+
|
| 65 |
+
$customerList = Mage::helper ( 'fourdem' )->getListInformation ( $customerListID )->List->Name;
|
| 66 |
+
$newsletterList = Mage::helper ( 'fourdem' )->getListInformation ( $newsletterListID )->List->Name;
|
| 67 |
+
|
| 68 |
+
$customerSubscribers = Mage::helper ( 'fourdem' )->getAllSubscribers ( $customerListID )->Subscribers;
|
| 69 |
+
$newsletterSubscribers = Mage::helper ( 'fourdem' )->getAllSubscribers ( $newsletterListID )->Subscribers;
|
| 70 |
+
|
| 71 |
+
// Prima Fase: Importo i Clienti Magento nella "Lista Clienti" Di Destinazione..
|
| 72 |
+
foreach ( $customers as $customer ) {
|
| 73 |
+
$modelCustomer = Mage::getModel ( 'customer/customer' )->load ( $customer ['entity_id'] );
|
| 74 |
+
$addressCustomerModel = Mage::getModel ( 'customer/address' )->load ( $modelCustomer->getDefaultBilling () );
|
| 75 |
+
|
| 76 |
+
foreach ( $mapFields as $label => $customFieldID ) {
|
| 77 |
+
if (! empty ( $customFieldID ) && $label != 'billing_address') {
|
| 78 |
+
$customerValueField = $modelCustomer->getData ( $label );
|
| 79 |
+
// $customerValueField = $modelCustomer->getAttributeText($label);
|
| 80 |
+
// $Custom_Var = Mage::getModel('customer/customer')->load($_item['is'])->getData('adresse')
|
| 81 |
+
|
| 82 |
+
//************************** INIZIO MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 83 |
+
// Step 1 - Verifica se il campo è personalizzato e di tipo select
|
| 84 |
+
$Custom_Var = Mage::getResourceModel ( 'customer/attribute_collection' )->addFieldToFilter ( 'is_user_defined', '1' )->addFieldToFilter ( 'attribute_code', $label )->addFieldToFilter ( 'frontend_input', 'select' )->getItems ();
|
| 85 |
+
// Step 2 - Carica il valore testuale della selezione (il campo contiene l'ID della option selezionata dall'utente
|
| 86 |
+
if (! empty ( $Custom_Var ) && isset ( $Custom_Var )) {
|
| 87 |
+
$customerModel = Mage::getModel ( 'customer/customer' );
|
| 88 |
+
$attr = $customerModel->getResource ()->getAttribute ( $label );
|
| 89 |
+
if ($attr->usesSource ()) {
|
| 90 |
+
$currentStore = Mage::app ()->getStore ()->getCode ();
|
| 91 |
+
Mage::app ()->getStore ()->setId ( 0 );
|
| 92 |
+
$customerValueField = $attr->getSource ()->getOptionText ( $customerValueField );
|
| 93 |
+
Mage::app ()->getStore ()->setId ( $currentStore );
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
//************************** FINE MODIFICA CAMPI PERSONALIZZATI SELECT *************************************
|
| 97 |
+
|
| 98 |
+
// Website and WebStore names
|
| 99 |
+
if ($label == "website_id") {
|
| 100 |
+
$customerValueField = Mage::app ()->getWebsite ( $customerValueField )->getName ();
|
| 101 |
+
}
|
| 102 |
+
if ($label == "store_id") {
|
| 103 |
+
$customerValueField = Mage::app ()->getStore ( $customerValueField )->getName ();
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
// ----- end --
|
| 107 |
+
|
| 108 |
+
if (! empty ( $customerValueField )) {
|
| 109 |
+
$key = 'CustomField' . $customFieldID;
|
| 110 |
+
$customFields [$key] = '&CustomField' . $customFieldID . '=' . $customerValueField;
|
| 111 |
+
|
| 112 |
+
$keyUpdate = 'Fields' . $customFieldID;
|
| 113 |
+
$customFieldsUpdate [$keyUpdate] = '&Fields[CustomField' . $customFieldID . ']=' . $customerValueField;
|
| 114 |
+
} else {
|
| 115 |
+
$customerValueField = $addressCustomerModel->getData ( $label );
|
| 116 |
+
$key = 'CustomField' . $customFieldID;
|
| 117 |
+
$customFields [$key] = '&CustomField' . $customFieldID . '=' . $customerValueField;
|
| 118 |
+
|
| 119 |
+
$keyUpdate = 'Fields' . $customFieldID;
|
| 120 |
+
$customFieldsUpdate [$keyUpdate] = '&Fields[CustomField' . $customFieldID . ']=' . $customerValueField;
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
// echo '<pre>'; print_r($modelCustomer->getData()); echo '</pre>'; die();
|
| 126 |
+
// echo '<pre>'; print_r($mapFields); echo '</pre>'; die();
|
| 127 |
+
// echo '<pre>'; print_r($customFields); echo '</pre>'; die();
|
| 128 |
+
|
| 129 |
+
$listID = $customerListID;
|
| 130 |
+
$singleAlert = true;
|
| 131 |
+
$isThereSubscribers = Mage::helper ( 'fourdem' )->getAboutSubscriber ( $customer ['email'], $listID )->Subscribers;
|
| 132 |
+
|
| 133 |
+
// Se l'utente è presente nella lista, controllo se sia cancellato oppure no..
|
| 134 |
+
if ($isThereSubscribers) {
|
| 135 |
+
$customerConsoleResponse = array_pop ( $isThereSubscribers );
|
| 136 |
+
$customerStatusOnConsole = $customerConsoleResponse->SubscriptionStatus;
|
| 137 |
+
|
| 138 |
+
// echo '<pre>'; print_r(var_dump($customerStatusOnConsole)); echo '</pre>'; die();
|
| 139 |
+
|
| 140 |
+
if ($customerStatusOnConsole === 'Unsubscribed') {
|
| 141 |
+
Mage::helper ( 'fourdem' )->newSubscriber ( $listID, $customer ['email'], $_SERVER ['REMOTE_ADDR'], $customFields, $singleAlert, true );
|
| 142 |
+
} elseif ($customerStatusOnConsole === 'Subscribed') {
|
| 143 |
+
Mage::helper ( 'fourdem' )->updateSubscriber ( $customer ['email'], $customer ['email'], $listID, $customFieldsUpdate, true );
|
| 144 |
+
}
|
| 145 |
+
} else {
|
| 146 |
+
// Se l'utente non esite nella lista di destinazione lo iscrivo..
|
| 147 |
+
Mage::helper ( 'fourdem' )->newSubscriber ( $listID, $customer ['email'], $_SERVER ['REMOTE_ADDR'], $customFields, $singleAlert );
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
// Seconda Fase: Importo Le Liste Nella Tabella di Riferimento in Magento..
|
| 152 |
+
if (! empty ( $customerListID )) {
|
| 153 |
+
foreach ( $customerSubscribers as $subscriber ) {
|
| 154 |
+
|
| 155 |
+
$info = get_object_vars ( $subscriber );
|
| 156 |
+
$firstname = $info ['CustomField' . $mapFields ['firstname']];
|
| 157 |
+
$lastname = $info ['CustomField' . $mapFields ['lastname']];
|
| 158 |
+
|
| 159 |
+
$insertStatement = "INSERT INTO fourdem_users VALUES(
|
| 160 |
+
" . $subscriber->SubscriberID . ",
|
| 161 |
+
'$firstname',
|
| 162 |
+
'$lastname',
|
| 163 |
+
'" . $subscriber->EmailAddress . "',
|
| 164 |
+
'ID: $customerListID / Nome: $customerList')";
|
| 165 |
+
$writeConnection->query ( $insertStatement );
|
| 166 |
+
}
|
| 167 |
+
} else {
|
| 168 |
+
// Import Newsletter Users
|
| 169 |
+
foreach ( $newsletterSubscribers as $subscriber ) {
|
| 170 |
+
$info = get_object_vars ( $subscriber );
|
| 171 |
+
$firstname = $info ['CustomField' . $mapFields ['firstname']];
|
| 172 |
+
$lastname = $info ['CustomField' . $mapFields ['lastname']];
|
| 173 |
+
|
| 174 |
+
$insertStatement = "INSERT INTO fourdem_users VALUES(
|
| 175 |
+
" . $subscriber->SubscriberID . ",
|
| 176 |
+
'$firstname',
|
| 177 |
+
'$lastname',
|
| 178 |
+
'" . $subscriber->EmailAddress . "',
|
| 179 |
+
'ID: $newsletterListID / Nome: $newsletterList')";
|
| 180 |
+
$writeConnection->query ( $insertStatement );
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
$time_taken = microtime ( true ) - $start;
|
| 185 |
+
$minSeconds = date ( "i:s", $time_taken );
|
| 186 |
+
|
| 187 |
+
$message = $this->__ ( "Tabella Sincronizzata Con Successo! Tempo stimato: " . $minSeconds . " secondi" );
|
| 188 |
+
Mage::getSingleton ( 'core/session' )->addSuccess ( $message );
|
| 189 |
+
|
| 190 |
+
$this->_redirectReferer ();
|
| 191 |
+
} catch ( Exception $e ) {
|
| 192 |
+
$message = $this->__ ( $e->getMessage () );
|
| 193 |
+
Mage::getSingleton ( 'core/session' )->addError ( $message );
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
}
|
app/code/community/FourMarketing/FourDem/controllers/UsersController.php
DELETED
|
@@ -1,201 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/*
|
| 3 |
-
* Magento Class For 4Marketing Magento ADMIN
|
| 4 |
-
*/
|
| 5 |
-
class FourMarketing_FourDem_UsersController extends Mage_Adminhtml_Controller_Action
|
| 6 |
-
{
|
| 7 |
-
public function indexAction()
|
| 8 |
-
{
|
| 9 |
-
$this->_initAction()->renderLayout();
|
| 10 |
-
}
|
| 11 |
-
|
| 12 |
-
protected function _initAction()
|
| 13 |
-
{
|
| 14 |
-
$this->loadLayout()
|
| 15 |
-
->_setActiveMenu('fourdem/fourmarketing_fourdem_users')
|
| 16 |
-
->_title($this->__('Iscritti Newsletter'))->_title($this->__('4Marketing'));
|
| 17 |
-
|
| 18 |
-
return $this;
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
public function deleteAction()
|
| 22 |
-
{
|
| 23 |
-
$params = $this->getRequest()->getParams();
|
| 24 |
-
$idUser = $params['id'];
|
| 25 |
-
$user = Mage::getModel('fourmarketing_fourdem/users')->load($idUser);
|
| 26 |
-
|
| 27 |
-
preg_match_all("/\d+/", $user->getOwnList(), $matches);
|
| 28 |
-
$listID = $matches[0][0];
|
| 29 |
-
$email = $user->getData('email_address');
|
| 30 |
-
|
| 31 |
-
try
|
| 32 |
-
{
|
| 33 |
-
// Cancello l'utente da Magento e dalla tabella di riferimento..
|
| 34 |
-
$response = Mage::helper('fourdem')->unsubscribeSubscriber($listID, $idUser, $email);
|
| 35 |
-
|
| 36 |
-
if($response->Success)
|
| 37 |
-
{
|
| 38 |
-
$user->delete();
|
| 39 |
-
|
| 40 |
-
$message = $this->__("L'utente $email è stato cancellato con successo!");
|
| 41 |
-
Mage::getSingleton('core/session')->addSuccess($message);
|
| 42 |
-
$this->_redirectReferer();
|
| 43 |
-
}
|
| 44 |
-
else
|
| 45 |
-
{
|
| 46 |
-
throw new Exception("L'utente $email non è presente in 4Marketing. Può darsi che sia già stato cancellato.");
|
| 47 |
-
}
|
| 48 |
-
}
|
| 49 |
-
catch(Exception $e)
|
| 50 |
-
{
|
| 51 |
-
$message = $e->getMessage();
|
| 52 |
-
Mage::getSingleton('core/session')->addError($message);
|
| 53 |
-
$this->_redirectReferer();
|
| 54 |
-
}
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
public function synchronizeAction()
|
| 58 |
-
{
|
| 59 |
-
$start = microtime(true);
|
| 60 |
-
try
|
| 61 |
-
{
|
| 62 |
-
// Clean Magento Table..
|
| 63 |
-
$resource = Mage::getSingleton('core/resource');
|
| 64 |
-
$writeConnection = $resource->getConnection('core_write');
|
| 65 |
-
$writeConnection->query("TRUNCATE fourmarketing_fourdem_users");
|
| 66 |
-
|
| 67 |
-
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');
|
| 68 |
-
$customers = $collection->getData();
|
| 69 |
-
|
| 70 |
-
//echo '<pre>'; print_r($customers); echo '</pre>'; die();
|
| 71 |
-
|
| 72 |
-
$mapFields = Mage::getStoreConfig('fourdem/fourdem_mapping');
|
| 73 |
-
$customFields = array();
|
| 74 |
-
$customFieldsUpdate = array();
|
| 75 |
-
|
| 76 |
-
$customerListID = Mage::getStoreConfig('fourdem/system_access/customer_list');
|
| 77 |
-
$newsletterListID = Mage::getStoreConfig('fourdem/system_access/newsletter_list');
|
| 78 |
-
|
| 79 |
-
$customerList = Mage::helper('fourdem')->getListInformation($customerListID)->List->Name;
|
| 80 |
-
$newsletterList = Mage::helper('fourdem')->getListInformation($newsletterListID)->List->Name;
|
| 81 |
-
|
| 82 |
-
$customerSubscribers = Mage::helper('fourdem')->getAllSubscribers($customerListID)->Subscribers;
|
| 83 |
-
$newsletterSubscribers = Mage::helper('fourdem')->getAllSubscribers($newsletterListID)->Subscribers;
|
| 84 |
-
|
| 85 |
-
// Prima Fase: Importo i Clienti Magento nella "Lista Clienti" Di Destinazione..
|
| 86 |
-
foreach($customers as $customer)
|
| 87 |
-
{
|
| 88 |
-
$modelCustomer = Mage::getModel('customer/customer')->load($customer['entity_id']);
|
| 89 |
-
$addressCustomerModel = Mage::getModel('customer/address')->load($modelCustomer->getDefaultBilling());
|
| 90 |
-
|
| 91 |
-
foreach($mapFields as $label => $customFieldID)
|
| 92 |
-
{
|
| 93 |
-
if(!empty($customFieldID) && $label!='billing_address')
|
| 94 |
-
{
|
| 95 |
-
$customerValueField = $modelCustomer->getData($label);
|
| 96 |
-
|
| 97 |
-
if(!empty($customerValueField))
|
| 98 |
-
{
|
| 99 |
-
$key = 'CustomField'.$customFieldID;
|
| 100 |
-
$customFields[$key] = '&CustomField'.$customFieldID.'='.$customerValueField;
|
| 101 |
-
|
| 102 |
-
$keyUpdate = 'Fields'.$customFieldID;
|
| 103 |
-
$customFieldsUpdate[$keyUpdate] = '&Fields[CustomField'.$customFieldID.']='.$customerValueField;
|
| 104 |
-
}
|
| 105 |
-
else
|
| 106 |
-
{
|
| 107 |
-
$customerValueField = $addressCustomerModel->getData($label);
|
| 108 |
-
$key = 'CustomField'.$customFieldID;
|
| 109 |
-
$customFields[$key] = '&CustomField'.$customFieldID.'='.$customerValueField;
|
| 110 |
-
|
| 111 |
-
$keyUpdate = 'Fields'.$customFieldID;
|
| 112 |
-
$customFieldsUpdate[$keyUpdate] = '&Fields[CustomField'.$customFieldID.']='.$customerValueField;
|
| 113 |
-
}
|
| 114 |
-
}
|
| 115 |
-
}
|
| 116 |
-
|
| 117 |
-
//echo '<pre>'; print_r($modelCustomer->getData()); echo '</pre>'; die();
|
| 118 |
-
//echo '<pre>'; print_r($mapFields); echo '</pre>'; die();
|
| 119 |
-
//echo '<pre>'; print_r($customFields); echo '</pre>'; die();
|
| 120 |
-
|
| 121 |
-
$listID = $customerListID;
|
| 122 |
-
$singleAlert = true;
|
| 123 |
-
$isThereSubscribers = Mage::helper('fourdem')->getAboutSubscriber($customer['email'], $listID)->Subscribers;
|
| 124 |
-
|
| 125 |
-
// Se l'utente è presente nella lista, controllo se sia cancellato oppure no..
|
| 126 |
-
if($isThereSubscribers)
|
| 127 |
-
{
|
| 128 |
-
$customerConsoleResponse = array_pop($isThereSubscribers);
|
| 129 |
-
$customerStatusOnConsole = $customerConsoleResponse->SubscriptionStatus;
|
| 130 |
-
|
| 131 |
-
//echo '<pre>'; print_r(var_dump($customerStatusOnConsole)); echo '</pre>'; die();
|
| 132 |
-
|
| 133 |
-
if($customerStatusOnConsole === 'Unsubscribed')
|
| 134 |
-
{
|
| 135 |
-
Mage::helper('fourdem')->newSubscriber($listID, $customer['email'], $_SERVER['REMOTE_ADDR'], $customFields, $singleAlert, true);
|
| 136 |
-
}
|
| 137 |
-
elseif($customerStatusOnConsole === 'Subscribed')
|
| 138 |
-
{
|
| 139 |
-
Mage::helper('fourdem')->updateSubscriber($customer['email'], $customer['email'], $listID, $customFieldsUpdate, true);
|
| 140 |
-
}
|
| 141 |
-
}
|
| 142 |
-
else
|
| 143 |
-
{
|
| 144 |
-
// Se l'utente non esite nella lista di destinazione lo iscrivo..
|
| 145 |
-
Mage::helper('fourdem')->newSubscriber($listID, $customer['email'], $_SERVER['REMOTE_ADDR'], $customFields, $singleAlert);
|
| 146 |
-
}
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
-
// Seconda Fase: Importo Le Liste Nella Tabella di Riferimento in Magento..
|
| 150 |
-
if(!empty($customerListID))
|
| 151 |
-
{
|
| 152 |
-
foreach($customerSubscribers as $subscriber)
|
| 153 |
-
{
|
| 154 |
-
|
| 155 |
-
$info = get_object_vars($subscriber);
|
| 156 |
-
$firstname = $info['CustomField'.$mapFields['firstname']];
|
| 157 |
-
$lastname = $info['CustomField'.$mapFields['lastname']];
|
| 158 |
-
|
| 159 |
-
$insertStatement = "INSERT INTO fourmarketing_fourdem_users VALUES(
|
| 160 |
-
".$subscriber->SubscriberID.",
|
| 161 |
-
'$firstname',
|
| 162 |
-
'$lastname',
|
| 163 |
-
'".$subscriber->EmailAddress."',
|
| 164 |
-
'ID: $customerListID / Nome: $customerList')";
|
| 165 |
-
$writeConnection->query($insertStatement);
|
| 166 |
-
}
|
| 167 |
-
}
|
| 168 |
-
else
|
| 169 |
-
{
|
| 170 |
-
// Import Newsletter Users
|
| 171 |
-
foreach($newsletterSubscribers as $subscriber)
|
| 172 |
-
{
|
| 173 |
-
$info = get_object_vars($subscriber);
|
| 174 |
-
$firstname = $info['CustomField'.$mapFields['firstname']];
|
| 175 |
-
$lastname = $info['CustomField'.$mapFields['lastname']];
|
| 176 |
-
|
| 177 |
-
$insertStatement = "INSERT INTO fourmarketing_fourdem_users VALUES(
|
| 178 |
-
".$subscriber->SubscriberID.",
|
| 179 |
-
'$firstname',
|
| 180 |
-
'$lastname',
|
| 181 |
-
'".$subscriber->EmailAddress."',
|
| 182 |
-
'ID: $newsletterListID / Nome: $newsletterList')";
|
| 183 |
-
$writeConnection->query($insertStatement);
|
| 184 |
-
}
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
$time_taken = microtime(true) - $start;
|
| 188 |
-
$minSeconds = date("i:s", $time_taken);
|
| 189 |
-
|
| 190 |
-
$message = $this->__("Tabella Sincronizzata Con Successo! Tempo stimato: ".$minSeconds." secondi");
|
| 191 |
-
Mage::getSingleton('core/session')->addSuccess($message);
|
| 192 |
-
|
| 193 |
-
$this->_redirectReferer();
|
| 194 |
-
}
|
| 195 |
-
catch(Exception $e)
|
| 196 |
-
{
|
| 197 |
-
$message = $this->__($e->getMessage());
|
| 198 |
-
Mage::getSingleton('core/session')->addError($message);
|
| 199 |
-
}
|
| 200 |
-
}
|
| 201 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/FourMarketing/FourDem/etc/{adminhtml.xml → adminhtml.old}
RENAMED
|
@@ -5,11 +5,11 @@
|
|
| 5 |
<title>4Dem.it</title>
|
| 6 |
<sort_order>65</sort_order>
|
| 7 |
<children>
|
| 8 |
-
<
|
| 9 |
<title>Sincronizzazione Clienti</title>
|
| 10 |
<sort_order>1</sort_order>
|
| 11 |
-
<action>
|
| 12 |
-
</
|
| 13 |
</children>
|
| 14 |
<!--
|
| 15 |
<children>
|
| 5 |
<title>4Dem.it</title>
|
| 6 |
<sort_order>65</sort_order>
|
| 7 |
<children>
|
| 8 |
+
<items module="fourdem">
|
| 9 |
<title>Sincronizzazione Clienti</title>
|
| 10 |
<sort_order>1</sort_order>
|
| 11 |
+
<action>fourdem/adminhtml_fourdem</action>
|
| 12 |
+
</items>
|
| 13 |
</children>
|
| 14 |
<!--
|
| 15 |
<children>
|
app/code/community/FourMarketing/FourDem/etc/config.xml
CHANGED
|
@@ -1,142 +1,209 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<config>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
<fourmarketing_fourdem_setup>
|
| 38 |
-
<setup>
|
| 39 |
-
<module>FourMarketing_FourDem</module>
|
| 40 |
-
</setup>
|
| 41 |
-
<connection>
|
| 42 |
-
<use>core_setup</use>
|
| 43 |
-
</connection>
|
| 44 |
-
</fourmarketing_fourdem_setup>
|
| 45 |
-
<fourmarketing_fourdem_write>
|
| 46 |
-
<connection>
|
| 47 |
-
<use>core_write</use>
|
| 48 |
-
</connection>
|
| 49 |
-
</fourmarketing_fourdem_write>
|
| 50 |
-
<fourmarketing_fourdem_read>
|
| 51 |
-
<connection>
|
| 52 |
-
<use>core_read</use>
|
| 53 |
-
</connection>
|
| 54 |
-
</fourmarketing_fourdem_read>
|
| 55 |
-
</resources>
|
| 56 |
-
<events>
|
| 57 |
-
<admin_system_config_changed_section_fourdem>
|
| 58 |
-
<observers>
|
| 59 |
-
<fourdem>
|
| 60 |
-
<type>singleton</type>
|
| 61 |
-
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 62 |
-
<method>check4DemConfiguration</method>
|
| 63 |
-
</fourdem>
|
| 64 |
-
</observers>
|
| 65 |
-
</admin_system_config_changed_section_fourdem>
|
| 66 |
-
<customer_register_success>
|
| 67 |
-
<observers>
|
| 68 |
-
<fourdem>
|
| 69 |
-
<type>singleton</type>
|
| 70 |
-
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 71 |
-
<method>subscribeCustomer</method>
|
| 72 |
-
</fourdem>
|
| 73 |
-
</observers>
|
| 74 |
-
</customer_register_success>
|
| 75 |
-
<customer_save_after>
|
| 76 |
-
<observers>
|
| 77 |
-
<fourdem>
|
| 78 |
-
<type>singleton</type>
|
| 79 |
-
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 80 |
-
<method>changeSubscribeEmail</method>
|
| 81 |
-
</fourdem>
|
| 82 |
-
</observers>
|
| 83 |
-
</customer_save_after>
|
| 84 |
-
<customer_address_save_after>
|
| 85 |
-
<observers>
|
| 86 |
-
<fourdem>
|
| 87 |
-
<type>singleton</type>
|
| 88 |
-
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 89 |
-
<method>collectionDataMapping</method>
|
| 90 |
-
</fourdem>
|
| 91 |
-
</observers>
|
| 92 |
-
</customer_address_save_after>
|
| 93 |
-
<checkout_submit_all_after>
|
| 94 |
-
<observers>
|
| 95 |
-
<fourdem>
|
| 96 |
-
<type>singleton</type>
|
| 97 |
-
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 98 |
-
<method>subscribeCustomerAfterCheckout</method>
|
| 99 |
-
</fourdem>
|
| 100 |
-
</observers>
|
| 101 |
-
</checkout_submit_all_after>
|
| 102 |
-
</events>
|
| 103 |
-
</global>
|
| 104 |
-
<admin>
|
| 105 |
-
<routers>
|
| 106 |
-
<adminhtml>
|
| 107 |
<args>
|
| 108 |
<modules>
|
| 109 |
-
<
|
| 110 |
</modules>
|
| 111 |
</args>
|
| 112 |
</adminhtml>
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
</config>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<FourMarketing_FourDem>
|
| 5 |
+
<version>0.2.0</version>
|
| 6 |
+
</FourMarketing_FourDem>
|
| 7 |
+
</modules>
|
| 8 |
+
<frontend>
|
| 9 |
+
<routers>
|
| 10 |
+
<fourdem>
|
| 11 |
+
<use>standard</use>
|
| 12 |
+
<args>
|
| 13 |
+
<module>FourMarketing_FourDem</module>
|
| 14 |
+
<frontName>fourdem</frontName>
|
| 15 |
+
</args>
|
| 16 |
+
</fourdem>
|
| 17 |
+
</routers>
|
| 18 |
+
<layout>
|
| 19 |
+
<updates>
|
| 20 |
+
<fourdem>
|
| 21 |
+
<file>fourdem.xml</file>
|
| 22 |
+
</fourdem>
|
| 23 |
+
</updates>
|
| 24 |
+
</layout>
|
| 25 |
+
</frontend>
|
| 26 |
+
|
| 27 |
+
<admin>
|
| 28 |
+
<routers>
|
| 29 |
+
<fourdem>
|
| 30 |
+
<use>admin</use>
|
| 31 |
+
<args>
|
| 32 |
+
<module>FourMarketing_FourDem</module>
|
| 33 |
+
<frontName>fourdem</frontName>
|
| 34 |
+
</args>
|
| 35 |
+
</fourdem>
|
| 36 |
+
<adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
<args>
|
| 38 |
<modules>
|
| 39 |
+
<FourDem Before="Mage_Adminhtml">FourMarketing_FourDem</FourDem>
|
| 40 |
</modules>
|
| 41 |
</args>
|
| 42 |
</adminhtml>
|
| 43 |
+
</routers>
|
| 44 |
+
</admin>
|
| 45 |
+
<adminhtml>
|
| 46 |
+
<menu>
|
| 47 |
+
<fourdem module="fourdem">
|
| 48 |
+
<title>4Dem.it</title>
|
| 49 |
+
<sort_order>71</sort_order>
|
| 50 |
+
<children>
|
| 51 |
+
<items module="fourdem">
|
| 52 |
+
<title>Sincronizza Utenti</title>
|
| 53 |
+
<sort_order>0</sort_order>
|
| 54 |
+
<action>fourdem/adminhtml_fourdem</action>
|
| 55 |
+
</items>
|
| 56 |
+
</children>
|
| 57 |
+
</fourdem>
|
| 58 |
+
</menu>
|
| 59 |
+
<acl>
|
| 60 |
+
<!--
|
| 61 |
+
<resources>
|
| 62 |
+
<all>
|
| 63 |
+
<title>Allow Everything</title>
|
| 64 |
+
</all>
|
| 65 |
+
<admin>
|
| 66 |
+
<children>
|
| 67 |
+
<fourdem>
|
| 68 |
+
<title>FourDem FourDem</title>
|
| 69 |
+
<sort_order>200</sort_order>
|
| 70 |
+
</fourdem>
|
| 71 |
+
</children>
|
| 72 |
+
|
| 73 |
+
</admin>
|
| 74 |
+
</resources>
|
| 75 |
+
--><resources>
|
| 76 |
+
<admin>
|
| 77 |
+
<children>
|
| 78 |
+
<system>
|
| 79 |
+
<children>
|
| 80 |
+
<config>
|
| 81 |
+
<children>
|
| 82 |
+
<fourdem translate="title" module="fourdem">
|
| 83 |
+
<title>4Dem.it - Email Marketing</title>
|
| 84 |
+
</fourdem>
|
| 85 |
+
</children>
|
| 86 |
+
</config>
|
| 87 |
+
</children>
|
| 88 |
+
</system>
|
| 89 |
+
</children>
|
| 90 |
+
</admin>
|
| 91 |
+
</resources>
|
| 92 |
+
</acl>
|
| 93 |
+
|
| 94 |
+
<layout>
|
| 95 |
+
<updates>
|
| 96 |
+
<fourdem>
|
| 97 |
+
<file>fourdem.xml</file>
|
| 98 |
+
</fourdem>
|
| 99 |
+
</updates>
|
| 100 |
+
</layout>
|
| 101 |
+
</adminhtml>
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
<global>
|
| 105 |
+
<models>
|
| 106 |
+
<fourdem>
|
| 107 |
+
<class>FourMarketing_FourDem_Model</class>
|
| 108 |
+
<resourceModel>fourdem_mysql4</resourceModel>
|
| 109 |
+
</fourdem>
|
| 110 |
+
|
| 111 |
+
<fourdem_mysql4>
|
| 112 |
+
<class>FourMarketing_FourDem_Model_Mysql4</class>
|
| 113 |
+
<entities>
|
| 114 |
+
<fourdem>
|
| 115 |
+
<table>fourdem_users</table>
|
| 116 |
+
</fourdem>
|
| 117 |
+
</entities>
|
| 118 |
+
</fourdem_mysql4>
|
| 119 |
+
</models>
|
| 120 |
+
|
| 121 |
+
<resources>
|
| 122 |
+
<fourdem_setup>
|
| 123 |
+
<setup>
|
| 124 |
+
<module>FourMarketing_FourDem</module>
|
| 125 |
+
</setup>
|
| 126 |
+
<connection>
|
| 127 |
+
<use>core_setup</use>
|
| 128 |
+
</connection>
|
| 129 |
+
</fourdem_setup>
|
| 130 |
+
<fourdem_write>
|
| 131 |
+
<connection>
|
| 132 |
+
<use>core_write</use>
|
| 133 |
+
</connection>
|
| 134 |
+
</fourdem_write>
|
| 135 |
+
<fourdem_read>
|
| 136 |
+
<connection>
|
| 137 |
+
<use>core_read</use>
|
| 138 |
+
</connection>
|
| 139 |
+
</fourdem_read>
|
| 140 |
+
</resources>
|
| 141 |
+
|
| 142 |
+
<blocks>
|
| 143 |
+
<fourdem>
|
| 144 |
+
<class>FourMarketing_FourDem_Block</class>
|
| 145 |
+
</fourdem>
|
| 146 |
+
</blocks>
|
| 147 |
+
<helpers>
|
| 148 |
+
<fourdem>
|
| 149 |
+
<class>FourMarketing_FourDem_Helper</class>
|
| 150 |
+
</fourdem>
|
| 151 |
+
</helpers>
|
| 152 |
+
<events>
|
| 153 |
+
<adminhtml_init_system_config>
|
| 154 |
+
<observers>
|
| 155 |
+
<fourmarketing_fourdem>
|
| 156 |
+
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 157 |
+
<method>changeSystemConfig</method>
|
| 158 |
+
</fourmarketing_fourdem>
|
| 159 |
+
</observers>
|
| 160 |
+
</adminhtml_init_system_config>
|
| 161 |
+
|
| 162 |
+
<admin_system_config_changed_section_fourdem>
|
| 163 |
+
<observers>
|
| 164 |
+
<fourdem>
|
| 165 |
+
<type>singleton</type>
|
| 166 |
+
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 167 |
+
<method>check4DemConfiguration</method>
|
| 168 |
+
</fourdem>
|
| 169 |
+
</observers>
|
| 170 |
+
</admin_system_config_changed_section_fourdem>
|
| 171 |
+
<customer_register_success>
|
| 172 |
+
<observers>
|
| 173 |
+
<fourdem>
|
| 174 |
+
<type>singleton</type>
|
| 175 |
+
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 176 |
+
<method>subscribeCustomer</method>
|
| 177 |
+
</fourdem>
|
| 178 |
+
</observers>
|
| 179 |
+
</customer_register_success>
|
| 180 |
+
<customer_save_after>
|
| 181 |
+
<observers>
|
| 182 |
+
<fourdem>
|
| 183 |
+
<type>singleton</type>
|
| 184 |
+
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 185 |
+
<method>changeSubscribeEmail</method>
|
| 186 |
+
</fourdem>
|
| 187 |
+
</observers>
|
| 188 |
+
</customer_save_after>
|
| 189 |
+
<customer_address_save_after>
|
| 190 |
+
<observers>
|
| 191 |
+
<fourdem>
|
| 192 |
+
<type>singleton</type>
|
| 193 |
+
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 194 |
+
<method>collectionDataMapping</method>
|
| 195 |
+
</fourdem>
|
| 196 |
+
</observers>
|
| 197 |
+
</customer_address_save_after>
|
| 198 |
+
<checkout_submit_all_after>
|
| 199 |
+
<observers>
|
| 200 |
+
<fourdem>
|
| 201 |
+
<type>singleton</type>
|
| 202 |
+
<class>FourMarketing_FourDem_Model_Observer</class>
|
| 203 |
+
<method>subscribeCustomerAfterCheckout</method>
|
| 204 |
+
</fourdem>
|
| 205 |
+
</observers>
|
| 206 |
+
</checkout_submit_all_after>
|
| 207 |
+
</events>
|
| 208 |
+
</global>
|
| 209 |
</config>
|
app/code/community/FourMarketing/FourDem/etc/system.xml
CHANGED
|
@@ -1,15 +1,29 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<config>
|
| 3 |
<tabs>
|
| 4 |
-
<
|
| 5 |
<label><![CDATA[4Dem.it]]></label>
|
| 6 |
<sort_order>400</sort_order>
|
| 7 |
-
</
|
| 8 |
</tabs>
|
| 9 |
<sections>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
<fourdem translate="label" module="fourdem">
|
| 11 |
<label><![CDATA[Configurazione 4Dem.it]]></label>
|
| 12 |
-
<tab>
|
| 13 |
<sort_order>1000</sort_order>
|
| 14 |
<show_in_default>1</show_in_default>
|
| 15 |
<show_in_website>1</show_in_website>
|
|
@@ -88,7 +102,7 @@
|
|
| 88 |
<label>Lista Clienti</label>
|
| 89 |
<comment><![CDATA[Lista dei Clienti che hanno effettuato almeno un acquisto.]]></comment>
|
| 90 |
<frontend_type>multiselect</frontend_type>
|
| 91 |
-
<source_model>
|
| 92 |
<sort_order>60</sort_order>
|
| 93 |
<show_in_default>1</show_in_default>
|
| 94 |
<show_in_website>0</show_in_website>
|
|
@@ -99,7 +113,7 @@
|
|
| 99 |
<label>Iscritti alla Newsletter</label>
|
| 100 |
<comment><![CDATA[Lista degli iscritti alla newsletter.]]></comment>
|
| 101 |
<frontend_type>multiselect</frontend_type>
|
| 102 |
-
<source_model>
|
| 103 |
<sort_order>70</sort_order>
|
| 104 |
<show_in_default>1</show_in_default>
|
| 105 |
<show_in_website>0</show_in_website>
|
|
@@ -127,104 +141,122 @@ Una volta che i campi saranno disponibili potrai effettuare il mapping utilizzan
|
|
| 127 |
La mappatura campi non è obbligatoria, ma puà risultare molto utilie in quanto ti permetterà di personalizzare le email inserendo automaticamente i dati del destinatario, ad esempio Nome e Cognome
|
| 128 |
</div>]]></comment>
|
| 129 |
<fields>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
<firstname translate="comment">
|
| 131 |
<label>Nome</label>
|
| 132 |
<frontend_type>select</frontend_type>
|
| 133 |
-
<sort_order>
|
| 134 |
<show_in_default>1</show_in_default>
|
| 135 |
<show_in_website>1</show_in_website>
|
| 136 |
<show_in_store>1</show_in_store>
|
| 137 |
-
<source_model>
|
| 138 |
</firstname>
|
| 139 |
<lastname translate="comment">
|
| 140 |
<label>Cognome</label>
|
| 141 |
<frontend_type>select</frontend_type>
|
| 142 |
-
<sort_order>
|
| 143 |
<show_in_default>1</show_in_default>
|
| 144 |
<show_in_website>1</show_in_website>
|
| 145 |
<show_in_store>1</show_in_store>
|
| 146 |
-
<source_model>
|
| 147 |
</lastname>
|
| 148 |
<gender translate="comment">
|
| 149 |
<label>Genere</label>
|
| 150 |
<frontend_type>select</frontend_type>
|
| 151 |
-
<sort_order>
|
| 152 |
<show_in_default>1</show_in_default>
|
| 153 |
<show_in_website>1</show_in_website>
|
| 154 |
<show_in_store>1</show_in_store>
|
| 155 |
-
<source_model>
|
| 156 |
</gender>
|
| 157 |
<company translate="comment">
|
| 158 |
<label>Nome Azienda</label>
|
| 159 |
<frontend_type>select</frontend_type>
|
| 160 |
-
<sort_order>
|
| 161 |
<show_in_default>1</show_in_default>
|
| 162 |
<show_in_website>1</show_in_website>
|
| 163 |
<show_in_store>1</show_in_store>
|
| 164 |
-
<source_model>
|
| 165 |
</company>
|
| 166 |
<street translate="comment">
|
| 167 |
<label>Indirizzo</label>
|
| 168 |
<frontend_type>select</frontend_type>
|
| 169 |
-
<sort_order>
|
| 170 |
<show_in_default>1</show_in_default>
|
| 171 |
<show_in_website>1</show_in_website>
|
| 172 |
<show_in_store>1</show_in_store>
|
| 173 |
-
<source_model>
|
| 174 |
</street>
|
| 175 |
<city translate="comment">
|
| 176 |
<label>Città</label>
|
| 177 |
<frontend_type>select</frontend_type>
|
| 178 |
-
<sort_order>
|
| 179 |
<show_in_default>1</show_in_default>
|
| 180 |
<show_in_website>1</show_in_website>
|
| 181 |
<show_in_store>1</show_in_store>
|
| 182 |
-
<source_model>
|
| 183 |
</city>
|
| 184 |
<postcode translate="comment">
|
| 185 |
<label>CAP</label>
|
| 186 |
<frontend_type>select</frontend_type>
|
| 187 |
-
<sort_order>
|
| 188 |
<show_in_default>1</show_in_default>
|
| 189 |
<show_in_website>1</show_in_website>
|
| 190 |
<show_in_store>1</show_in_store>
|
| 191 |
-
<source_model>
|
| 192 |
</postcode>
|
| 193 |
<province translate="comment">
|
| 194 |
<label>Provincia</label>
|
| 195 |
<frontend_type>select</frontend_type>
|
| 196 |
-
<sort_order>
|
| 197 |
<show_in_default>1</show_in_default>
|
| 198 |
<show_in_website>1</show_in_website>
|
| 199 |
<show_in_store>1</show_in_store>
|
| 200 |
-
<source_model>
|
| 201 |
</province>
|
| 202 |
<region translate="comment">
|
| 203 |
<label>Regione</label>
|
| 204 |
<frontend_type>select</frontend_type>
|
| 205 |
-
<sort_order>
|
| 206 |
<show_in_default>1</show_in_default>
|
| 207 |
<show_in_website>1</show_in_website>
|
| 208 |
<show_in_store>1</show_in_store>
|
| 209 |
-
<source_model>
|
| 210 |
</region>
|
| 211 |
<country_id translate="comment">
|
| 212 |
<label>Nazione</label>
|
| 213 |
<frontend_type>select</frontend_type>
|
| 214 |
-
<sort_order>
|
| 215 |
<show_in_default>1</show_in_default>
|
| 216 |
<show_in_website>1</show_in_website>
|
| 217 |
<show_in_store>1</show_in_store>
|
| 218 |
-
<source_model>
|
| 219 |
</country_id>
|
| 220 |
<created_at translate="comment">
|
| 221 |
<label>Ultimo acquisto</label>
|
| 222 |
<frontend_type>select</frontend_type>
|
| 223 |
-
<sort_order>
|
| 224 |
<show_in_default>1</show_in_default>
|
| 225 |
<show_in_website>1</show_in_website>
|
| 226 |
<show_in_store>1</show_in_store>
|
| 227 |
-
<source_model>
|
| 228 |
</created_at>
|
| 229 |
</fields>
|
| 230 |
</fourdem_mapping>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<config>
|
| 3 |
<tabs>
|
| 4 |
+
<fourdem_config translate="label" module="fourdem">
|
| 5 |
<label><![CDATA[4Dem.it]]></label>
|
| 6 |
<sort_order>400</sort_order>
|
| 7 |
+
</fourdem_config>
|
| 8 |
</tabs>
|
| 9 |
<sections>
|
| 10 |
+
|
| 11 |
+
<!--
|
| 12 |
+
<fourdem_options translate="label" module="fourdem">
|
| 13 |
+
<label>Hello World Config Options</label>
|
| 14 |
+
<tab>fourdem_config</tab>
|
| 15 |
+
<frontend_type>text</frontend_type>
|
| 16 |
+
<sort_order>1000</sort_order>
|
| 17 |
+
<show_in_default>1</show_in_default>
|
| 18 |
+
<show_in_website>1</show_in_website>
|
| 19 |
+
<show_in_store>1</show_in_store>
|
| 20 |
+
</fourdem_options>
|
| 21 |
+
-->
|
| 22 |
+
|
| 23 |
+
|
| 24 |
<fourdem translate="label" module="fourdem">
|
| 25 |
<label><![CDATA[Configurazione 4Dem.it]]></label>
|
| 26 |
+
<tab>fourdem_config</tab>
|
| 27 |
<sort_order>1000</sort_order>
|
| 28 |
<show_in_default>1</show_in_default>
|
| 29 |
<show_in_website>1</show_in_website>
|
| 102 |
<label>Lista Clienti</label>
|
| 103 |
<comment><![CDATA[Lista dei Clienti che hanno effettuato almeno un acquisto.]]></comment>
|
| 104 |
<frontend_type>multiselect</frontend_type>
|
| 105 |
+
<source_model>fourdem/system_config_source_list</source_model>
|
| 106 |
<sort_order>60</sort_order>
|
| 107 |
<show_in_default>1</show_in_default>
|
| 108 |
<show_in_website>0</show_in_website>
|
| 113 |
<label>Iscritti alla Newsletter</label>
|
| 114 |
<comment><![CDATA[Lista degli iscritti alla newsletter.]]></comment>
|
| 115 |
<frontend_type>multiselect</frontend_type>
|
| 116 |
+
<source_model>fourdem/system_config_source_list</source_model>
|
| 117 |
<sort_order>70</sort_order>
|
| 118 |
<show_in_default>1</show_in_default>
|
| 119 |
<show_in_website>0</show_in_website>
|
| 141 |
La mappatura campi non è obbligatoria, ma puà risultare molto utilie in quanto ti permetterà di personalizzare le email inserendo automaticamente i dati del destinatario, ad esempio Nome e Cognome
|
| 142 |
</div>]]></comment>
|
| 143 |
<fields>
|
| 144 |
+
<website_id translate="comment">
|
| 145 |
+
<label>Magento Website</label>
|
| 146 |
+
<frontend_type>select</frontend_type>
|
| 147 |
+
<sort_order>1</sort_order>
|
| 148 |
+
<show_in_default>1</show_in_default>
|
| 149 |
+
<show_in_website>1</show_in_website>
|
| 150 |
+
<show_in_store>1</show_in_store>
|
| 151 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 152 |
+
</website_id>
|
| 153 |
+
<store_id translate="comment">
|
| 154 |
+
<label>Magento Store</label>
|
| 155 |
+
<frontend_type>select</frontend_type>
|
| 156 |
+
<sort_order>2</sort_order>
|
| 157 |
+
<show_in_default>1</show_in_default>
|
| 158 |
+
<show_in_website>1</show_in_website>
|
| 159 |
+
<show_in_store>1</show_in_store>
|
| 160 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 161 |
+
</store_id>
|
| 162 |
<firstname translate="comment">
|
| 163 |
<label>Nome</label>
|
| 164 |
<frontend_type>select</frontend_type>
|
| 165 |
+
<sort_order>10</sort_order>
|
| 166 |
<show_in_default>1</show_in_default>
|
| 167 |
<show_in_website>1</show_in_website>
|
| 168 |
<show_in_store>1</show_in_store>
|
| 169 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 170 |
</firstname>
|
| 171 |
<lastname translate="comment">
|
| 172 |
<label>Cognome</label>
|
| 173 |
<frontend_type>select</frontend_type>
|
| 174 |
+
<sort_order>11</sort_order>
|
| 175 |
<show_in_default>1</show_in_default>
|
| 176 |
<show_in_website>1</show_in_website>
|
| 177 |
<show_in_store>1</show_in_store>
|
| 178 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 179 |
</lastname>
|
| 180 |
<gender translate="comment">
|
| 181 |
<label>Genere</label>
|
| 182 |
<frontend_type>select</frontend_type>
|
| 183 |
+
<sort_order>12</sort_order>
|
| 184 |
<show_in_default>1</show_in_default>
|
| 185 |
<show_in_website>1</show_in_website>
|
| 186 |
<show_in_store>1</show_in_store>
|
| 187 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 188 |
</gender>
|
| 189 |
<company translate="comment">
|
| 190 |
<label>Nome Azienda</label>
|
| 191 |
<frontend_type>select</frontend_type>
|
| 192 |
+
<sort_order>14</sort_order>
|
| 193 |
<show_in_default>1</show_in_default>
|
| 194 |
<show_in_website>1</show_in_website>
|
| 195 |
<show_in_store>1</show_in_store>
|
| 196 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 197 |
</company>
|
| 198 |
<street translate="comment">
|
| 199 |
<label>Indirizzo</label>
|
| 200 |
<frontend_type>select</frontend_type>
|
| 201 |
+
<sort_order>15</sort_order>
|
| 202 |
<show_in_default>1</show_in_default>
|
| 203 |
<show_in_website>1</show_in_website>
|
| 204 |
<show_in_store>1</show_in_store>
|
| 205 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 206 |
</street>
|
| 207 |
<city translate="comment">
|
| 208 |
<label>Città</label>
|
| 209 |
<frontend_type>select</frontend_type>
|
| 210 |
+
<sort_order>16</sort_order>
|
| 211 |
<show_in_default>1</show_in_default>
|
| 212 |
<show_in_website>1</show_in_website>
|
| 213 |
<show_in_store>1</show_in_store>
|
| 214 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 215 |
</city>
|
| 216 |
<postcode translate="comment">
|
| 217 |
<label>CAP</label>
|
| 218 |
<frontend_type>select</frontend_type>
|
| 219 |
+
<sort_order>17</sort_order>
|
| 220 |
<show_in_default>1</show_in_default>
|
| 221 |
<show_in_website>1</show_in_website>
|
| 222 |
<show_in_store>1</show_in_store>
|
| 223 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 224 |
</postcode>
|
| 225 |
<province translate="comment">
|
| 226 |
<label>Provincia</label>
|
| 227 |
<frontend_type>select</frontend_type>
|
| 228 |
+
<sort_order>18</sort_order>
|
| 229 |
<show_in_default>1</show_in_default>
|
| 230 |
<show_in_website>1</show_in_website>
|
| 231 |
<show_in_store>1</show_in_store>
|
| 232 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 233 |
</province>
|
| 234 |
<region translate="comment">
|
| 235 |
<label>Regione</label>
|
| 236 |
<frontend_type>select</frontend_type>
|
| 237 |
+
<sort_order>19</sort_order>
|
| 238 |
<show_in_default>1</show_in_default>
|
| 239 |
<show_in_website>1</show_in_website>
|
| 240 |
<show_in_store>1</show_in_store>
|
| 241 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 242 |
</region>
|
| 243 |
<country_id translate="comment">
|
| 244 |
<label>Nazione</label>
|
| 245 |
<frontend_type>select</frontend_type>
|
| 246 |
+
<sort_order>20</sort_order>
|
| 247 |
<show_in_default>1</show_in_default>
|
| 248 |
<show_in_website>1</show_in_website>
|
| 249 |
<show_in_store>1</show_in_store>
|
| 250 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 251 |
</country_id>
|
| 252 |
<created_at translate="comment">
|
| 253 |
<label>Ultimo acquisto</label>
|
| 254 |
<frontend_type>select</frontend_type>
|
| 255 |
+
<sort_order>21</sort_order>
|
| 256 |
<show_in_default>1</show_in_default>
|
| 257 |
<show_in_website>1</show_in_website>
|
| 258 |
<show_in_store>1</show_in_store>
|
| 259 |
+
<source_model>fourdem/adminhtml_system_source_fields</source_model>
|
| 260 |
</created_at>
|
| 261 |
</fields>
|
| 262 |
</fourdem_mapping>
|
app/code/community/FourMarketing/FourDem/sql/{fourmarketing_fourdem_setup → fourdem_setup}/mysql4-install-0.1.0.php
RENAMED
|
@@ -4,8 +4,9 @@ $installer = $this;
|
|
| 4 |
$installer->startSetup();
|
| 5 |
|
| 6 |
$installer->run("
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
firstname text NOT NULL,
|
| 10 |
lastname text NOT NULL,
|
| 11 |
email_address text NOT NULL,
|
| 4 |
$installer->startSetup();
|
| 5 |
|
| 6 |
$installer->run("
|
| 7 |
+
-- DROP TABLE IF EXISTS fourdem_users;
|
| 8 |
+
CREATE TABLE fourdem_users(
|
| 9 |
+
fourdem_id int(11) NOT NULL,
|
| 10 |
firstname text NOT NULL,
|
| 11 |
lastname text NOT NULL,
|
| 12 |
email_address text NOT NULL,
|
app/design/adminhtml/default/default/layout/fourdem.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
e<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<fourdem_adminhtml_fourdem_index>
|
| 4 |
+
<reference name="content">
|
| 5 |
+
<block type="fourdem/adminhtml_fourdem" name="fourdem"/>
|
| 6 |
+
</reference>
|
| 7 |
+
</fourdem_adminhtml_fourdem_index>
|
| 8 |
+
</layout>
|
app/design/adminhtml/default/default/layout/fourmarketing/fourdem.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout>
|
| 3 |
+
<adminhtml_users_index>
|
| 4 |
+
<reference name="content">
|
| 5 |
+
<block type="fourmarketing_fourdem/adminhtml_users" name="fourmarketing_fourdem_users"/>
|
| 6 |
+
</reference>
|
| 7 |
+
</adminhtml_users_index>
|
| 8 |
+
</layout>
|
app/design/frontend/default/default/template/fourdem/subscribe.phtml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$titoloBox = Mage::getStoreConfig('fourdem/box_newsletter/title_box');
|
| 3 |
+
$testoBox = Mage::getStoreConfig('fourdem/box_newsletter/text_box');
|
| 4 |
+
$isSelectList = Mage::getStoreConfig('fourdem/system_access/select_list');
|
| 5 |
+
?>
|
| 6 |
+
<?php if($isSelectList): ?>
|
| 7 |
+
<style type="text/css">
|
| 8 |
+
.mini-newsletter .head{ background: url("../images/base-mini-bg.jpg") no-repeat; }
|
| 9 |
+
.mini-newsletter .head h4{ text-align: left!important; }
|
| 10 |
+
.mini-newsletter .input-text{ margin:5px 0px 5px 0px; width: 170px; }
|
| 11 |
+
.mini-newsletter button{ margin:5px 0 15px; 0; }
|
| 12 |
+
</style>
|
| 13 |
+
<div class="box base-mini mini-newsletter">
|
| 14 |
+
<div class="head">
|
| 15 |
+
<h4><?php echo $this->__($titoloBox); ?><a name="newsletter-box"></a></h4>
|
| 16 |
+
</div>
|
| 17 |
+
<form action="<?php echo $this->getUrl('fourdem/subscribers/new') ?>" method="post" id="newsletter-validate-detail">
|
| 18 |
+
<fieldset class="content">
|
| 19 |
+
<label for="newsletter"><?php echo $this->__($testoBox); ?>:</label>
|
| 20 |
+
<div class="input-box">
|
| 21 |
+
<input name="email" type="text" id="newsletter" value="Indirizzo Email" class="required-entry validate-email input-text"/>
|
| 22 |
+
</div>
|
| 23 |
+
<button class="button" title="Iscriviti alla Newsletter" type="submit">
|
| 24 |
+
<span><span>Iscriviti Ora</span></span>
|
| 25 |
+
</button>
|
| 26 |
+
<input type="hidden" name="ip-address" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>"/>
|
| 27 |
+
</fieldset>
|
| 28 |
+
</form>
|
| 29 |
+
</div>
|
| 30 |
+
<script type="text/javascript">
|
| 31 |
+
<!--
|
| 32 |
+
var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
|
| 33 |
+
new Varien.searchForm('newsletter-validate-detail', 'newsletter', '<?php echo $this->helper('newsletter')->__('Indirizzo Email'); ?>');
|
| 34 |
+
//-->
|
| 35 |
+
</script>
|
| 36 |
+
<?php endif; ?>
|
package.xml
CHANGED
|
@@ -1,22 +1,22 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>4Dem_Integration_community</name>
|
| 4 |
-
<version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.4dem.it/disclaimer">Open Software License (OSL)</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Integrate Magento Users and Newsletter Subscribers with 4Dem.it Email Marketing Platform</summary>
|
| 10 |
-
<description>This extension provide a one way synchronization of the magento users data with a list on the 4Dem.it email marketing platform
|
| 11 |
-
|
| 12 |
-
User data and subscription preferences are authomatically synced and managed.
|
| 13 |

|
| 14 |
-
|
| 15 |
-
|
|
|
|
| 16 |
<authors><author><name>4Marketing.it</name><user>techsupport4mkt</user><email>ugo.reynaldi@4marketing.it</email></author></authors>
|
| 17 |
-
<date>2014-
|
| 18 |
-
<time>
|
| 19 |
-
<contents><target name="magecommunity"><dir name="FourMarketing"><dir name="FourDem"><dir
|
| 20 |
<compatible/>
|
| 21 |
-
<dependencies><required><php><min>
|
| 22 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>4Dem_Integration_community</name>
|
| 4 |
+
<version>2.0.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.4dem.it/disclaimer">Open Software License (OSL)</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Integrate Magento Users and Newsletter Subscribers with 4Dem.it Email Marketing Platform</summary>
|
| 10 |
+
<description>This extension provide a one way synchronization of the magento users data with a list on the 4Dem.it email marketing platform. Every new user registered on Magento and subscribed to the newsletter is synced with a subscribers list in 4Dem.it. User data and subscription preferences are automatically synchronized and managed. This extension also provide a new newsletter only registration in magento frontend. Each visitor that subscribe using the provided newsletter form is put inside a 4Dem.it subscribers list.</description>
|
| 11 |
+
<notes>Version 2.0.0 Release Notes
|
|
|
|
| 12 |

|
| 13 |
+
- Added WebsiteID and StoreID data management
|
| 14 |
+
- Added Customer custom fields detection
|
| 15 |
+
- Multi store support</notes>
|
| 16 |
<authors><author><name>4Marketing.it</name><user>techsupport4mkt</user><email>ugo.reynaldi@4marketing.it</email></author></authors>
|
| 17 |
+
<date>2014-05-27</date>
|
| 18 |
+
<time>09:29:38</time>
|
| 19 |
+
<contents><target name="magecommunity"><dir name="FourMarketing"><dir name="FourDem"><dir name="Block"><dir name="Adminhtml"><dir name="FourDem"><file name="Grid.php" hash="f2b21f458237e5dca1e650be724a0ac7"/></dir><file name="FourDem.php" hash="a658696b9bd4f913e222ca07950cdb65"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Mapfields.php" hash="4646e704ae708179a32c655ffa0e6d21"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="3945c088ef7a804d6e2994eb64f5de2e"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Source"><file name="Fields.php" hash="4085a2528df1ffc5fce044948fada18f"/></dir></dir></dir><file name="FourDem.php" hash="ae211c790a810d12d4bd5ecc706e39a9"/><dir name="Mysql4"><dir name="FourDem"><file name="Collection.php" hash="b58bdda2eaad377d02675facc141be6f"/></dir><file name="FourDem.php" hash="9ea9597ba4eefa25c057fae7b638799a"/></dir><file name="Observer.php" hash="cea5e9f11987df4ae0576e6b75611f63"/><dir name="System"><dir name="Config"><dir name="Source"><file name="List.php" hash="3821c86713534e1aa92cf455687655c0"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FourDemController.php" hash="3a235aadc7748f35d92642f1694b436a"/></dir><file name="SubscribersController.php" hash="30ae20725949ff4d061738bab0d46b03"/></dir><dir name="etc"><file name="adminhtml.old" hash="6b93f7de0de2360e133df06e928be9b3"/><file name="config.xml" hash="2fb22202df75f8ac259879be5ac6fca6"/><file name="system.xml" hash="83f5f1c2c2028bd96d6fa5d02ab1b9fa"/></dir><dir name="sql"><dir name="fourdem_setup"><file name="mysql4-install-0.1.0.php" hash="afe4444211d01ce32161c22bf9f4676f"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="fourdem.xml" hash="4cdb947b36365d26b3e94b732cfbd35e"/></dir></dir></dir></dir><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="fourdem"><dir name="form"><file name="register-customer.phtml" hash="cbe26dfdb19ac6444d96ed1dc389ec51"/></dir><file name="subscribe.phtml" hash="9eded5d0cbf2402175109408c8255296"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="fourdem.xml" hash="dbce3504aa0896b435ab2360bf84397f"/><dir name="fourmarketing"><file name="fourdem.xml" hash="0f9566d4d348347b2778191dce364d89"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FourMarketing_FourDem.xml" hash="708a31c59e03b1c719335822113a6908"/></dir></target></contents>
|
| 20 |
<compatible/>
|
| 21 |
+
<dependencies><required><php><min>4.3.0</min><max>6.0.0</max></php></required></dependencies>
|
| 22 |
</package>
|
