DigitalPianism_Abandonedcarts - Version 0.3.4

Version Notes

- Fix a bug where the email would not be reflect the right store when sharing customers account globally.

Download this release

Release Info

Developer Digital Pianism
Extension DigitalPianism_Abandonedcarts
Version 0.3.4
Comparing to
See all releases


Code changes from version 0.3.3 to 0.3.4

app/code/community/DigitalPianism/Abandonedcarts/Model/Observer.php CHANGED
@@ -10,6 +10,8 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
10
  protected $_saleRecipients = array();
11
  protected $_today = "";
12
  protected $_customerGroups = "";
 
 
13
 
14
  protected function _setToday()
15
  {
@@ -94,7 +96,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
94
  $_productCollection->setPageSize(1);
95
 
96
  // Add product image
97
- $emailTemplateVariables['productimage'] = (string)Mage::helper('catalog/image')->init($_productCollection->getFirstItem(), 'image');
98
 
99
  $emailTemplateVariables['extraproductcount'] = 0;
100
  }
@@ -107,6 +109,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
107
  }
108
  // Assign the array of template variables
109
  $this->_recipients[$args['row']['customer_email']]['emailTemplateVariables'] = $emailTemplateVariables;
 
110
  }
111
 
112
  /**
@@ -203,6 +206,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
203
 
204
  // Assign the array of template variables
205
  $this->_saleRecipients[$args['row']['customer_email']]['emailTemplateVariables'] = $emailTemplateVariables;
 
206
  }
207
  }
208
 
@@ -214,16 +218,18 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
214
  {
215
  try
216
  {
217
- // Get the transactional email template
218
- $templateId = Mage::getStoreConfig('abandonedcartsconfig/options/email_template_sale');
219
- // Get the sender
220
- $sender = array();
221
- $sender['email'] = Mage::getStoreConfig('abandonedcartsconfig/options/email');
222
- $sender['name'] = Mage::getStoreConfig('abandonedcartsconfig/options/name');
223
-
224
  // Send the emails via a loop
225
  foreach ($this->_getSaleRecipients() as $email => $recipient)
226
  {
 
 
 
 
 
 
 
 
 
227
  // Don't send the email if dryrun is set
228
  if ($dryrun)
229
  {
@@ -287,16 +293,18 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
287
  {
288
  try
289
  {
290
- // Get the transactional email template
291
- $templateId = Mage::getStoreConfig('abandonedcartsconfig/options/email_template');
292
- // Get the sender
293
- $sender = array();
294
- $sender['email'] = Mage::getStoreConfig('abandonedcartsconfig/options/email');
295
- $sender['name'] = Mage::getStoreConfig('abandonedcartsconfig/options/name');
296
-
297
  // Send the emails via a loop
298
  foreach ($this->_getRecipients() as $email => $recipient)
299
  {
 
 
 
 
 
 
 
 
 
300
  // Don't send the email if dryrun is set
301
  if ($dryrun)
302
  {
@@ -365,6 +373,8 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
365
  if (Mage::helper('abandonedcarts')->getTestEmail()) $testemail = Mage::helper('abandonedcarts')->getTestEmail();
366
  // Set customer groups
367
  $this->_customerGroups = $this->_customerGroups ? $this->_customerGroups : Mage::helper('abandonedcarts')->getCustomerGroupsLimitation();
 
 
368
 
369
  if (Mage::helper('abandonedcarts')->isSaleEnabled())
370
  {
@@ -389,6 +399,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
389
 
390
  // Get the store id
391
  $storeId = $store->getStoreId();
 
392
 
393
  // Init the store to be able to load the quote and the collections properly
394
  Mage::app()->init($storeId,'store');
@@ -529,9 +540,12 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
529
  // Send the emails
530
  $this->_sendSaleEmails($dryrun,$testemail);
531
  }
 
 
532
  }
533
  catch (Exception $e)
534
  {
 
535
  Mage::helper('abandonedcarts')->log(__METHOD__ . " " . $e->getMessage());
536
  }
537
  }
@@ -549,6 +563,8 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
549
  // Set customer groups
550
  $this->_customerGroups = $this->_customerGroups ? $this->_customerGroups : Mage::helper('abandonedcarts')->getCustomerGroupsLimitation();
551
 
 
 
552
  try
553
  {
554
  if (Mage::helper('abandonedcarts')->isEnabled())
@@ -587,6 +603,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
587
 
588
  // Get the store id
589
  $storeId = $store->getStoreId();
 
590
  // Init the store to be able to load the quote and the collections properly
591
  Mage::app()->init($storeId,'store');
592
 
@@ -699,9 +716,12 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
699
  // Send the emails
700
  $this->_sendEmails($dryrun,$testemail);
701
  }
 
 
702
  }
703
  catch (Exception $e)
704
  {
 
705
  Mage::helper('abandonedcarts')->log(__METHOD__ . " " . $e->getMessage());
706
  }
707
  }
10
  protected $_saleRecipients = array();
11
  protected $_today = "";
12
  protected $_customerGroups = "";
13
+ protected $_currentStoreId;
14
+ protected $_originalStoreId;
15
 
16
  protected function _setToday()
17
  {
96
  $_productCollection->setPageSize(1);
97
 
98
  // Add product image
99
+ //$emailTemplateVariables['productimage'] = (string)Mage::helper('catalog/image')->init($_productCollection->getFirstItem(), 'image');
100
 
101
  $emailTemplateVariables['extraproductcount'] = 0;
102
  }
109
  }
110
  // Assign the array of template variables
111
  $this->_recipients[$args['row']['customer_email']]['emailTemplateVariables'] = $emailTemplateVariables;
112
+ $this->_recipients[$args['row']['customer_email']]['store_id'] = $this->_currentStoreId;
113
  }
114
 
115
  /**
206
 
207
  // Assign the array of template variables
208
  $this->_saleRecipients[$args['row']['customer_email']]['emailTemplateVariables'] = $emailTemplateVariables;
209
+ $this->_saleRecipients[$args['row']['customer_email']]['store_id'] = $this->_currentStoreId;
210
  }
211
  }
212
 
218
  {
219
  try
220
  {
 
 
 
 
 
 
 
221
  // Send the emails via a loop
222
  foreach ($this->_getSaleRecipients() as $email => $recipient)
223
  {
224
+ // Store Id
225
+ Mage::app()->setCurrentStore($recipient['store_id']);
226
+ // Get the transactional email template
227
+ $templateId = Mage::getStoreConfig('abandonedcartsconfig/options/email_template_sale');
228
+ // Get the sender
229
+ $sender = array();
230
+ $sender['email'] = Mage::getStoreConfig('abandonedcartsconfig/options/email');
231
+ $sender['name'] = Mage::getStoreConfig('abandonedcartsconfig/options/name');
232
+
233
  // Don't send the email if dryrun is set
234
  if ($dryrun)
235
  {
293
  {
294
  try
295
  {
 
 
 
 
 
 
 
296
  // Send the emails via a loop
297
  foreach ($this->_getRecipients() as $email => $recipient)
298
  {
299
+ // Store Id
300
+ Mage::app()->setCurrentStore($recipient['store_id']);
301
+ // Get the transactional email template
302
+ $templateId = Mage::getStoreConfig('abandonedcartsconfig/options/email_template');
303
+ // Get the sender
304
+ $sender = array();
305
+ $sender['email'] = Mage::getStoreConfig('abandonedcartsconfig/options/email');
306
+ $sender['name'] = Mage::getStoreConfig('abandonedcartsconfig/options/name');
307
+
308
  // Don't send the email if dryrun is set
309
  if ($dryrun)
310
  {
373
  if (Mage::helper('abandonedcarts')->getTestEmail()) $testemail = Mage::helper('abandonedcarts')->getTestEmail();
374
  // Set customer groups
375
  $this->_customerGroups = $this->_customerGroups ? $this->_customerGroups : Mage::helper('abandonedcarts')->getCustomerGroupsLimitation();
376
+ // Original store id
377
+ $this->_originalStoreId = Mage::app()->getStore()->getId();
378
 
379
  if (Mage::helper('abandonedcarts')->isSaleEnabled())
380
  {
399
 
400
  // Get the store id
401
  $storeId = $store->getStoreId();
402
+ $this->_currentStoreId = $storeId;
403
 
404
  // Init the store to be able to load the quote and the collections properly
405
  Mage::app()->init($storeId,'store');
540
  // Send the emails
541
  $this->_sendSaleEmails($dryrun,$testemail);
542
  }
543
+
544
+ Mage::app()->setCurrentStore($this->_originalStoreId);
545
  }
546
  catch (Exception $e)
547
  {
548
+ Mage::app()->setCurrentStore($this->_originalStoreId);
549
  Mage::helper('abandonedcarts')->log(__METHOD__ . " " . $e->getMessage());
550
  }
551
  }
563
  // Set customer groups
564
  $this->_customerGroups = $this->_customerGroups ? $this->_customerGroups : Mage::helper('abandonedcarts')->getCustomerGroupsLimitation();
565
 
566
+ $this->_originalStoreId = Mage::app()->getStore()->getId();
567
+
568
  try
569
  {
570
  if (Mage::helper('abandonedcarts')->isEnabled())
603
 
604
  // Get the store id
605
  $storeId = $store->getStoreId();
606
+ $this->_currentStoreId = $storeId;
607
  // Init the store to be able to load the quote and the collections properly
608
  Mage::app()->init($storeId,'store');
609
 
716
  // Send the emails
717
  $this->_sendEmails($dryrun,$testemail);
718
  }
719
+
720
+ Mage::app()->setCurrentStore($this->_originalStoreId);
721
  }
722
  catch (Exception $e)
723
  {
724
+ Mage::app()->setCurrentStore($this->_originalStoreId);
725
  Mage::helper('abandonedcarts')->log(__METHOD__ . " " . $e->getMessage());
726
  }
727
  }
app/code/community/DigitalPianism/Abandonedcarts/etc/config.xml CHANGED
@@ -4,7 +4,7 @@
4
 
5
  <modules>
6
  <DigitalPianism_Abandonedcarts>
7
- <version>0.3.3</version>
8
  </DigitalPianism_Abandonedcarts>
9
  </modules>
10
 
4
 
5
  <modules>
6
  <DigitalPianism_Abandonedcarts>
7
+ <version>0.3.4</version>
8
  </DigitalPianism_Abandonedcarts>
9
  </modules>
10
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DigitalPianism_Abandonedcarts</name>
4
- <version>0.3.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -95,11 +95,11 @@ Save the configuration.&#xD;
95
  &#xD;
96
  &lt;p&gt;To manually trigger the notification system, please access System &amp;gt; Configuration &amp;gt; Digital Pianism &amp;gt; Abandoned carts email and click on the "Send" button&lt;/p&gt;&#xD;
97
  &lt;p&gt;Please note that this functionality will send abandoned carts notification regardless the delay you provided, all possible abandoned carts emails will be sent.&lt;/p&gt;</description>
98
- <notes>- Fix a major bug where the cron tasks would not run.</notes>
99
  <authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
100
- <date>2015-11-26</date>
101
- <time>11:29:24</time>
102
- <contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="Abandonedcarts"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="1c8d9cad5c54bcc28c0760e72406b5e3"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5148fe5929e61f4c8385c6c5be0b89f3"/></dir><dir name="Model"><file name="Observer.php" hash="86f9448aea6059484cb8aeb9e40af421"/><dir name="Sales"><dir name="Resource"><file name="Quote.php" hash="3b2f9f24a74a6ea3b6851d64bd6ae5ba"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AbandonedcartsController.php" hash="c26ae0925cc1ca148f5e3277702842e2"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8ddca513c0ed7e034c476f3e026ceda8"/><file name="config.xml" hash="7c6a6eb641a5052e939487fdab528407"/><file name="system.xml" hash="07f261c1f35321317da8f09f75a37317"/></dir><dir name="sql"><dir name="abandonedcarts_setup"><file name="install-0.0.1.php" hash="851338e4a710b5d94fead688b065f4b5"/><file name="upgrade-0.0.1-0.0.2.php" hash="0227c009e49b97bcf3f34f84c49f0927"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DigitalPianism_Abandonedcarts.xml" hash="8a7657855486c68d548db4ba48e083d2"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="digitalpianism"><dir name="abandonedcarts"><dir name="system"><dir name="config"><file name="button.phtml" hash="8f7e673ea52cd81b616cac01b1022990"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="digitalpianism"><dir name="abandonedcarts"><file name="sales_abandonedcarts.html" hash="f8a5ec3af09730f06ade1fd18fa321e9"/><file name="sales_abandonedcarts_sale.html" hash="22bb7a1e95e336948a43f282e7e58806"/></dir></dir></dir></dir><file name="DigitalPianism_Abandonedcarts.csv" hash="b782bff95dba8b860cd773a674aac6c9"/></dir><dir name="fr_FR"><dir name="template"><dir name="email"><dir name="digitalpianism"><dir name="abandonedcarts"><file name="sales_abandonedcarts.html" hash="5340ea06fbf9d2213ea2f09e7425181b"/><file name="sales_abandonedcarts_sale.html" hash="22592c5467a554ab80195218bec5b6b0"/></dir></dir></dir></dir><file name="DigitalPianism_Abandonedcarts.csv" hash="0f5271e2ad1d6b07061314b18bd170c2"/></dir></target></contents>
103
  <compatible/>
104
  <dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
105
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DigitalPianism_Abandonedcarts</name>
4
+ <version>0.3.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
95
  &#xD;
96
  &lt;p&gt;To manually trigger the notification system, please access System &amp;gt; Configuration &amp;gt; Digital Pianism &amp;gt; Abandoned carts email and click on the "Send" button&lt;/p&gt;&#xD;
97
  &lt;p&gt;Please note that this functionality will send abandoned carts notification regardless the delay you provided, all possible abandoned carts emails will be sent.&lt;/p&gt;</description>
98
+ <notes>- Fix a bug where the email would not be reflect the right store when sharing customers account globally.</notes>
99
  <authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
100
+ <date>2016-03-04</date>
101
+ <time>13:48:22</time>
102
+ <contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="Abandonedcarts"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="1c8d9cad5c54bcc28c0760e72406b5e3"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5148fe5929e61f4c8385c6c5be0b89f3"/></dir><dir name="Model"><file name="Observer.php" hash="e7519a74052a5be0e13c220fff808746"/><dir name="Sales"><dir name="Resource"><file name="Quote.php" hash="3b2f9f24a74a6ea3b6851d64bd6ae5ba"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AbandonedcartsController.php" hash="c26ae0925cc1ca148f5e3277702842e2"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8ddca513c0ed7e034c476f3e026ceda8"/><file name="config.xml" hash="349a9c6acd26991fd51e93b058ee6a98"/><file name="system.xml" hash="07f261c1f35321317da8f09f75a37317"/></dir><dir name="sql"><dir name="abandonedcarts_setup"><file name="install-0.0.1.php" hash="851338e4a710b5d94fead688b065f4b5"/><file name="upgrade-0.0.1-0.0.2.php" hash="0227c009e49b97bcf3f34f84c49f0927"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DigitalPianism_Abandonedcarts.xml" hash="8a7657855486c68d548db4ba48e083d2"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="digitalpianism"><dir name="abandonedcarts"><dir name="system"><dir name="config"><file name="button.phtml" hash="8f7e673ea52cd81b616cac01b1022990"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="digitalpianism"><dir name="abandonedcarts"><file name="sales_abandonedcarts.html" hash="f8a5ec3af09730f06ade1fd18fa321e9"/><file name="sales_abandonedcarts_sale.html" hash="22bb7a1e95e336948a43f282e7e58806"/></dir></dir></dir></dir><file name="DigitalPianism_Abandonedcarts.csv" hash="b782bff95dba8b860cd773a674aac6c9"/></dir><dir name="fr_FR"><dir name="template"><dir name="email"><dir name="digitalpianism"><dir name="abandonedcarts"><file name="sales_abandonedcarts.html" hash="5340ea06fbf9d2213ea2f09e7425181b"/><file name="sales_abandonedcarts_sale.html" hash="22592c5467a554ab80195218bec5b6b0"/></dir></dir></dir></dir><file name="DigitalPianism_Abandonedcarts.csv" hash="0f5271e2ad1d6b07061314b18bd170c2"/></dir></target></contents>
103
  <compatible/>
104
  <dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
105
  </package>