Version Notes
First Preview release
Download this release
Release Info
Developer | iMedia inc. |
Extension | Imedia_Ajaxnewsletter |
Version | 1.0.0.1 |
Comparing to | |
See all releases |
Version 1.0.0.1
- app/code/community/Imedia/Ajaxnewsletter/Block/Adminhtml/Newsletter/Subscriber/Grid.php +212 -0
- app/code/community/Imedia/Ajaxnewsletter/Helper/Data.php +4 -0
- app/code/community/Imedia/Ajaxnewsletter/Model/Cookies.php +20 -0
- app/code/community/Imedia/Ajaxnewsletter/controllers/IndexController.php +81 -0
- app/code/community/Imedia/Ajaxnewsletter/etc/adminhtml.xml +26 -0
- app/code/community/Imedia/Ajaxnewsletter/etc/config.xml +65 -0
- app/code/community/Imedia/Ajaxnewsletter/etc/system.xml +121 -0
- app/code/community/Imedia/Ajaxnewsletter/sql/imedia_ajaxnewsletter_setup/mysql4-install-0.0.1.php +20 -0
- app/design/frontend/base/default/layout/imedia/ajaxnewsletter.xml +14 -0
- app/design/frontend/base/default/template/imedia/ajaxnewsletter.phtml +92 -0
- app/design/frontend/base/default/template/imedia/content.phtml +140 -0
- app/etc/modules/imedia_ajaxnewsletter.xml +9 -0
- package.xml +20 -0
- skin/frontend/base/default/css/ajaxnewsletter/close.png +0 -0
- skin/frontend/base/default/css/ajaxnewsletter/newsletter.css +91 -0
- skin/frontend/base/default/css/ajaxnewsletter/radio-btn-img.jpg +0 -0
app/code/community/Imedia/Ajaxnewsletter/Block/Adminhtml/Newsletter/Subscriber/Grid.php
ADDED
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2014 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 Imedia_Ajaxnewsletter_Block_Adminhtml_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 |
+
$this->addColumn('email', array(
|
82 |
+
'header' => Mage::helper('newsletter')->__('Email'),
|
83 |
+
'index' => 'subscriber_email'
|
84 |
+
));
|
85 |
+
|
86 |
+
$this->addColumn('type', array(
|
87 |
+
'header' => Mage::helper('newsletter')->__('Type'),
|
88 |
+
'index' => 'type',
|
89 |
+
'type' => 'options',
|
90 |
+
'options' => array(
|
91 |
+
1 => Mage::helper('newsletter')->__('Guest'),
|
92 |
+
2 => Mage::helper('newsletter')->__('Customer')
|
93 |
+
)
|
94 |
+
));
|
95 |
+
|
96 |
+
$this->addColumn('first_name', array(
|
97 |
+
'header' => Mage::helper('newsletter')->__('First Name'),
|
98 |
+
'index' => 'first_name',
|
99 |
+
));
|
100 |
+
|
101 |
+
$this->addColumn('last_name', array(
|
102 |
+
'header' => Mage::helper('newsletter')->__('Last Name'),
|
103 |
+
'index' => 'last_name',
|
104 |
+
));
|
105 |
+
|
106 |
+
$this->addColumn('gender', array(
|
107 |
+
'header' => Mage::helper('newsletter')->__('Gender'),
|
108 |
+
'index' => 'gender',
|
109 |
+
'default' => '----'
|
110 |
+
));
|
111 |
+
|
112 |
+
$this->addColumn('status', array(
|
113 |
+
'header' => Mage::helper('newsletter')->__('Status'),
|
114 |
+
'index' => 'subscriber_status',
|
115 |
+
'type' => 'options',
|
116 |
+
'options' => array(
|
117 |
+
Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE => Mage::helper('newsletter')->__('Not Activated'),
|
118 |
+
Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED => Mage::helper('newsletter')->__('Subscribed'),
|
119 |
+
Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED => Mage::helper('newsletter')->__('Unsubscribed'),
|
120 |
+
Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED => Mage::helper('newsletter')->__('Unconfirmed'),
|
121 |
+
)
|
122 |
+
));
|
123 |
+
|
124 |
+
$this->addColumn('website', array(
|
125 |
+
'header' => Mage::helper('newsletter')->__('Website'),
|
126 |
+
'index' => 'website_id',
|
127 |
+
'type' => 'options',
|
128 |
+
'options' => $this->_getWebsiteOptions()
|
129 |
+
));
|
130 |
+
|
131 |
+
$this->addColumn('group', array(
|
132 |
+
'header' => Mage::helper('newsletter')->__('Store'),
|
133 |
+
'index' => 'group_id',
|
134 |
+
'type' => 'options',
|
135 |
+
'options' => $this->_getStoreGroupOptions()
|
136 |
+
));
|
137 |
+
|
138 |
+
$this->addColumn('store', array(
|
139 |
+
'header' => Mage::helper('newsletter')->__('Store View'),
|
140 |
+
'index' => 'store_id',
|
141 |
+
'type' => 'options',
|
142 |
+
'options' => $this->_getStoreOptions()
|
143 |
+
));
|
144 |
+
|
145 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
|
146 |
+
$this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
|
147 |
+
return parent::_prepareColumns();
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Convert OptionsValue array to Options array
|
152 |
+
*
|
153 |
+
* @param array $optionsArray
|
154 |
+
* @return array
|
155 |
+
*/
|
156 |
+
protected function _getOptions($optionsArray)
|
157 |
+
{
|
158 |
+
$options = array();
|
159 |
+
foreach ($optionsArray as $option) {
|
160 |
+
$options[$option['value']] = $option['label'];
|
161 |
+
}
|
162 |
+
return $options;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Retrieve Website Options array
|
167 |
+
*
|
168 |
+
* @return array
|
169 |
+
*/
|
170 |
+
protected function _getWebsiteOptions()
|
171 |
+
{
|
172 |
+
return Mage::getModel('adminhtml/system_store')->getWebsiteOptionHash();
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Retrieve Store Group Options array
|
177 |
+
*
|
178 |
+
* @return array
|
179 |
+
*/
|
180 |
+
protected function _getStoreGroupOptions()
|
181 |
+
{
|
182 |
+
return Mage::getModel('adminhtml/system_store')->getStoreGroupOptionHash();
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Retrieve Store Options array
|
187 |
+
*
|
188 |
+
* @return array
|
189 |
+
*/
|
190 |
+
protected function _getStoreOptions()
|
191 |
+
{
|
192 |
+
return Mage::getModel('adminhtml/system_store')->getStoreOptionHash();
|
193 |
+
}
|
194 |
+
|
195 |
+
protected function _prepareMassaction()
|
196 |
+
{
|
197 |
+
$this->setMassactionIdField('subscriber_id');
|
198 |
+
$this->getMassactionBlock()->setFormFieldName('subscriber');
|
199 |
+
|
200 |
+
$this->getMassactionBlock()->addItem('unsubscribe', array(
|
201 |
+
'label' => Mage::helper('newsletter')->__('Unsubscribe'),
|
202 |
+
'url' => $this->getUrl('*/*/massUnsubscribe')
|
203 |
+
));
|
204 |
+
|
205 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
206 |
+
'label' => Mage::helper('newsletter')->__('Delete'),
|
207 |
+
'url' => $this->getUrl('*/*/massDelete')
|
208 |
+
));
|
209 |
+
|
210 |
+
return $this;
|
211 |
+
}
|
212 |
+
}
|
app/code/community/Imedia/Ajaxnewsletter/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Imedia_Ajaxnewsletter_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
app/code/community/Imedia/Ajaxnewsletter/Model/Cookies.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Imedia_Ajaxnewsletter_Model_Cookies
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value'=>'3600', 'label'=>'1 Hour'),
|
8 |
+
array('value'=>'43200', 'label'=>'12 Hours'),
|
9 |
+
array('value'=>'86400', 'label'=>'24 Hours'),
|
10 |
+
array('value'=>'172800', 'label'=>'2 Days'),
|
11 |
+
array('value'=>'604800', 'label'=>'1 Week'),
|
12 |
+
array('value'=>'1209600', 'label'=>'2 Weeks'),
|
13 |
+
array('value'=>'2419200', 'label'=>'1 Month'),
|
14 |
+
array('value'=>'7257600', 'label'=>'3 Months'),
|
15 |
+
array('value'=>'14515200', 'label'=>'6 Months'),
|
16 |
+
);
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
20 |
+
|
app/code/community/Imedia/Ajaxnewsletter/controllers/IndexController.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Imedia_Ajaxnewsletter_IndexController extends Mage_Core_Controller_Front_Action{
|
3 |
+
public function IndexAction() {
|
4 |
+
|
5 |
+
$this->loadLayout();
|
6 |
+
$this->renderLayout();
|
7 |
+
|
8 |
+
}
|
9 |
+
public function newAction()
|
10 |
+
{
|
11 |
+
if ($_REQUEST['email']) {
|
12 |
+
$session = Mage::getSingleton('core/session');
|
13 |
+
$customerSession = Mage::getSingleton('customer/session');
|
14 |
+
$email = $_REQUEST['email'];
|
15 |
+
$fname = $_REQUEST['first_name'];
|
16 |
+
$lname = $_REQUEST['last_name'];
|
17 |
+
$gender = $_REQUEST['gender'];
|
18 |
+
$type = $_REQUEST['customer_type'];
|
19 |
+
|
20 |
+
try {
|
21 |
+
if (!Zend_Validate::is($email, 'EmailAddress')) {
|
22 |
+
|
23 |
+
echo "Please enter a valid email address.";
|
24 |
+
return;
|
25 |
+
}
|
26 |
+
|
27 |
+
if (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG) != 1 &&
|
28 |
+
!$customerSession->isLoggedIn()) {
|
29 |
+
echo 'Sorry, but administrator denied subscription for guests. Please <a href="%s">register</a>.', Mage::helper('customer')->getRegisterUrl();
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
|
33 |
+
$ownerId = Mage::getModel('newsletter/subscriber')
|
34 |
+
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
|
35 |
+
->loadByEmail($email)
|
36 |
+
->getId();
|
37 |
+
if ($ownerId !== null && $ownerId != $customerSession->getId()) {
|
38 |
+
echo 'This email address is already assigned to another user.';
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
|
42 |
+
$status = Mage::getModel('newsletter/subscriber')->subscribe($email);
|
43 |
+
/********* custom field ***********/
|
44 |
+
|
45 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
46 |
+
|
47 |
+
if ($fname){
|
48 |
+
$subscriber->setFirstName($fname);
|
49 |
+
}
|
50 |
+
if ($lname){
|
51 |
+
$subscriber->setLastName($lname);
|
52 |
+
}
|
53 |
+
if ($gender){
|
54 |
+
$subscriber->setGender($gender);
|
55 |
+
}
|
56 |
+
if ($type){
|
57 |
+
$subscriber->setCustomerType($type);
|
58 |
+
}
|
59 |
+
$subscriber->save();
|
60 |
+
/********* custom field ***********/
|
61 |
+
|
62 |
+
if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
|
63 |
+
echo "Confirmation request has been sent&&1";
|
64 |
+
return;
|
65 |
+
}else{
|
66 |
+
echo "Thank you for your subscription&&1";
|
67 |
+
return;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
catch (Mage_Core_Exception $e) {
|
71 |
+
echo "There was a problem with the subscription:".$e;
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
catch (Exception $e) {
|
75 |
+
echo "There was a problem with the subscription".$e;
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
$this->_redirectReferer();
|
80 |
+
}
|
81 |
+
}
|
app/code/community/Imedia/Ajaxnewsletter/etc/adminhtml.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<ajaxnewsletter translate="title" module="imedia_ajaxnewsletter">
|
15 |
+
<title>Imedia Ajaxnewsletter</title>
|
16 |
+
<sort_order>100</sort_order>
|
17 |
+
</ajaxnewsletter>
|
18 |
+
</children>
|
19 |
+
</config>
|
20 |
+
</children>
|
21 |
+
</system>
|
22 |
+
</children>
|
23 |
+
</admin>
|
24 |
+
</resources>
|
25 |
+
</acl>
|
26 |
+
</config>
|
app/code/community/Imedia/Ajaxnewsletter/etc/config.xml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Imedia_Ajaxnewsletter>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Imedia_Ajaxnewsletter>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<ajaxnewsletter>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Imedia_Ajaxnewsletter</module>
|
14 |
+
<frontName>ajaxnewsletter</frontName>
|
15 |
+
</args>
|
16 |
+
</ajaxnewsletter>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<ajaxnewsletter>
|
21 |
+
<file>imedia/ajaxnewsletter.xml</file>
|
22 |
+
</ajaxnewsletter>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<helpers>
|
28 |
+
<imedia_ajaxnewsletter>
|
29 |
+
<class>Imedia_Ajaxnewsletter_Helper</class>
|
30 |
+
</imedia_ajaxnewsletter>
|
31 |
+
</helpers>
|
32 |
+
<models>
|
33 |
+
<ajaxnewsletter>
|
34 |
+
<class>Imedia_Ajaxnewsletter_Model</class>
|
35 |
+
</ajaxnewsletter>
|
36 |
+
</models>
|
37 |
+
<blocks>
|
38 |
+
<adminhtml>
|
39 |
+
<rewrite>
|
40 |
+
<newsletter_subscriber_grid>Imedia_Ajaxnewsletter_Block_Adminhtml_Newsletter_Subscriber_Grid</newsletter_subscriber_grid>
|
41 |
+
</rewrite>
|
42 |
+
</adminhtml>
|
43 |
+
</blocks>
|
44 |
+
<resources>
|
45 |
+
<imedia_ajaxnewsletter_setup>
|
46 |
+
<setup>
|
47 |
+
<module>Imedia_Ajaxnewsletter</module>
|
48 |
+
</setup>
|
49 |
+
<connection>
|
50 |
+
<use>core_setup</use>
|
51 |
+
</connection>
|
52 |
+
</imedia_ajaxnewsletter_setup>
|
53 |
+
<imedia_ajaxnewsletter_write>
|
54 |
+
<connection>
|
55 |
+
<use>core_write</use>
|
56 |
+
</connection>
|
57 |
+
</imedia_ajaxnewsletter_write>
|
58 |
+
<imedia_ajaxnewsletter_read>
|
59 |
+
<connection>
|
60 |
+
<use>core_read</use>
|
61 |
+
</connection>
|
62 |
+
</imedia_ajaxnewsletter_read>
|
63 |
+
</resources>
|
64 |
+
</global>
|
65 |
+
</config>
|
app/code/community/Imedia/Ajaxnewsletter/etc/system.xml
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<imedia translate="label" module="imedia_ajaxnewsletter">
|
5 |
+
<label>Imedia Extentions</label>
|
6 |
+
<sort_order>11</sort_order>
|
7 |
+
</imedia>
|
8 |
+
</tabs>
|
9 |
+
|
10 |
+
<sections>
|
11 |
+
<ajaxnewsletter translate="label" module="imedia_ajaxnewsletter">
|
12 |
+
<class>separator-top</class>
|
13 |
+
<label>Ajax Newsletter</label>
|
14 |
+
<tab>imedia</tab>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>13</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 |
+
|
21 |
+
<groups>
|
22 |
+
<ajaxnewsletter translate="label">
|
23 |
+
<label>Ajax Newsletter</label>
|
24 |
+
<frontend_type>text</frontend_type>
|
25 |
+
<sort_order>1</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
<fields>
|
30 |
+
<enabled translate="label">
|
31 |
+
<label>Enable Ajax Newsletter</label>
|
32 |
+
<frontend_type>select</frontend_type>
|
33 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
34 |
+
<sort_order>1</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</enabled>
|
39 |
+
</fields>
|
40 |
+
</ajaxnewsletter>
|
41 |
+
<display1 translate="label">
|
42 |
+
<label>Display Options</label>
|
43 |
+
<frontend_type>text</frontend_type>
|
44 |
+
<sort_order>2</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
<fields>
|
49 |
+
<firstname translate="label">
|
50 |
+
<label>Show Firstname</label>
|
51 |
+
<frontend_type>select</frontend_type>
|
52 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
53 |
+
<sort_order>1</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>1</show_in_store>
|
57 |
+
</firstname>
|
58 |
+
<firstname_required translate="label">
|
59 |
+
<label>Show firstname as required field</label>
|
60 |
+
<frontend_type>select</frontend_type>
|
61 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
+
<sort_order>2</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
</firstname_required>
|
67 |
+
<lastname translate="label">
|
68 |
+
<label>Show Lastname</label>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
71 |
+
<sort_order>3</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
</lastname>
|
76 |
+
<lastname_required translate="label">
|
77 |
+
<label>Show Lastname as required field</label>
|
78 |
+
<frontend_type>select</frontend_type>
|
79 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
80 |
+
<sort_order>4</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
</lastname_required>
|
85 |
+
<gender translate="label">
|
86 |
+
<label>Show select option for gender</label>
|
87 |
+
<frontend_type>select</frontend_type>
|
88 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
89 |
+
<sort_order>5</sort_order>
|
90 |
+
<show_in_default>1</show_in_default>
|
91 |
+
<show_in_website>1</show_in_website>
|
92 |
+
<show_in_store>1</show_in_store>
|
93 |
+
</gender>
|
94 |
+
<gender_required translate="label">
|
95 |
+
<label>Show gender as required field</label>
|
96 |
+
<frontend_type>select</frontend_type>
|
97 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
98 |
+
<sort_order>6</sort_order>
|
99 |
+
<show_in_default>1</show_in_default>
|
100 |
+
<show_in_website>1</show_in_website>
|
101 |
+
<show_in_store>1</show_in_store>
|
102 |
+
</gender_required>
|
103 |
+
<cookie_expiry translate="label tooltip comment">
|
104 |
+
<label>Cookie Expiry</label>
|
105 |
+
<frontend_type>select</frontend_type>
|
106 |
+
<source_model>ajaxnewsletter/cookies</source_model>
|
107 |
+
<sort_order>10</sort_order>
|
108 |
+
<show_in_default>1</show_in_default>
|
109 |
+
<show_in_website>1</show_in_website>
|
110 |
+
<show_in_store>1</show_in_store>
|
111 |
+
<comment>Select cookies </comment>
|
112 |
+
</cookie_expiry>
|
113 |
+
|
114 |
+
|
115 |
+
</fields>
|
116 |
+
</display1>
|
117 |
+
</groups>
|
118 |
+
|
119 |
+
</ajaxnewsletter>
|
120 |
+
</sections>
|
121 |
+
</config>
|
app/code/community/Imedia/Ajaxnewsletter/sql/imedia_ajaxnewsletter_setup/mysql4-install-0.0.1.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$installer->run("
|
5 |
+
ALTER TABLE `{$installer->getTable('newsletter/subscriber')}`
|
6 |
+
ADD first_name varchar(100) NOT NULL DEFAULT '';
|
7 |
+
");
|
8 |
+
$installer->run("
|
9 |
+
ALTER TABLE `{$installer->getTable('newsletter/subscriber')}`
|
10 |
+
ADD last_name varchar(100) NOT NULL DEFAULT '';
|
11 |
+
");
|
12 |
+
$installer->run("
|
13 |
+
ALTER TABLE `{$installer->getTable('newsletter/subscriber')}`
|
14 |
+
ADD gender varchar(100) NOT NULL DEFAULT '';
|
15 |
+
");
|
16 |
+
$installer->run("
|
17 |
+
ALTER TABLE `{$installer->getTable('newsletter/subscriber')}`
|
18 |
+
ADD customer_type varchar(100) NOT NULL DEFAULT '';
|
19 |
+
");
|
20 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/imedia/ajaxnewsletter.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addCss">
|
6 |
+
<stylesheet>css/ajaxnewsletter/newsletter.css</stylesheet>
|
7 |
+
</action>
|
8 |
+
</reference>
|
9 |
+
<reference name="footer">
|
10 |
+
<block type="newsletter/subscribe" name="newsletter" as="newsletter" template="imedia/ajaxnewsletter.phtml" />
|
11 |
+
</reference>
|
12 |
+
</default>
|
13 |
+
|
14 |
+
</layout>
|
app/design/frontend/base/default/template/imedia/ajaxnewsletter.phtml
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
28 |
+
<script>$q = jQuery.noConflict(); </script>
|
29 |
+
<script>
|
30 |
+
$q(document).ready(function(){
|
31 |
+
$q('.box').each(function(e){
|
32 |
+
<?php if(!(Mage::getModel('core/cookie')->get('newsletterInfo')) && !(Mage::getModel('core/cookie')->get('newsletter-close'))): ?>
|
33 |
+
//open popup
|
34 |
+
window.setTimeout(function (){
|
35 |
+
$q("#overlay_form").fadeIn(1000);
|
36 |
+
$q(".background_overlay").fadeIn(500);
|
37 |
+
positionPopup();
|
38 |
+
}, 100);
|
39 |
+
<?php endif; ?>
|
40 |
+
//close popup
|
41 |
+
$q("#close").click(function(){
|
42 |
+
$q("#overlay_form").fadeOut(500);
|
43 |
+
$q(".background_overlay").fadeOut(500);
|
44 |
+
});
|
45 |
+
});
|
46 |
+
$q('#home_newsletter').click(function(){
|
47 |
+
$q("#overlay_form").fadeIn(1000);
|
48 |
+
$q(".background_overlay").fadeIn(500);
|
49 |
+
positionPopup();
|
50 |
+
});
|
51 |
+
});
|
52 |
+
//position the popup at the center of the page
|
53 |
+
function positionPopup(){
|
54 |
+
if(!$q("#overlay_form").is(':visible')){
|
55 |
+
return;
|
56 |
+
}
|
57 |
+
$q("#overlay_form").css({
|
58 |
+
left: ($q(window).width() - $q('#overlay_form').width()) / 2,
|
59 |
+
top: ($q(window).width() - $q('#overlay_form').width()) / 7,
|
60 |
+
position:'absolute'
|
61 |
+
});
|
62 |
+
}
|
63 |
+
//maintain the popup at center of the page when browser resized
|
64 |
+
$q(window).bind('resize',positionPopup);
|
65 |
+
</script>
|
66 |
+
<div class="background_overlay" style="display:none"></div>
|
67 |
+
<div class="modal-dialog modal-popup" id="overlay_form" style="display:none">
|
68 |
+
<div class="modal-content modal-content1">
|
69 |
+
<div class="modal-header modal-header1">
|
70 |
+
<a href="javascript:void();" id="close" onclick="setCookie()" style="float: right"><img src="<?php echo $this->getSkinUrl('css/ajaxnewsletter/close.png'); ?>" class="close-img"/></a>
|
71 |
+
</div>
|
72 |
+
<div class="modal-body newsletter-form">
|
73 |
+
<div class="enter-world">
|
74 |
+
<div class="enter-world-right">
|
75 |
+
<div class="enter-world-info">
|
76 |
+
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('imedia/content.phtml')->toHtml();?>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
<div class="clear"></div>
|
80 |
+
</div>
|
81 |
+
<div id="thanks"></div>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
<!--</div>-->
|
86 |
+
<div class="box">
|
87 |
+
<div class="footer-head"><?php echo $this->__('Subscribe to our newsletter'); ?></div>
|
88 |
+
<div class="footer-search-con">
|
89 |
+
<input id="home_newsletter" type="text" id="pop" placeholder="<?php echo $this->__('Enter your email'); ?>" data-toggle="modal" data-target="#newsletterModal" title="<?php echo $this->__('Enter your email'); ?>" class="input-text required-entry validate-email" />
|
90 |
+
<input value="OK" type="submit" id="pop" />
|
91 |
+
</div>
|
92 |
+
</div>
|
app/design/frontend/base/default/template/imedia/content.phtml
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
|
28 |
+
<?php
|
29 |
+
$firstname = Mage::getStoreConfig('ajaxnewsletter/display1/firstname');
|
30 |
+
$firstname_required = Mage::getStoreConfig('ajaxnewsletter/display1/firstname_required');
|
31 |
+
$lastname = Mage::getStoreConfig('ajaxnewsletter/display1/lastname');
|
32 |
+
$lastname_required = Mage::getStoreConfig('ajaxnewsletter/display1/lastname_required');
|
33 |
+
$gender = Mage::getStoreConfig('ajaxnewsletter/display1/gender');
|
34 |
+
$gender_required = Mage::getStoreConfig('ajaxnewsletter/display1/gender_required');
|
35 |
+
?>
|
36 |
+
|
37 |
+
<form action="javascript:void(0)" method="post" id="newsletter-validate-detail">
|
38 |
+
|
39 |
+
<ul>
|
40 |
+
<li>
|
41 |
+
<input name="email" type="text" id="newsletter" placeholder="EMAIL*" class="required-entry validate-email" /></li>
|
42 |
+
<li>
|
43 |
+
<?php if($firstname == '1'): ?>
|
44 |
+
<div class="field-box FL" style="float: left;"><input name="first_name" type="text" id="first_name" class="<?php if($firstname_required == '1'): ?>input-text required-entry<?php endif; ?>" placeholder="FIRST NAME" /></div>
|
45 |
+
<?php endif; ?>
|
46 |
+
<?php if($lastname == '1'): ?>
|
47 |
+
<div class="field-box FR" style="float: right;"><input name="last_name" type="text" id="last_name" class="<?php if($lastname_required == '1'): ?> input-text required-entry<?php endif; ?>" placeholder="LAST NAME" /></div>
|
48 |
+
<?php endif; ?>
|
49 |
+
</li>
|
50 |
+
<?php if($gender == '1'): ?>
|
51 |
+
<div class="input-box">
|
52 |
+
<li>
|
53 |
+
<div class="field-box gender_female FL" style="float: left;">
|
54 |
+
<input id="option4" type="radio" name="gender" value="Women" class="selgender"/>
|
55 |
+
<label for="option4" > </label><?php echo $this->__('WOMEN'); ?>
|
56 |
+
</div>
|
57 |
+
<div class="field-box gender_male FR" style="float: right;">
|
58 |
+
<input id="option5" type="radio" name="gender" value="Men" class="<?php if($gender_required == '1'): ?>validate-one-required-by-name<?php endif; ?> selgender"/>
|
59 |
+
<label for="option5" > </label><?php echo $this->__('MEN'); ?></div>
|
60 |
+
</li>
|
61 |
+
</div>
|
62 |
+
<?php endif; ?>
|
63 |
+
<li class="loading" style="display:none;" id="loading">Loading...</li>
|
64 |
+
<li><input value="<?php echo $this->__('Submit'); ?>" type="submit" class="news-button" id="subs_button"/></li>
|
65 |
+
</ul>
|
66 |
+
</form>
|
67 |
+
<script type="text/javascript">
|
68 |
+
//<![CDATA[
|
69 |
+
var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
|
70 |
+
//]]>
|
71 |
+
</script>
|
72 |
+
<script>jQuery.noConflict(); </script>
|
73 |
+
<script>
|
74 |
+
jQuery(document).ready(function($){
|
75 |
+
|
76 |
+
//newsletter
|
77 |
+
$('#newsletter-validate-detail input').focus(function(){
|
78 |
+
$(this).data('placeholder',$(this).attr('placeholder'))
|
79 |
+
$(this).attr('placeholder','');
|
80 |
+
});
|
81 |
+
$('#newsletter-validate-detail input').blur(function(){
|
82 |
+
$(this).attr('placeholder',$(this).data('placeholder'));
|
83 |
+
});
|
84 |
+
|
85 |
+
$('#newsletter-validate-detail').submit(function(e){
|
86 |
+
var form_email = $('#newsletter').val();
|
87 |
+
var fname = $('#first_name').val();
|
88 |
+
var lname = $('#last_name').val();
|
89 |
+
var gender = jQuery('input[name="gender"]:checked').val();
|
90 |
+
var ctype = $('#customerType').val();
|
91 |
+
if(
|
92 |
+
$('#newsletter').hasClass('validation-failed')||
|
93 |
+
$('#first_name').hasClass('validation-failed')||
|
94 |
+
$('#last_name').hasClass('validation-failed')||
|
95 |
+
$('.selgender').hasClass('validation-failed')
|
96 |
+
){
|
97 |
+
|
98 |
+
return false;
|
99 |
+
|
100 |
+
}else{
|
101 |
+
var baseUrl = '<?php echo Mage::getBaseUrl();?>ajaxnewsletter/index/new';
|
102 |
+
$('#loading').show();
|
103 |
+
$.ajax({
|
104 |
+
url: baseUrl,
|
105 |
+
type: "POST",
|
106 |
+
data: $('#newsletter-validate-detail').serialize(),
|
107 |
+
success: function (returnData) {
|
108 |
+
if(returnData){
|
109 |
+
$('#subs_button').hide();
|
110 |
+
$('#loading').hide();
|
111 |
+
$('.enter-world').hide();
|
112 |
+
var successVal = returnData.split('&&');
|
113 |
+
if(successVal[1] == 1){
|
114 |
+
$('#thanks').html(successVal[0]);
|
115 |
+
document.cookie = 'newsletterInfo = yes' + ';expires = Fri, 31 Dec 9999 23:59:59 GMT';
|
116 |
+
}else{
|
117 |
+
$('#thanks').html(returnData);
|
118 |
+
}
|
119 |
+
window.setTimeout(function () {
|
120 |
+
window.location.reload();
|
121 |
+
$('html, body').animate({scrollTop : 0},800);
|
122 |
+
}, 5000);
|
123 |
+
}
|
124 |
+
},
|
125 |
+
error: function (xhr, ajaxOptions, thrownError) {
|
126 |
+
|
127 |
+
},
|
128 |
+
complete: function () {
|
129 |
+
|
130 |
+
}
|
131 |
+
});
|
132 |
+
}
|
133 |
+
});
|
134 |
+
});
|
135 |
+
function setCookie() {
|
136 |
+
var key = 'newsletter-close';
|
137 |
+
var value = 'yes';
|
138 |
+
document.cookie = key + '=' + value + ';expires=';
|
139 |
+
}
|
140 |
+
</script>
|
app/etc/modules/imedia_ajaxnewsletter.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Imedia_Ajaxnewsletter>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Imedia_Ajaxnewsletter>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Imedia_Ajaxnewsletter</name>
|
4 |
+
<version>1.0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Ajax based newsletter popup</summary>
|
10 |
+
<description>1. Ajax based newsletter popup
|
11 |
+
2. Newsletter fields manageable from admin
|
12 |
+
3. Cookies expiration manageable from admin</description>
|
13 |
+
<notes>First Preview release</notes>
|
14 |
+
<authors><author><name>iMedia inc.</name><user>imedia</user><email>info@imediadesigns.org</email></author></authors>
|
15 |
+
<date>2015-07-07</date>
|
16 |
+
<time>11:12:13</time>
|
17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="imedia_ajaxnewsletter.xml" hash="19b74949bb1774ba669208fc624e1574"/></dir></target><target name="magecommunity"><dir name="Imedia"><dir name="Ajaxnewsletter"><dir name="Block"><dir name="Adminhtml"><dir name="Newsletter"><dir name="Subscriber"><file name="Grid.php" hash="ee43c48411f320b8d6bdac0c1e67557b"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="c59f884c58ae4cbe23a2cf7cfc05c835"/></dir><dir name="Model"><file name="Cookies.php" hash="9aba1a73d204cd19285bba7224beb674"/></dir><dir name="controllers"><file name="IndexController.php" hash="4d48249501f0d8d4cdc346208ae5e960"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2dca5a4f0141735796ede15d067f0069"/><file name="config.xml" hash="7c0766f50b69ec895884086923ef3754"/><file name="system.xml" hash="f7e99e382a63e132a4ea14bd62f058ac"/></dir><dir name="sql"><dir name="imedia_ajaxnewsletter_setup"><file name="mysql4-install-0.0.1.php" hash="851b3430ae0a3aad15d04d597209ca0c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir><dir name="imedia"><file name="ajaxnewsletter.xml" hash="b3d67f0aa51b59c6fea57317f192a645"/></dir></dir></dir><dir name="template"><dir name="imedia"><file name="ajaxnewsletter.phtml" hash="a73df88c56a260f1e774c77157755c35"/><file name="content.phtml" hash="2ad9ece3bec140f042358b280d3c2bc1"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="ajaxnewsletter"><file name="close.png" hash="6adbd7e521121a3f3915dd31a5be00d7"/><file name="newsletter.css" hash="8ec97c58e09a0049b26dbc1044fe6888"/><file name="radio-btn-img.jpg" hash="47b6926b810f1a762fe6f7a3bb64cf89"/></dir></dir></dir></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|
skin/frontend/base/default/css/ajaxnewsletter/close.png
ADDED
Binary file
|
skin/frontend/base/default/css/ajaxnewsletter/newsletter.css
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.enter-world{ width:100%; margin:0px; padding:0px; background-color:#FFFFFF; float:left;}
|
3 |
+
.enter-world .enter-world-img{ width:50%; margin:0px; padding:0px; float:left;}
|
4 |
+
.enter-world .enter-world-img img{ width:100%; margin:0px;}
|
5 |
+
.enter-world .enter-world-right{ width:100%; margin:0px; padding:0px; float:right;}
|
6 |
+
.enter-world .enter-world-right .enter-world-info{ clear:both; margin:0px; padding:10px 0;}
|
7 |
+
.enter-world .enter-world-right .enter-world-info ul{ margin:0px; padding:0px;}
|
8 |
+
.enter-world .enter-world-right .enter-world-info ul li{ width:100%; margin:0px 0px 8px; padding:0px; list-style:none; float:left; text-align:center; font-family: 'HelveticaNeueLTStd-Roman'; font-size:13px;}
|
9 |
+
.enter-world .enter-world-right .enter-world-info ul li.enter-world-head{ font-family: 'HelveticaNeueLTPro-Md'; font-size:17px; letter-spacing:0.3px;}
|
10 |
+
.enter-world .enter-world-right .enter-world-info ul li.enter-world-plus{ font-size:34px; margin:2px 0 10px;}
|
11 |
+
.enter-world .enter-world-right .enter-world-info ul li.enter-for-chance{ font-size:12px; margin:0 0 13px;}
|
12 |
+
|
13 |
+
|
14 |
+
.enter-world .enter-world-right .enter-world-info ul li input[type="text"]{ width:100%; margin:3px 0px; padding:0px 10px 5px; text-align:center; font-family: 'HelveticaNeueLTStd-Roman'; font-size:13px; color:#000000; border:none; border-bottom:1px solid #a9a9a9; background-color:#FFFFFF; border-radius:0px;}
|
15 |
+
|
16 |
+
.enter-world .enter-world-right .enter-world-info ul li input[placeholder] { color:#000000;}
|
17 |
+
|
18 |
+
::-moz-placeholder {
|
19 |
+
color: #000000;
|
20 |
+
opacity:1;
|
21 |
+
}
|
22 |
+
|
23 |
+
/*.enter-world .enter-world-right .enter-world-info ul li :-moz-input-placeholder {
|
24 |
+
color: #000000;
|
25 |
+
}*/
|
26 |
+
.enter-world .enter-world-right .enter-world-info ul li ::-webkit-input-placeholder{
|
27 |
+
color:#000000;
|
28 |
+
}
|
29 |
+
|
30 |
+
.enter-world .enter-world-right .enter-world-info ul li .field-box{ width:48%;}
|
31 |
+
|
32 |
+
.enter-world .enter-world-right .enter-world-info ul li .field-box input[type="radio"]:not(old), .enter-world .enter-world-right .enter-world-info ul li .field-box input[type="checkbox"]:not(old) { opacity:0; margin:0; padding:0; width:18px; height:18px; position:absolute; left:0;}
|
33 |
+
.enter-world .enter-world-right .enter-world-info ul li .field-box input[type="radio"]:not(old) + label, .enter-world .enter-world-right .enter-world-info ul li .field-box input[type="checkbox"]:not(old) + label { background:url(../ajaxnewsletter/radio-btn-img.jpg) no-repeat; display:inline-block; vertical-align:middle; height:18px; width:18px; cursor:pointer; margin:0px 5px;}
|
34 |
+
.enter-world .enter-world-right .enter-world-info ul li .field-box input[type="radio"]:checked:not(old) + label, .enter-world .enter-world-right .enter-world-info ul li .field-box input[type="checkbox"]:checked:not(old) + label { background-position:0px -19px;}
|
35 |
+
|
36 |
+
|
37 |
+
.enter-world .enter-world-right .enter-world-info ul li.thanks-text{ font-size: 19px;
|
38 |
+
font-family: 'HelveticaNeueLTStd-Md';
|
39 |
+
margin:10px 0 2px;}
|
40 |
+
.enter-world .enter-world-right .enter-world-info ul li.verify-email{ font-size:11px;}
|
41 |
+
.enter-world .enter-world-right .enter-world-info ul li.rules-link{ font-size:11px; text-align:left;}
|
42 |
+
.enter-world .enter-world-right .enter-world-info ul li.rules-link{ font-size:11px; text-align:left; margin:0px 0px 6px;}
|
43 |
+
.enter-world .enter-world-right .enter-world-info ul li.rules-link a{ font-family: 'HelveticaNeueLTPro-Md'; font-size:13px; color:#000000; text-decoration:none; margin-left:-28px; border-bottom:1px solid #000000;}
|
44 |
+
.enter-world .enter-world-right .enter-world-info ul li.rules-link a:hover{ color:#000000; text-decoration:none; border-bottom:none;}
|
45 |
+
|
46 |
+
.enter-world .enter-world-right .enter-world-info ul li .news-button {
|
47 |
+
font-family: 'HelveticaNeueLTPro-Md';
|
48 |
+
background:#000;
|
49 |
+
border: medium none;
|
50 |
+
color: #fff;
|
51 |
+
float:none!important;
|
52 |
+
font-size: 18px!important;
|
53 |
+
margin:10px 0px 0px;
|
54 |
+
padding:7px 22px;
|
55 |
+
text-decoration: none;
|
56 |
+
text-transform: none;
|
57 |
+
border-radius:0px;
|
58 |
+
}
|
59 |
+
.enter-world .enter-world-right .enter-world-info ul li .news-button:hover{
|
60 |
+
background:#666;
|
61 |
+
border: medium none;
|
62 |
+
color: #fff;
|
63 |
+
float: none!important;
|
64 |
+
font-size: 18px!important;
|
65 |
+
margin:10px 0px 0px;
|
66 |
+
padding:7px 22px;
|
67 |
+
text-decoration: none;
|
68 |
+
text-transform: none;
|
69 |
+
}
|
70 |
+
|
71 |
+
#overlay_form{ background: none repeat scroll 0 0 white; box-shadow: 0 0 49px #000000; margin: 0 0; padding: 10px 1%; position: fixed !important; width:25%; z-index: 10000;}
|
72 |
+
|
73 |
+
#size-chart-overlay_form {
|
74 |
+
overflow: scroll;
|
75 |
+
background: none repeat scroll 0 0 white;
|
76 |
+
box-shadow: 0 0 10px #999999;
|
77 |
+
border-radius:8px;
|
78 |
+
margin: 0;
|
79 |
+
padding:20px;
|
80 |
+
position: fixed !important;
|
81 |
+
width:900px;
|
82 |
+
z-index: 100;
|
83 |
+
top:40px!important;
|
84 |
+
}
|
85 |
+
#size-chart-overlay_form #close1.close{ position:absolute!important; right:20px!important; top:20px!important;}
|
86 |
+
#pop_1{display: block;float:left;border: 1px solid gray;width: 65px;text-align: center;padding: 6px;border-radius: 5px;text-decoration: none;z-index: 100;}
|
87 |
+
#pop_1:hover{ box-shadow:0px 0px 10px #F00;
|
88 |
+
}
|
89 |
+
.background_overlay { position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 105; background:#000; opacity: 0.1;}
|
90 |
+
|
91 |
+
/* Popup Enter the World Ends */
|
skin/frontend/base/default/css/ajaxnewsletter/radio-btn-img.jpg
ADDED
Binary file
|