Custum_Newslatter - Version 1.0.4

Version Notes

Custum_Newslatter-1.0.4

Download this release

Release Info

Developer kushagra daharwal
Extension Custum_Newslatter
Version 1.0.4
Comparing to
See all releases


Code changes from version 1.0.3 to 1.0.4

app/code/local/Custum/Newslatter/Helper/Data.php CHANGED
@@ -2,5 +2,16 @@
2
 
3
  class Custum_Newslatter_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
-
 
 
 
 
 
 
 
 
 
 
 
6
  }
2
 
3
  class Custum_Newslatter_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
+
6
+ //get customer first name from customer session
7
+ public function getCustumerfirstname()
8
+ {
9
+ if (Mage::helper('customer')->isLoggedIn())
10
+ {
11
+ $firstname = Mage::getSingleton("customer/session")->getCustomer()->getFirstname();
12
+
13
+ }
14
+
15
+ return $firstname;
16
+ }
17
  }
app/code/local/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
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
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml newsletter subscribers grid block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_Adminhtml_Block_Newsletter_Subscriber_Grid extends Mage_Adminhtml_Block_Widget_Grid
35
+ {
36
+ /**
37
+ * Constructor
38
+ *
39
+ * Set main configuration of grid
40
+ */
41
+ public function __construct()
42
+ {
43
+ parent::__construct();
44
+ $this->setId('subscriberGrid');
45
+ $this->setUseAjax(true);
46
+ $this->setDefaultSort('subscriber_id', 'desc');
47
+ }
48
+
49
+ /**
50
+ * Prepare collection for grid
51
+ *
52
+ * @return Mage_Adminhtml_Block_Widget_Grid
53
+ */
54
+ protected function _prepareCollection()
55
+ {
56
+ $collection = Mage::getResourceSingleton('newsletter/subscriber_collection');
57
+ /* @var $collection Mage_Newsletter_Model_Mysql4_Subscriber_Collection */
58
+ $collection
59
+ ->showCustomerInfo(true)
60
+ ->addSubscriberTypeField()
61
+ ->showStoreInfo();
62
+
63
+ if($this->getRequest()->getParam('queue', false)) {
64
+ $collection->useQueue(Mage::getModel('newsletter/queue')
65
+ ->load($this->getRequest()->getParam('queue')));
66
+ }
67
+
68
+ $this->setCollection($collection);
69
+
70
+ return parent::_prepareCollection();
71
+ }
72
+
73
+ protected function _prepareColumns()
74
+ {
75
+
76
+ $this->addColumn('subscriber_id', array(
77
+ 'header' => Mage::helper('newsletter')->__('ID'),
78
+ 'index' => 'subscriber_id'
79
+ ));
80
+
81
+
82
+ $this->addColumn('email', array(
83
+ 'header' => Mage::helper('newsletter')->__('Email'),
84
+ 'index' => 'subscriber_email'
85
+ ));
86
+
87
+ $this->addColumn('type', array(
88
+ 'header' => Mage::helper('newsletter')->__('Type'),
89
+ 'index' => 'type',
90
+ 'type' => 'options',
91
+ 'options' => array(
92
+ 1 => Mage::helper('newsletter')->__('Guest'),
93
+ 2 => Mage::helper('newsletter')->__('Customer')
94
+ )
95
+ ));
96
+
97
+
98
+
99
+
100
+ $this->addColumn('firstname', array(
101
+ 'header' => Mage::helper('newsletter')->__('Customer First Name'),
102
+ 'index' => 'lastname',
103
+ ));
104
+
105
+ $this->addColumn('lastname', array(
106
+ 'header' => Mage::helper('newsletter')->__('Customer Last Name'),
107
+ 'index' => 'customer_lastname',
108
+ 'default' => '----'
109
+ ));
110
+
111
+ $this->addColumn('status', array(
112
+ 'header' => Mage::helper('newsletter')->__('Status'),
113
+ 'index' => 'subscriber_status',
114
+ 'type' => 'options',
115
+ 'options' => array(
116
+ Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE => Mage::helper('newsletter')->__('Not Activated'),
117
+ Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED => Mage::helper('newsletter')->__('Subscribed'),
118
+ Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED => Mage::helper('newsletter')->__('Unsubscribed'),
119
+ Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED => Mage::helper('newsletter')->__('Unconfirmed'),
120
+ )
121
+ ));
122
+
123
+ $this->addColumn('website', array(
124
+ 'header' => Mage::helper('newsletter')->__('Website'),
125
+ 'index' => 'website_id',
126
+ 'type' => 'options',
127
+ 'options' => $this->_getWebsiteOptions()
128
+ ));
129
+
130
+ $this->addColumn('group', array(
131
+ 'header' => Mage::helper('newsletter')->__('Store'),
132
+ 'index' => 'group_id',
133
+ 'type' => 'options',
134
+ 'options' => $this->_getStoreGroupOptions()
135
+ ));
136
+
137
+ $this->addColumn('store', array(
138
+ 'header' => Mage::helper('newsletter')->__('Store View'),
139
+ 'index' => 'store_id',
140
+ 'type' => 'options',
141
+ 'options' => $this->_getStoreOptions()
142
+ ));
143
+
144
+ $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
145
+ $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
146
+ return parent::_prepareColumns();
147
+ }
148
+
149
+ /**
150
+ * Convert OptionsValue array to Options array
151
+ *
152
+ * @param array $optionsArray
153
+ * @return array
154
+ */
155
+ protected function _getOptions($optionsArray)
156
+ {
157
+ $options = array();
158
+ foreach ($optionsArray as $option) {
159
+ $options[$option['value']] = $option['label'];
160
+ }
161
+ return $options;
162
+ }
163
+
164
+ /**
165
+ * Retrieve Website Options array
166
+ *
167
+ * @return array
168
+ */
169
+ protected function _getWebsiteOptions()
170
+ {
171
+ return Mage::getModel('adminhtml/system_store')->getWebsiteOptionHash();
172
+ }
173
+
174
+ /**
175
+ * Retrieve Store Group Options array
176
+ *
177
+ * @return array
178
+ */
179
+ protected function _getStoreGroupOptions()
180
+ {
181
+ return Mage::getModel('adminhtml/system_store')->getStoreGroupOptionHash();
182
+ }
183
+
184
+ /**
185
+ * Retrieve Store Options array
186
+ *
187
+ * @return array
188
+ */
189
+ protected function _getStoreOptions()
190
+ {
191
+ return Mage::getModel('adminhtml/system_store')->getStoreOptionHash();
192
+ }
193
+
194
+ protected function _prepareMassaction()
195
+ {
196
+ $this->setMassactionIdField('subscriber_id');
197
+ $this->getMassactionBlock()->setFormFieldName('subscriber');
198
+
199
+ $this->getMassactionBlock()->addItem('unsubscribe', array(
200
+ 'label' => Mage::helper('newsletter')->__('Unsubscribe'),
201
+ 'url' => $this->getUrl('*/*/massUnsubscribe')
202
+ ));
203
+
204
+ $this->getMassactionBlock()->addItem('delete', array(
205
+ 'label' => Mage::helper('newsletter')->__('Delete'),
206
+ 'url' => $this->getUrl('*/*/massDelete')
207
+ ));
208
+
209
+ return $this;
210
+ }
211
+ }
app/design/frontend/default/default/template/newsletter/subscribe.phtml CHANGED
@@ -30,6 +30,7 @@
30
  <div class="block-title">
31
  <strong><span><?php echo $this->__('Newsletter') ?></span></strong>
32
  </div>
 
33
  <form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail">
34
  <div class="form-subscribe-header">
35
  <label for="newsletter"><?php echo $this->__('Sign Up for Our Newsletter:') ?></label>
@@ -40,7 +41,7 @@
40
 
41
 
42
  <label>Name</label>
43
- <input type="text" name="lastname" id="lastname" title="<?php echo $this->__('Sign up for our newsletter') ?>" />
44
 
45
 
46
 
30
  <div class="block-title">
31
  <strong><span><?php echo $this->__('Newsletter') ?></span></strong>
32
  </div>
33
+ <?php $getdefaultfname = Mage::helper("newslatter")->getCustumerfirstname(); //get default customer first name?>
34
  <form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail">
35
  <div class="form-subscribe-header">
36
  <label for="newsletter"><?php echo $this->__('Sign Up for Our Newsletter:') ?></label>
41
 
42
 
43
  <label>Name</label>
44
+ <input type="text" name="lastname" <?php if($getdefaultfname){?>value="<?php echo $getdefaultfname;?>"<?php }?> id="lastname" title="<?php echo $this->__('Name') ?>" />
45
 
46
 
47
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Custum_Newslatter</name>
4
- <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -22,11 +22,11 @@ Features &#xD;
22
  (2) 100% Free&#xD;
23
  &#xD;
24
  (3) 100% Open Source</description>
25
- <notes>Custum_Newslatter 1.0.3 stable version</notes>
26
  <authors><author><name>kushagra daharwal</name><user>kushagra</user><email>kushagra.daharwal@hotmail.com</email></author></authors>
27
- <date>2014-02-20</date>
28
- <time>06:43:37</time>
29
- <contents><target name="magelocal"><dir name="Custum"><dir name="Newslatter"><dir name="Block"><file name="Newslatter.php" hash="5e918dcd6d7a594f2361df975218739d"/></dir><dir name="Helper"><file name="Data.php" hash="1a31eb214a6ec9390b29708750bfff4e"/></dir><dir name="controllers"><file name="SubscriberController.php" hash="75981332cbb670c864fc3709a5e6c896"/></dir><dir name="etc"><file name="config.xml" hash="85df473965e2532d5bb33f8fe5e2a062"/></dir><dir name="sql"><dir name="newslatter_setup"><file name="mysql4-install-0.1.0.php" hash="29443ef39be57dbc754ab061fde84c8e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Custum_Newslatter.xml" hash="3290435078ae9cc4428071bc4ea8cb4d"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="custum_newslatter.xml" hash="600139a6b3ea0984b6874ad14710aedb"/></dir><dir name="template"><dir name="newsletter"><file name="subscribe.phtml" hash="73099ee78c58d677558f95e466972374"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="custum"><file name="newslatter.css" hash="36541d10392bf7b6fd7d4c37ed6e6467"/></dir></dir></dir></dir></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>5.1.0</min><max>5.6.0</max></php><package><name>custum_newslatter</name><channel>community</channel><min>1.0.0</min><max>2.0.0</max></package><extension><name>gd</name><min>2.3.0</min><max>2.4</max></extension></required></dependencies>
32
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Custum_Newslatter</name>
4
+ <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
22
  (2) 100% Free&#xD;
23
  &#xD;
24
  (3) 100% Open Source</description>
25
+ <notes>Custum_Newslatter-1.0.4</notes>
26
  <authors><author><name>kushagra daharwal</name><user>kushagra</user><email>kushagra.daharwal@hotmail.com</email></author></authors>
27
+ <date>2014-02-21</date>
28
+ <time>09:37:36</time>
29
+ <contents><target name="magelocal"><dir name="Custum"><dir name="Newslatter"><dir name="Block"><file name="Newslatter.php" hash="5e918dcd6d7a594f2361df975218739d"/></dir><dir name="Helper"><file name="Data.php" hash="60bf69f225119fda1106ecea86cc3fa6"/></dir><dir name="controllers"><file name="SubscriberController.php" hash="75981332cbb670c864fc3709a5e6c896"/></dir><dir name="etc"><file name="config.xml" hash="85df473965e2532d5bb33f8fe5e2a062"/></dir><dir name="sql"><dir name="newslatter_setup"><file name="mysql4-install-0.1.0.php" hash="29443ef39be57dbc754ab061fde84c8e"/></dir></dir></dir></dir><dir name="Mage"><dir name="Adminhtml"><dir name="Block"><dir name="Newsletter"><dir name="Subscriber"><file name="Grid.php" hash="7edde445b99646441eb0d6993f8fb929"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Custum_Newslatter.xml" hash="3290435078ae9cc4428071bc4ea8cb4d"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="custum_newslatter.xml" hash="600139a6b3ea0984b6874ad14710aedb"/></dir><dir name="template"><dir name="newsletter"><file name="subscribe.phtml" hash="ab316613dbf21bb0872e710f50c5613c"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="custum"><file name="newslatter.css" hash="36541d10392bf7b6fd7d4c37ed6e6467"/></dir></dir></dir></dir></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>5.1.0</min><max>5.6.0</max></php><package><name>custum_newslatter</name><channel>community</channel><min>1.0.0</min><max>2.0.0</max></package><extension><name>gd</name><min>2.3.0</min><max>2.4</max></extension></required></dependencies>
32
  </package>