customerhelper - Version 1.0.0

Version Notes

First stable release

Download this release

Release Info

Developer Matthias Kleine
Extension customerhelper
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/MKleine/Helpcustomers/Helper/Data.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class MKleine_Helpcustomers_Helper_Data extends Mage_Core_Helper_Abstract
22
+ {
23
+
24
+ }
app/code/community/MKleine/Helpcustomers/Model/Customer.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class MKleine_Helpcustomers_Model_Customer extends Mage_Customer_Model_Customer
22
+ {
23
+ public function validatePassword($password)
24
+ {
25
+ $return = parent::validatePassword($password);
26
+
27
+ $customerId = $this->getId();
28
+ $storeId = $this->getStore()->getId();
29
+
30
+ // Password incorrect / Login failed
31
+ if (!$return && $customerId) {
32
+ /** @var $model MKleine_Helpcustomers_Model_Faillog */
33
+ $model = Mage::getModel('mk_helpcustomers/faillog');
34
+ $model->loadFaillogByCustomerId($customerId);
35
+
36
+ $failCount = $model->getFailCount() ? $model->getFailCount() : 0;
37
+
38
+ if (!$model->getId()) {
39
+ $model->setCustomerId($customerId);
40
+ }
41
+
42
+ $model->setStoreId($storeId);
43
+ $model->setFailCount(++$failCount);
44
+ $model->setUpdatedAt(Mage::getModel('core/date')->timestamp(time()));
45
+ $model->save();
46
+
47
+ // Send event
48
+ Mage::dispatchEvent('mk_helpcustomers_login_failed', array(
49
+ 'customer' => $this,
50
+ 'fail_count' => $failCount,
51
+ 'password' => $password
52
+ ));
53
+ }
54
+
55
+ return $return;
56
+ }
57
+ }
app/code/community/MKleine/Helpcustomers/Model/Faillog.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class MKleine_Helpcustomers_Model_Faillog extends Mage_Customer_Model_Customer
22
+ {
23
+ public function _construct()
24
+ {
25
+ parent::_construct();
26
+ $this->_init('mk_helpcustomers/faillog');
27
+ }
28
+
29
+ /**
30
+ * Loads a faillog by a specific variable
31
+ * @param $customerId Id of customer
32
+ * @return $this MKleine_Helpcustomers_Model_Faillog
33
+ */
34
+ public function loadFaillogByCustomerId($customerId)
35
+ {
36
+ $this->load($customerId, 'customer_id');
37
+ return $this;
38
+ }
39
+
40
+ public function delete() {
41
+ Mage::register('isSecureArea', true);
42
+ $ret = parent::delete();
43
+ Mage::unregister('isSecureArea');
44
+
45
+ return $ret;
46
+ }
47
+ }
app/code/community/MKleine/Helpcustomers/Model/Mailer.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class MKleine_Helpcustomers_Model_Mailer extends Mage_Core_Model_Abstract
22
+ {
23
+ const XML_PATH_EXTENSION_ACTIVE = 'customer/helpcustomers/active';
24
+ const XML_PATH_LOGON_FAIL_EMAIL_TEMPLATE = 'customer/helpcustomers/logon_fail_email_template';
25
+
26
+ public function sendMails()
27
+ {
28
+ $timeGap = Mage::getModel('core/date')->Date(null, time() - 10 * 60);
29
+
30
+ /** @var $collection MKleine_Helpcustomers_Model_Mysql4_Faillog_Collection */
31
+ $collection = Mage::getModel('mk_helpcustomers/faillog')->getCollection();
32
+ $collection->addFieldToFilter('updated_at', array('lt' => $timeGap));
33
+ $collection->load();
34
+
35
+ /** @var $failItem MKleine_Helpcustomers_Model_Faillog */
36
+ foreach ($collection as $failItem) {
37
+ $mailTemplateId = Mage::getStoreConfig(self::XML_PATH_LOGON_FAIL_EMAIL_TEMPLATE, $failItem->getStoreId());
38
+
39
+ // Check if module is active for given store
40
+ if ($mailTemplateId && Mage::getStoreConfig(self::XML_PATH_EXTENSION_ACTIVE, $failItem->getStoreId())) {
41
+
42
+ /** @var $customer MKleine_Helpcustomers_Model_Customer */
43
+ $customer = Mage::getModel('customer/customer')
44
+ ->setWebsiteId(Mage::app()->getStore($failItem->getStoreId())->getWebsiteId())
45
+ ->load($failItem->getCustomerId());
46
+
47
+ if ($customer->getId()) {
48
+ /** @var $mailer Mage_Core_Model_Email_Template_Mailer */
49
+ $mailer = Mage::getModel('core/email_template_mailer');
50
+ $emailInfo = Mage::getModel('core/email_info');
51
+
52
+ $emailInfo->addTo($customer->getEmail(), $customer->getName());
53
+
54
+ $mailer->addEmailInfo($emailInfo);
55
+
56
+ // Set all required params and send emails
57
+ $mailer->setSender(Mage::getStoreConfig(Mage_Admin_Model_User::XML_PATH_FORGOT_EMAIL_IDENTITY, $failItem->getStoreId()));
58
+ $mailer->setStoreId($failItem->getStoreId());
59
+ $mailer->setTemplateId($mailTemplateId);
60
+
61
+ $mailer->setTemplateParams(array(
62
+ 'customer' => $customer,
63
+ 'failcount' => $failItem->getFailCount()
64
+ ));
65
+
66
+ // Send the mail
67
+ $mailer->send();
68
+
69
+ $failItem->delete();
70
+
71
+ Mage::dispatchEvent('mk_helpcustomers_fail_login_mail_sent', array(
72
+ 'customer' => $customer,
73
+ 'fail_count' => $failItem->getFailCount(),
74
+ 'mailer' => $mailer
75
+ ));
76
+ }
77
+
78
+ }
79
+ }
80
+
81
+ return $this;
82
+ }
83
+ }
app/code/community/MKleine/Helpcustomers/Model/Mysql4/Faillog.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class MKleine_Helpcustomers_Model_Mysql4_Faillog extends Mage_Core_Model_Mysql4_Abstract
22
+ {
23
+ public function _construct()
24
+ {
25
+ // Note that the maillog_id refers to the key field in your database table.
26
+ $this->_init('mk_helpcustomers/faillog', 'faillog_id');
27
+ }
28
+ }
app/code/community/MKleine/Helpcustomers/Model/Mysql4/Faillog/Collection.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class MKleine_Helpcustomers_Model_Mysql4_Faillog_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
22
+ {
23
+ public function _construct()
24
+ {
25
+ parent::_construct();
26
+ $this->_init('mk_helpcustomers/faillog');
27
+ }
28
+ }
app/code/community/MKleine/Helpcustomers/Model/Observer.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class MKleine_Helpcustomers_Model_Observer extends Mage_Core_Model_Abstract
22
+ {
23
+ /**
24
+ * Will be called when a customer is authenticated successfully
25
+ * @param $observer
26
+ */
27
+ public function customer_customer_authenticated($observer)
28
+ {
29
+ /** @var $customer Mage_Customer_Model_Customer */
30
+ $customer = $observer->getModel();
31
+
32
+ if ($customerId = $customer->getId()) {
33
+ /** @var $model MKleine_Helpcustomers_Model_Faillog */
34
+ $model = Mage::getModel('mk_helpcustomers/faillog');
35
+ $model->loadFaillogByCustomerId($customerId);
36
+
37
+ if ($model->getId()) {
38
+ $model->delete();
39
+ }
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Will be called by the cron job every 10 Minutes and sends a mail
45
+ * to all customers which failed to login
46
+ */
47
+ public static function send_mail()
48
+ {
49
+ /** @var $mailModel MKleine_Helpcustomers_Model_Mailer */
50
+ $mailModel = Mage::getSingleton('mk_helpcustomers/mailer');
51
+ $mailModel->sendMails();
52
+ }
53
+ }
app/code/community/MKleine/Helpcustomers/Test/Model/Faillog.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class MKleine_Helpcustomers_Test_Model_Faillog extends EcomDev_PHPUnit_Test_Case
22
+ {
23
+
24
+ public function testInsert()
25
+ {
26
+ /** @var $model MKleine_Helpcustomers_Model_Faillog */
27
+ $model = Mage::getModel('mk_helpcustomers/faillog');
28
+
29
+
30
+ }
31
+
32
+ }
app/code/community/MKleine/Helpcustomers/Test/Model/Mailer.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class MKleine_Helpcustomers_Test_Model_Mailer extends EcomDev_PHPUnit_Test_Case
22
+ {
23
+ protected function setUp()
24
+ {
25
+ parent::setUp();
26
+
27
+
28
+ }
29
+
30
+ public function testSendMails()
31
+ {
32
+ /** @var $mailModel MKleine_Helpcustomers_Model_Mailer */
33
+ $mailModel = Mage::getSingleton('mk_helpcustomers/mailer');
34
+ $mailModel->sendMails();
35
+
36
+ //$this->assertTrue(true);
37
+ }
38
+
39
+ protected function tearDown()
40
+ {
41
+ parent::tearDown();
42
+
43
+
44
+ }
45
+ }
app/code/community/MKleine/Helpcustomers/etc/config.xml ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MKleine_Helpcustomers>
5
+ <version>1.0.0</version>
6
+ </MKleine_Helpcustomers>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <mk_helpcustomers>
11
+ <class>MKleine_Helpcustomers_Block</class>
12
+ </mk_helpcustomers>
13
+ </blocks>
14
+ <models>
15
+ <mk_helpcustomers>
16
+ <class>MKleine_Helpcustomers_Model</class>
17
+ <resourceModel>mk_helpcustomers_mysql4</resourceModel>
18
+ </mk_helpcustomers>
19
+ <mk_helpcustomers_mysql4>
20
+ <class>MKleine_Helpcustomers_Model_Mysql4</class>
21
+ <entities>
22
+ <faillog>
23
+ <table>helpcustomers_faillog</table>
24
+ </faillog>
25
+ </entities>
26
+ </mk_helpcustomers_mysql4>
27
+ <customer>
28
+ <rewrite>
29
+ <customer>MKleine_Helpcustomers_Model_Customer</customer>
30
+ </rewrite>
31
+ </customer>
32
+ </models>
33
+ <helpers>
34
+ <mk_helpcustomers>
35
+ <class>MKleine_Helpcustomers_Helper</class>
36
+ </mk_helpcustomers>
37
+ </helpers>
38
+ <resources>
39
+ <helpcustomers_setup>
40
+ <setup>
41
+ <module>MKleine_Helpcustomers</module>
42
+ </setup>
43
+ <connection>
44
+ <use>core_setup</use>
45
+ </connection>
46
+ </helpcustomers_setup>
47
+ <helpcustomers_write>
48
+ <connection>
49
+ <use>core_write</use>
50
+ </connection>
51
+ </helpcustomers_write>
52
+ <helpcustomers_read>
53
+ <connection>
54
+ <use>core_read</use>
55
+ </connection>
56
+ </helpcustomers_read>
57
+ </resources>
58
+ <template>
59
+ <email>
60
+ <customer_helpcustomers_logon_fail_email_template translate="label" module="mk_helpcustomers">
61
+ <label>Logon fail template</label>
62
+ <file>logon_fail_template.html</file>
63
+ <type>html</type>
64
+ </customer_helpcustomers_logon_fail_email_template>
65
+ </email>
66
+ </template>
67
+ </global>
68
+ <frontend>
69
+ <events>
70
+ <customer_customer_authenticated>
71
+ <observers>
72
+ <mk_helpcustomers_customer_customer_authenticated>
73
+ <type>singleton</type>
74
+ <class>mk_helpcustomers/observer</class>
75
+ <method>customer_customer_authenticated</method>
76
+ </mk_helpcustomers_customer_customer_authenticated>
77
+ </observers>
78
+ </customer_customer_authenticated>
79
+ </events>
80
+ </frontend>
81
+ <adminhtml>
82
+ <translate>
83
+ <modules>
84
+ <mk_helpcustomers>
85
+ <files>
86
+ <default>MKleine_Helpcustomers.csv</default>
87
+ </files>
88
+ </mk_helpcustomers>
89
+ </modules>
90
+ </translate>
91
+ </adminhtml>
92
+ <crontab>
93
+ <jobs>
94
+ <mk_helpcustomers_send_mail>
95
+ <schedule>
96
+ <cron_expr>*/10 * * * *</cron_expr>
97
+ </schedule>
98
+ <run>
99
+ <model>mk_helpcustomers/observer::send_mail</model>
100
+ </run>
101
+ </mk_helpcustomers_send_mail>
102
+ </jobs>
103
+ </crontab>
104
+ <default>
105
+ <customer>
106
+ <helpcustomers>
107
+ <active>1</active>
108
+ <logon_fail_email_template>customer_helpcustomers_logon_fail_email_template</logon_fail_email_template>
109
+ </helpcustomers>
110
+ </customer>
111
+ </default>
112
+ <phpunit>
113
+ <suite>
114
+ <modules>
115
+ <MKleine_Helpcustomers />
116
+ </modules>
117
+ </suite>
118
+ </phpunit>
119
+ </config>
app/code/community/MKleine/Helpcustomers/etc/system.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <sections>
5
+ <customer>
6
+ <groups>
7
+ <helpcustomers translate="label">
8
+ <label>Help Customers Extension</label>
9
+ <sort_order>50</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label comment">
15
+ <label>Extension active</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <comment>Defines if the extension is active</comment>
19
+ <sort_order>10</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>1</show_in_store>
23
+ </active>
24
+ <logon_fail_email_template translate="label">
25
+ <label>Logon Fail Email Template</label>
26
+ <frontend_type>select</frontend_type>
27
+ <source_model>adminhtml/system_config_source_email_template</source_model>
28
+ <sort_order>20</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ </logon_fail_email_template>
33
+ </fields>
34
+ </helpcustomers>
35
+ </groups>
36
+ </customer>
37
+ </sections>
38
+ </config>
app/code/community/MKleine/Helpcustomers/sql/helpcustomers_setup/mysql4-install-0.0.1.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MKleine - (c) Matthias Kleine
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@mkleine.de so we can send you a copy immediately.
15
+ *
16
+ * @category MKleine
17
+ * @package MKleine_Helpcustomers
18
+ * @copyright Copyright (c) 2013 Matthias Kleine (http://mkleine.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ /** @var $installer Mage_Core_Model_Resource_Setup */
23
+ $installer = $this;
24
+
25
+ $installer->startSetup();
26
+
27
+ $installer->run("
28
+
29
+ CREATE TABLE IF NOT EXISTS {$this->getTable('helpcustomers_faillog')} (
30
+ `faillog_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
31
+ `store_id` smallint(5) unsigned NOT NULL COMMENT 'Store Id',
32
+ `customer_id` int(10) unsigned NOT NULL,
33
+ `fail_count` int(3) unsigned NOT NULL,
34
+ `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Created At',
35
+ `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Updated At',
36
+ PRIMARY KEY (`faillog_id`)
37
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
38
+
39
+ ");
40
+
41
+ /** @var $connection Varien_Db_Adapter_Pdo_Mysql */
42
+ $connection = $installer->getConnection();
43
+
44
+ $connection->addIndex(
45
+ $this->getTable('helpcustomers_faillog'),
46
+ $installer->getIdxName(
47
+ $this->getTable('helpcustomers_faillog'),
48
+ array('customer_id'),
49
+ Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
50
+ ),
51
+ array('customer_id'),
52
+ Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
53
+ );
54
+
55
+ $installer->endSetup();
app/etc/modules/MKleine_Helpcustomers.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MKleine_Helpcustomers>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </MKleine_Helpcustomers>
8
+ </modules>
9
+ </config>
app/locale/de_DE/MKleine_Helpcustomers.csv ADDED
File without changes
app/locale/de_DE/template/email/logon_fail_template.html ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Gibt es ein Problem mit der Anmeldung? @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "htmlescape var=$customer.name":"Customer Name",
6
+ "store url=\"customer/account/\"":"Customer Account Url",
7
+ "var customer.email":"Customer Email",
8
+ "htmlescape var=$customer.password":"Customer Password"}
9
+ @-->
10
+
11
+ <!--@styles
12
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
13
+ @-->
14
+
15
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
16
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
17
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
18
+ <tr>
19
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
20
+ <!-- [ header starts here] -->
21
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
22
+ <tr>
23
+ <td valign="top">
24
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a>
25
+ </td>
26
+ </tr>
27
+ <!-- [ middle starts here] -->
28
+ <tr>
29
+ <td valign="top">
30
+ <h1 style="font-size:14px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Guten Tag {{htmlescape var=$customer.name}},</h1>
31
+ <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">es sieht so aus, als ob es ein Problem mit der Anmeldung gibt. Haben Sie Ihr Passwort vergessen?</p>
32
+ <p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0; padding:13px 18px; background:#f9f9f9;">
33
+ Bisher haben Sie sich {{$failcount}} Mal falsch angemeldet. Sie können <a href="{{store url="customer/account/forgotpassword"}}">diesen Link</a> nutzen, um Ihr Passwort zurücksetzen zu lassen.
34
+ </p>
35
+ <p style="font-size:12px; line-height:16px; margin:16px 0 0 0;">
36
+ Falls Sie Fragen oder Anregungen haben, kontaktieren Sie uns bitte wahlweise per E-Mail
37
+ <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a>
38
+ oder auch gerne per Telefon unter der Rufnummer {{config path='general/store_information/phone'}}.
39
+ </p>
40
+ </td>
41
+ </tr>
42
+ <tr>
43
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;">
44
+ <center>
45
+ <p style="font-size:12px; margin:0;"><strong>{{var store.getFrontendName()}}</strong></p>
46
+ </center>
47
+ </td>
48
+ </tr>
49
+ </table>
50
+ </td>
51
+ </tr>
52
+ </table>
53
+ </div>
54
+ </body>
app/locale/en_US/MKleine_Helpcustomers.csv ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Category Merge","Category Merge"
2
+ "Is Active","Is Active"
3
+ "Merge to and delete current","Merge to and delete current"
4
+ "Are your sure you want to merge into that category and delete %s?","Are your sure you want to merge into that category and delete %s?"
5
+ "Merge to and keep current","Merge to and keep current"
6
+ "Are your sure you want to merge into that category and keep %s?","Are your sure you want to merge into that category and keep %s?"
7
+ "Merge into current and delete source","Merge into current and delete source"
8
+ "Are your sure you want to merge into %s and delete that category?","Are your sure you want to merge into %s and delete that category?"
9
+ "Merge into current and keep source","Merge into current and keep source"
10
+ "Are your sure you want to merge into %s and keep that category?","Are your sure you want to merge into %s and keep that category?"
11
+ "Category merge failed","Category merge failed"
12
+ "Your categories have been merged successfully","Your categories have been merged successfully"
13
+ "Action From","Action From"
14
+ "Action To","Action To"
app/locale/en_US/template/email/logon_fail_template.html ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject You had a logon issue? @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "htmlescape var=$customer.name":"Customer Name",
6
+ "store url=\"customer/account/\"":"Customer Account Url",
7
+ "var customer.email":"Customer Email",
8
+ "htmlescape var=$customer.password":"Customer Password"}
9
+ @-->
10
+
11
+ <!--@styles
12
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
13
+ @-->
14
+
15
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
16
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
17
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
18
+ <tr>
19
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
20
+ <!-- [ header starts here] -->
21
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
22
+ <tr>
23
+ <td valign="top">
24
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a>
25
+ </td>
26
+ </tr>
27
+ <!-- [ middle starts here] -->
28
+ <tr>
29
+ <td valign="top">
30
+ <h1 style="font-size:14px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{htmlescape var=$customer.name}},</h1>
31
+ <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">it seems like you had some trouble during logon. Did you forget your password?</p>
32
+ <p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0; padding:13px 18px; background:#f9f9f9;">
33
+ You've entered an incorrect password for {{$failcount}} times. Please use <a href="{{store url="customer/account/forgotpassword"}}">this link</a> to create a new password.
34
+ </p>
35
+ <p style="font-size:12px; line-height:16px; margin:16px 0 0 0;">
36
+ If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.
37
+ </p>
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;">
42
+ <center>
43
+ <p style="font-size:12px; margin:0;"><strong>{{var store.getFrontendName()}}</strong></p>
44
+ </center>
45
+ </td>
46
+ </tr>
47
+ </table>
48
+ </td>
49
+ </tr>
50
+ </table>
51
+ </div>
52
+ </body>
package.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>customerhelper</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension will help customers to logon when they lost their login information and informs them by mail.</summary>
10
+ <description>Sends an email after a given time range to customers which failed to login.&#xD;
11
+ &#xD;
12
+ 1. A customer tries to logon several times with a wrong password&#xD;
13
+ 2. Failed tries will be logged into the database&#xD;
14
+ 3. If the logon is successful, the fail entry will be deleted from the database&#xD;
15
+ 4. A cron job checks for customers which failed to login every 10 minutes&#xD;
16
+ 5. All customers are informed by mail that they failed to logon&#xD;
17
+ 6. The customer uses a link in the mail to reset their password&#xD;
18
+ &#xD;
19
+ This extension should stop frustration of customers if they fail to logon because of forgotten passwords.</description>
20
+ <notes>First stable release</notes>
21
+ <authors><author><name>Matthias Kleine</name><user>mkleine</user><email>development@mkleine.de</email></author></authors>
22
+ <date>2014-01-11</date>
23
+ <time>01:00:03</time>
24
+ <contents><target name="magecommunity"><dir name="MKleine"><dir name="Helpcustomers"><dir name="Helper"><file name="Data.php" hash="b9b950d26676382176364ec91129747b"/></dir><dir name="Model"><file name="Customer.php" hash="4582030892803a13af78211c1f594692"/><file name="Faillog.php" hash="19d6eda8f1f88c2f2acee008099b526b"/><file name="Mailer.php" hash="46d26fcd482b26ab64a465a18316bb11"/><dir name="Mysql4"><dir name="Faillog"><file name="Collection.php" hash="4d008019db95b945b9e22c53ee8835d9"/></dir><file name="Faillog.php" hash="65194debd0445bb9a30ccf4cf4f88bbc"/></dir><file name="Observer.php" hash="c3a80d77e7cc651ffee1488251bae218"/></dir><dir name="Test"><dir name="Model"><file name="Faillog.php" hash="021d9c77043e6e5320b5317429356fe3"/><file name="Mailer.php" hash="0829e26973c15ad93e3909def48d9825"/></dir></dir><dir name="etc"><file name="config.xml" hash="dfb210ab406151c4ff65d2c01265dc95"/><file name="system.xml" hash="64f0faf71d9ac42cfb078742520ce516"/></dir><dir name="sql"><dir name="helpcustomers_setup"><file name="mysql4-install-0.0.1.php" hash="965ebee8c1e50b83d482a0347b06ebd0"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MKleine_Helpcustomers.xml" hash="59b384b4def33c4348cec12bed9b2ecf"/></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="MKleine_Helpcustomers.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="template"><dir name="email"><file name="logon_fail_template.html" hash="628a319fae86af906b7ee4e175f2729c"/></dir></dir></dir><dir name="en_US"><file name="MKleine_Helpcustomers.csv" hash="5af9f9b0bb3be1e8e448108c54db6939"/><dir name="template"><dir name="email"><file name="logon_fail_template.html" hash="6d3ef348bcbb3063def909cc60b88d71"/></dir></dir></dir></dir></target></contents>
25
+ <compatible/>
26
+ <dependencies><required><php><min>5.2.0</min><max>5.5.0</max></php></required></dependencies>
27
+ </package>