build_email_list - Version 1.0.0.0

Version Notes

Build email list Community Module

Download this release

Release Info

Developer StrApp
Extension build_email_list
Version 1.0.0.0
Comparing to
See all releases


Version 1.0.0.0

app/code/local/Strapp/Buildemaillist/Helper/Data.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Strapp Build email list Module
4
+ *
5
+ * @category Strapp
6
+ * @package Strapp_Buildemaillist
7
+ */
8
+ class Strapp_Buildemaillist_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+
11
+ }
app/code/local/Strapp/Buildemaillist/Model/Export/Csv.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Strapp Build email list Module
4
+ *
5
+ * @category Strapp
6
+ * @package Strapp_Buildemaillist
7
+ */
8
+ class Strapp_Buildemaillist_Model_Export_Csv extends Mage_Core_Model_Abstract
9
+ {
10
+ const ENCLOSURE = '"';
11
+ const DELIMITER = ",";
12
+
13
+ public function exportSubscribers()
14
+ {
15
+ $fileName = 'email_list_'.date("Ymd_His").'.csv';
16
+ $fp = fopen(Mage::getBaseDir('var').'/export/'.$fileName, 'w');
17
+ $this->writeHeadRow($fp);
18
+ $customerArray = array();
19
+ $customerCollection = Mage::getModel('customer/customer')->getCollection()
20
+ ->addAttributeToSelect('firstname')
21
+ ->addAttributeToSelect('lastname')
22
+ ->addAttributeToSelect('email');
23
+
24
+ //For getting customers collection
25
+ foreach($customerCollection as $customer)
26
+ {
27
+ array_push($customerArray,$customer->getEmail());
28
+ $record = array($customer->getFirstname(),$customer->getLastname(),$customer->getEmail());
29
+ fputcsv($fp,$record, self::DELIMITER, self::ENCLOSURE);
30
+ }
31
+
32
+ //For getting subscriber collection as a guest
33
+ $subscriberArray = array();
34
+ $newsletterSubscribers = Mage::getModel('newsletter/subscriber')->getCollection()->addFieldToFilter('customer_id','0')->addFieldToSelect('subscriber_email');
35
+ foreach($newsletterSubscribers as $subscriber)
36
+ {
37
+ array_push($subscriberArray,$subscriber->getEmail());
38
+ }
39
+
40
+ //For removing duplicate entry from customer array
41
+ $finalSubsciberArray = array_diff($subscriberArray,$customerArray);
42
+
43
+ foreach($finalSubsciberArray as $key => $value)
44
+ {
45
+ $record = array('','',$value);
46
+ fputcsv($fp,$record, self::DELIMITER, self::ENCLOSURE);
47
+ }
48
+ fclose($fp);
49
+ return $fileName;
50
+ }
51
+
52
+ protected function writeHeadRow($fp)
53
+ {
54
+ fputcsv($fp, $this->getHeadRowValues(), self::DELIMITER, self::ENCLOSURE);
55
+ }
56
+
57
+ protected function getHeadRowValues()
58
+ {
59
+ return array('First Name','Last Name','Email Id');
60
+ }
61
+ }
62
+ ?>
app/code/local/Strapp/Buildemaillist/controllers/Adminhtml/ExportController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Strapp Build email list Module
4
+ *
5
+ * @category Strapp
6
+ * @package Strapp_Buildemaillist
7
+ */
8
+ class Strapp_Buildemaillist_Adminhtml_ExportController extends Mage_Adminhtml_Controller_Action
9
+ {
10
+ public function indexAction()
11
+ {
12
+ $file = Mage::getModel('strapp_buildemaillist/export_csv')->exportSubscribers();
13
+ $this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('var').'/export/'.$file));
14
+ }
15
+ }
app/code/local/Strapp/Buildemaillist/etc/adminhtml.xml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Strapp Build email list Module
5
+ *
6
+ * @category Strapp
7
+ * @package Strapp_Buildemaillist
8
+ */
9
+ -->
10
+ <config>
11
+ <menu>
12
+ <system>
13
+ <children>
14
+ <convert>
15
+ <children>
16
+ <buildemaillist module="strapp_buildemaillist">
17
+ <title>Build email list</title>
18
+ <action></action>
19
+ <sort_order>41</sort_order>
20
+ <depends>
21
+ <module>Strapp_Buildemaillist</module>
22
+ <config>buildemaillist/export/enable</config>
23
+ </depends>
24
+ <action>buildemaillist/adminhtml_export</action>
25
+ </buildemaillist>
26
+ </children>
27
+ </convert>
28
+ </children>
29
+ </system>
30
+ </menu>
31
+ <acl>
32
+ <resources>
33
+ <all>
34
+ <title>Allow Everything</title>
35
+ </all>
36
+ <admin>
37
+ <children>
38
+ <system>
39
+ <children>
40
+ <config>
41
+ <children>
42
+ <buildemaillist translate="title" module="strapp_buildemaillist">
43
+ <title>Strapp Build email list</title>
44
+ <sort_order>1</sort_order>
45
+ </buildemaillist>
46
+ </children>
47
+ </config>
48
+ <convert>
49
+ <children>
50
+ <buildemaillist translate="title" module="strapp_buildemaillist">
51
+ <title>Strapp Build email list</title>
52
+ <sort_order>1</sort_order>
53
+ </buildemaillist>
54
+ </children>
55
+ </convert>
56
+ </children>
57
+ </system>
58
+ </children>
59
+ </admin>
60
+ </resources>
61
+ </acl>
62
+ </config>
app/code/local/Strapp/Buildemaillist/etc/config.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Strapp Build email list Module
5
+ *
6
+ * @category Strapp
7
+ * @package Strapp_Buildemaillist
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Strapp_Buildemaillist>
13
+ <version>1.0.0</version>
14
+ </Strapp_Buildemaillist>
15
+ </modules>
16
+ <admin>
17
+ <routers>
18
+ <buildemaillist>
19
+ <use>admin</use>
20
+ <args>
21
+ <module>Strapp_Buildemaillist</module>
22
+ <frontName>buildemaillist</frontName>
23
+ </args>
24
+ </buildemaillist>
25
+ </routers>
26
+ </admin>
27
+ <global>
28
+ <models>
29
+ <strapp_buildemaillist>
30
+ <class>Strapp_Buildemaillist_Model</class>
31
+ </strapp_buildemaillist>
32
+ </models>
33
+ <blocks>
34
+ <strapp_buildemaillist>
35
+ <class>Strapp_Buildemaillist_Block</class>
36
+ </strapp_buildemaillist>
37
+ </blocks>
38
+ <helpers>
39
+ <strapp_buildemaillist>
40
+ <class>Strapp_Buildemaillist_Helper</class>
41
+ </strapp_buildemaillist>
42
+ </helpers>
43
+ </global>
44
+ <default>
45
+ <buildemaillist>
46
+ <export>
47
+ <enable>1</enable>
48
+ </export>
49
+ </buildemaillist>
50
+ </default>
51
+ </config>
app/code/local/Strapp/Buildemaillist/etc/system.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Strapp Build email list Module
5
+ *
6
+ * @category Strapp
7
+ * @package Strapp_Buildemaillist
8
+ */
9
+ -->
10
+ <config>
11
+ <tabs>
12
+ <strapp translate="label">
13
+ <label>Strapp Extensions</label>
14
+ <sort_order>100</sort_order>
15
+ </strapp>
16
+ </tabs>
17
+ <sections>
18
+ <buildemaillist translate="label">
19
+ <label>Build email list</label>
20
+ <tab>strapp</tab>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1000</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <groups>
27
+ <export>
28
+ <label>Build email list Settings</label>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ <fields>
35
+ <enable translate="label">
36
+ <label>Enable/Disable build email list</label>
37
+ <comment>If disabled, build email list not avaialable under Import/Export Tab</comment>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
40
+ <sort_order>0</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </enable>
45
+ </fields>
46
+ </export>
47
+ </groups>
48
+ </buildemaillist>
49
+ </sections>
50
+ </config>
app/etc/modules/Strapp_Buildemaillist.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Strapp Buildemaillist Module
5
+ *
6
+ * @category Strapp
7
+ * @package Strapp_Buildemaillist
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Strapp_Buildemaillist>
13
+ <active>true</active>
14
+ <codePool>local</codePool>
15
+ </Strapp_Buildemaillist>
16
+ </modules>
17
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>build_email_list</name>
4
+ <version>1.0.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>Build email list Community Module</summary>
10
+ <description>Magento, by default, provides for exporting of customers name and email id and also newsletter subscribers. But if you need to get both the customers details and also the newsletter subscriber details as one list and being unique with no duplicate email id's, then Build Email List extension comes very handy. It generally is used when store owners would like to send out communication to the visitors of the website - they could be existing customers or newsletter subscribers</description>
11
+ <notes>Build email list Community Module</notes>
12
+ <authors><author><name>StrApp</name><user>strviv</user><email>strappvivek@gmail.com</email></author></authors>
13
+ <date>2014-11-25</date>
14
+ <time>06:56:32</time>
15
+ <contents><target name="magelocal"><dir name="Strapp"><dir name="Buildemaillist"><dir name="Helper"><file name="Data.php" hash="3012df1e2f558ccc36168b4a3d4f63e2"/></dir><dir name="Model"><dir name="Export"><file name="Csv.php" hash="f245a6ffd03309e7377dffc84fba51e7"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ExportController.php" hash="d6f3ab32f8aa8aef261ee9e0782b401e"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="607aed536af7ab43477d15c609b108bb"/><file name="config.xml" hash="6ff9a845fd5af71f220f1bcc0d81762b"/><file name="system.xml" hash="b7c5f8591fdd3bf6fce9fea209115761"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Strapp_Buildemaillist.xml" hash="aed89d2e90e9b43d5e67870bfa7f40ef"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>5.5.6</max></php></required></dependencies>
18
+ </package>