Version Notes
Now, Newsletter Email Variables such as 'Unsubscribe URL' are substituted with correct values in the Newsletter Test email.
Download this release
Release Info
Developer | Harish Kumar B P |
Extension | GlyphWebCore_NewsletterTest |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.1.0
app/code/community/GlyphWebCore/NewsletterTest/controllers/Adminhtml/SendtestController.php
CHANGED
@@ -24,15 +24,6 @@ class GlyphWebCore_NewsletterTest_Adminhtml_SendtestController extends Mage_Admi
|
|
24 |
public function postAction()
|
25 |
{
|
26 |
$post = $this->getRequest()->getPost();
|
27 |
-
$sql = "SELECT * FROM newsletter_queue WHERE queue_id =".$post['id'];
|
28 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
29 |
-
|
30 |
-
foreach($connection->fetchAll($sql) as $myrow)
|
31 |
-
{
|
32 |
-
$sender = $myrow['newsletter_sender_email'];
|
33 |
-
$subject = $myrow['newsletter_subject'];
|
34 |
-
$message = $myrow['newsletter_text'];
|
35 |
-
}
|
36 |
|
37 |
try
|
38 |
{
|
@@ -41,9 +32,40 @@ class GlyphWebCore_NewsletterTest_Adminhtml_SendtestController extends Mage_Admi
|
|
41 |
Mage::throwException($this->__('Invalid form data.'));
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
$mail = new Zend_Mail();
|
45 |
$mail->setFrom($sender);
|
46 |
-
$mail->setBodyHtml($
|
47 |
$mail->addTo($post['email'], $post['name']);
|
48 |
$mail->setSubject($subject);
|
49 |
$mail->send();
|
@@ -54,7 +76,7 @@ class GlyphWebCore_NewsletterTest_Adminhtml_SendtestController extends Mage_Admi
|
|
54 |
catch (Exception $e)
|
55 |
{
|
56 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
57 |
-
}
|
58 |
|
59 |
$this->_redirect('*/*/');
|
60 |
}
|
24 |
public function postAction()
|
25 |
{
|
26 |
$post = $this->getRequest()->getPost();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
try
|
29 |
{
|
32 |
Mage::throwException($this->__('Invalid form data.'));
|
33 |
}
|
34 |
|
35 |
+
$template = Mage::getModel('newsletter/template');
|
36 |
+
$queue = Mage::getModel('newsletter/queue');
|
37 |
+
$queue->load($post['id']);
|
38 |
+
$template->setTemplateType($queue->getNewsletterType());
|
39 |
+
$template->setTemplateText($queue->getNewsletterText());
|
40 |
+
$template->setTemplateStyles($queue->getNewsletterStyles());
|
41 |
+
$sender = $queue->getNewsletterSenderEmail();
|
42 |
+
$subject = $queue->getNewsletterSubject();
|
43 |
+
|
44 |
+
$storeId = (int)$this->getRequest()->getParam('store_id');
|
45 |
+
if(!$storeId)
|
46 |
+
{
|
47 |
+
$storeId = Mage::app()->getDefaultStoreView()->getId();
|
48 |
+
}
|
49 |
+
|
50 |
+
Varien_Profiler::start("newsletter_queue_proccessing");
|
51 |
+
|
52 |
+
$vars = array();
|
53 |
+
$vars['subscriber'] = Mage::getModel('newsletter/subscriber');
|
54 |
+
|
55 |
+
$template->emulateDesign($storeId);
|
56 |
+
$templateProcessed = $template->getProcessedTemplate($vars, true);
|
57 |
+
$template->revertDesign();
|
58 |
+
|
59 |
+
if($template->isPlain())
|
60 |
+
{
|
61 |
+
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
|
62 |
+
}
|
63 |
+
|
64 |
+
Varien_Profiler::stop("newsletter_queue_proccessing");
|
65 |
+
|
66 |
$mail = new Zend_Mail();
|
67 |
$mail->setFrom($sender);
|
68 |
+
$mail->setBodyHtml($templateProcessed);
|
69 |
$mail->addTo($post['email'], $post['name']);
|
70 |
$mail->setSubject($subject);
|
71 |
$mail->send();
|
76 |
catch (Exception $e)
|
77 |
{
|
78 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
79 |
+
}
|
80 |
|
81 |
$this->_redirect('*/*/');
|
82 |
}
|
app/code/community/GlyphWebCore/NewsletterTest/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<GlyphWebCore_NewsletterTest>
|
5 |
-
<version>1.0
|
6 |
</GlyphWebCore_NewsletterTest>
|
7 |
</modules>
|
8 |
|
2 |
<config>
|
3 |
<modules>
|
4 |
<GlyphWebCore_NewsletterTest>
|
5 |
+
<version>1.1.0</version>
|
6 |
</GlyphWebCore_NewsletterTest>
|
7 |
</modules>
|
8 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>GlyphWebCore_NewsletterTest</name>
|
4 |
-
<version>1.0
|
5 |
<stability>stable</stability>
|
6 |
<license>Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -9,16 +9,12 @@
|
|
9 |
<summary>Send a Test Newsletter to an email to check how the customers will receive your Newsletter.</summary>
|
10 |
<description>Ever wanted to know how your Newsletter looks like before sending it to your customers? Yes, Magento provides you a preview of the Newsletter, but, sometimes, the format of the Newsletter received to an email client can be different than what you see in the Magento Newsletter preview.
|
11 |

|
12 |
-
Now, you can send a copy of the Newsletter as a test to any email and check how it will look for your customers in their email
|
13 |
-
|
14 |
-
NOTE: In the Test Newsletter that you receive, variables will NOT be replaced with Links. For example,"{{var subscriber.getUnsubscriptionLink()}}" will not be replaced with the actual unsubscribe URL.</description>
|
15 |
-
<notes>1. Fixed 404 error message which occurs when "Send Test Newsletter" menu is clicked.
|
16 |
-

|
17 |
-
2. Adding code to check if active Newsletter Queues are present.</notes>
|
18 |
<authors><author><name>Harish Kumar B P</name><user>magedevelopment</user><email>harishbp@magedevelopment.com</email></author></authors>
|
19 |
-
<date>2013-11-
|
20 |
-
<time>
|
21 |
-
<contents><target name="magecommunity"><dir name="GlyphWebCore"><dir name="NewsletterTest"><dir name="Helper"><file name="Data.php" hash="6b3b2bcdeb4faf7bed8873c7ea1f0d70"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SendtestController.php" hash="
|
22 |
<compatible/>
|
23 |
<dependencies><required><php><min>5.2.0</min><max>5.5.0</max></php></required></dependencies>
|
24 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>GlyphWebCore_NewsletterTest</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>Send a Test Newsletter to an email to check how the customers will receive your Newsletter.</summary>
|
10 |
<description>Ever wanted to know how your Newsletter looks like before sending it to your customers? Yes, Magento provides you a preview of the Newsletter, but, sometimes, the format of the Newsletter received to an email client can be different than what you see in the Magento Newsletter preview.
|
11 |

|
12 |
+
Now, you can send a copy of the Newsletter as a test to any email and check how it will look for your customers in their email.</description>
|
13 |
+
<notes>Now, Newsletter Email Variables such as 'Unsubscribe URL' are substituted with correct values in the Newsletter Test email.</notes>
|
|
|
|
|
|
|
|
|
14 |
<authors><author><name>Harish Kumar B P</name><user>magedevelopment</user><email>harishbp@magedevelopment.com</email></author></authors>
|
15 |
+
<date>2013-11-05</date>
|
16 |
+
<time>14:40:22</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="GlyphWebCore"><dir name="NewsletterTest"><dir name="Helper"><file name="Data.php" hash="6b3b2bcdeb4faf7bed8873c7ea1f0d70"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SendtestController.php" hash="f5c472ae2895b2cc1b28e5a09cb7ce4d"/></dir></dir><dir name="etc"><file name="config.xml" hash="c99417c39b86f481e2f5b9a821c32f7a"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="GlyphWebCore_NewsletterTest.xml" hash="ba5b6f9a14dfeb87f8736792a27d98e8"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="glyphwebcore"><file name="newslettertest.xml" hash="47de848e1847d7c3ab855bcb7cdf4088"/></dir></dir><dir name="template"><dir name="glyphwebcore"><dir name="newslettertest"><file name="sendtest.phtml" hash="67e70e0a536d49167da801a057bcf14f"/></dir></dir></dir></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.2.0</min><max>5.5.0</max></php></required></dependencies>
|
20 |
</package>
|