Version Notes
- Add customer groups limitation to the configuration.
- Rename functions and change their scope in the observer.
Download this release
Release Info
| Developer | Digital Pianism |
| Extension | DigitalPianism_Abandonedcarts |
| Version | 0.3.0 |
| Comparing to | |
| See all releases | |
Code changes from version 0.2.3 to 0.3.0
- app/code/community/DigitalPianism/Abandonedcarts/Helper/Data.php +9 -1
- app/code/community/DigitalPianism/Abandonedcarts/Model/Observer.php +58 -35
- app/code/community/DigitalPianism/Abandonedcarts/etc/config.xml +2 -1
- app/code/community/DigitalPianism/Abandonedcarts/etc/system.xml +12 -3
- package.xml +6 -5
app/code/community/DigitalPianism/Abandonedcarts/Helper/Data.php
CHANGED
|
@@ -47,5 +47,13 @@ class DigitalPianism_Abandonedcarts_Helper_Data extends Mage_Core_Helper_Abstrac
|
|
| 47 |
{
|
| 48 |
return Mage::getStoreConfig('abandonedcartsconfig/options/testemail');
|
| 49 |
}
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
}
|
| 47 |
{
|
| 48 |
return Mage::getStoreConfig('abandonedcartsconfig/options/testemail');
|
| 49 |
}
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* @return mixed
|
| 53 |
+
*/
|
| 54 |
+
public function getCustomerGroupsLimitation()
|
| 55 |
+
{
|
| 56 |
+
return explode(',',Mage::getStoreConfig('abandonedcartsconfig/options/customer_groups'));
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
}
|
app/code/community/DigitalPianism/Abandonedcarts/Model/Observer.php
CHANGED
|
@@ -6,11 +6,12 @@
|
|
| 6 |
class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstract
|
| 7 |
{
|
| 8 |
|
| 9 |
-
protected $
|
| 10 |
-
protected $
|
| 11 |
-
protected $
|
| 12 |
-
|
| 13 |
-
|
|
|
|
| 14 |
{
|
| 15 |
// Date handling
|
| 16 |
$store = Mage_Core_Model_App::ADMIN_STORE_ID;
|
|
@@ -31,31 +32,31 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 31 |
|
| 32 |
date_default_timezone_set($timezone);
|
| 33 |
|
| 34 |
-
$this->
|
| 35 |
}
|
| 36 |
|
| 37 |
/**
|
| 38 |
* @return string
|
| 39 |
*/
|
| 40 |
-
|
| 41 |
{
|
| 42 |
-
return $this->
|
| 43 |
}
|
| 44 |
|
| 45 |
/**
|
| 46 |
* @return array
|
| 47 |
*/
|
| 48 |
-
|
| 49 |
{
|
| 50 |
-
return $this->
|
| 51 |
}
|
| 52 |
|
| 53 |
/**
|
| 54 |
* @return array
|
| 55 |
*/
|
| 56 |
-
|
| 57 |
{
|
| 58 |
-
return $this->
|
| 59 |
}
|
| 60 |
|
| 61 |
/**
|
|
@@ -63,8 +64,14 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 63 |
*/
|
| 64 |
public function generateRecipients($args)
|
| 65 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
// Test if the customer is already in the array
|
| 67 |
-
if (!array_key_exists($args['row']['customer_email'], $this->
|
| 68 |
{
|
| 69 |
// Create an array of variables to assign to template
|
| 70 |
$emailTemplateVariables = array();
|
|
@@ -75,7 +82,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 75 |
$emailTemplateVariables['productname'] = $args['row']['product_name'];
|
| 76 |
|
| 77 |
// Assign the values to the array of recipients
|
| 78 |
-
$this->
|
| 79 |
|
| 80 |
// Get product image via collection
|
| 81 |
$_productCollection = Mage::getResourceModel('catalog/product_collection');
|
|
@@ -94,12 +101,12 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 94 |
else
|
| 95 |
{
|
| 96 |
// We create some extra variables if there is several products in the cart
|
| 97 |
-
$emailTemplateVariables = $this->
|
| 98 |
// We increase the product count
|
| 99 |
$emailTemplateVariables['extraproductcount'] += 1;
|
| 100 |
}
|
| 101 |
// Assign the array of template variables
|
| 102 |
-
$this->
|
| 103 |
}
|
| 104 |
|
| 105 |
/**
|
|
@@ -107,18 +114,24 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 107 |
*/
|
| 108 |
public function generateSaleRecipients($args)
|
| 109 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
// Double check if the special from date is set
|
| 111 |
if (!array_key_exists('product_special_from_date',$args['row']) || !$args['row']['product_special_from_date'])
|
| 112 |
{
|
| 113 |
// If not we use today for the comparison
|
| 114 |
-
$fromDate = $this->
|
| 115 |
}
|
| 116 |
else $fromDate = $args['row']['product_special_from_date'];
|
| 117 |
|
| 118 |
// Do the same for the special to date
|
| 119 |
if (!array_key_exists('product_special_to_date',$args['row']) || !$args['row']['product_special_to_date'])
|
| 120 |
{
|
| 121 |
-
$toDate = $this->
|
| 122 |
}
|
| 123 |
else $toDate = $args['row']['product_special_to_date'];
|
| 124 |
|
|
@@ -127,12 +140,12 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 127 |
if ($args['row']['product_price_in_cart'] > 0.00
|
| 128 |
&& $args['row']['product_special_price'] > 0.00
|
| 129 |
&& ($args['row']['product_price_in_cart'] > $args['row']['product_special_price'])
|
| 130 |
-
&& ($fromDate <= $this->
|
| 131 |
-
&& ($toDate >= $this->
|
| 132 |
{
|
| 133 |
|
| 134 |
// Test if the customer is already in the array
|
| 135 |
-
if (!array_key_exists($args['row']['customer_email'], $this->
|
| 136 |
{
|
| 137 |
// Create an array of variables to assign to template
|
| 138 |
$emailTemplateVariables = array();
|
|
@@ -145,7 +158,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 145 |
$emailTemplateVariables['specialprice'] = number_format($args['row']['product_special_price'],2);
|
| 146 |
|
| 147 |
// Assign the values to the array of recipients
|
| 148 |
-
$this->
|
| 149 |
|
| 150 |
// Get product image via collection
|
| 151 |
$_productCollection = Mage::getResourceModel('catalog/product_collection');
|
|
@@ -162,7 +175,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 162 |
else
|
| 163 |
{
|
| 164 |
// We create some extra variables if there is several products in the cart
|
| 165 |
-
$emailTemplateVariables = $this->
|
| 166 |
// Discount amount
|
| 167 |
// If one product before
|
| 168 |
if (!array_key_exists('discount',$emailTemplateVariables))
|
|
@@ -189,7 +202,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 189 |
}
|
| 190 |
|
| 191 |
// Assign the array of template variables
|
| 192 |
-
$this->
|
| 193 |
}
|
| 194 |
}
|
| 195 |
|
|
@@ -197,7 +210,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 197 |
* @param $dryrun
|
| 198 |
* @param $testemail
|
| 199 |
*/
|
| 200 |
-
|
| 201 |
{
|
| 202 |
try
|
| 203 |
{
|
|
@@ -209,7 +222,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 209 |
$sender['name'] = Mage::getStoreConfig('abandonedcartsconfig/options/name');
|
| 210 |
|
| 211 |
// Send the emails via a loop
|
| 212 |
-
foreach ($this->
|
| 213 |
{
|
| 214 |
// Don't send the email if dryrun is set
|
| 215 |
if ($dryrun)
|
|
@@ -270,7 +283,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 270 |
* @param $dryrun
|
| 271 |
* @param $testemail
|
| 272 |
*/
|
| 273 |
-
|
| 274 |
{
|
| 275 |
try
|
| 276 |
{
|
|
@@ -282,7 +295,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 282 |
$sender['name'] = Mage::getStoreConfig('abandonedcartsconfig/options/name');
|
| 283 |
|
| 284 |
// Send the emails via a loop
|
| 285 |
-
foreach ($this->
|
| 286 |
{
|
| 287 |
// Don't send the email if dryrun is set
|
| 288 |
if ($dryrun)
|
|
@@ -350,9 +363,12 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 350 |
{
|
| 351 |
if (Mage::helper('abandonedcarts')->getDryRun()) $dryrun = true;
|
| 352 |
if (Mage::helper('abandonedcarts')->getTestEmail()) $testemail = Mage::helper('abandonedcarts')->getTestEmail();
|
|
|
|
|
|
|
|
|
|
| 353 |
if (Mage::helper('abandonedcarts')->isSaleEnabled())
|
| 354 |
{
|
| 355 |
-
$this->
|
| 356 |
|
| 357 |
// Get the attribute id for the status attribute
|
| 358 |
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
|
@@ -404,7 +420,8 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 404 |
'quote_items.price as product_price_in_cart',
|
| 405 |
'quote_table.customer_email as customer_email',
|
| 406 |
'quote_table.customer_firstname as customer_firstname',
|
| 407 |
-
'quote_table.customer_lastname as customer_lastname'
|
|
|
|
| 408 |
)
|
| 409 |
)
|
| 410 |
->joinInner(
|
|
@@ -448,7 +465,8 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 448 |
'quote_items.price as product_price_in_cart',
|
| 449 |
'quote_table.customer_email as customer_email',
|
| 450 |
'quote_table.customer_firstname as customer_firstname',
|
| 451 |
-
'quote_table.customer_lastname as customer_lastname'
|
|
|
|
| 452 |
)
|
| 453 |
)
|
| 454 |
// Name
|
|
@@ -509,7 +527,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 509 |
}
|
| 510 |
|
| 511 |
// Send the emails
|
| 512 |
-
$this->
|
| 513 |
}
|
| 514 |
}
|
| 515 |
catch (Exception $e)
|
|
@@ -528,6 +546,9 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 528 |
{
|
| 529 |
if (Mage::helper('abandonedcarts')->getDryRun()) $dryrun = true;
|
| 530 |
if (Mage::helper('abandonedcarts')->getTestEmail()) $testemail = Mage::helper('abandonedcarts')->getTestEmail();
|
|
|
|
|
|
|
|
|
|
| 531 |
try
|
| 532 |
{
|
| 533 |
if (Mage::helper('abandonedcarts')->isEnabled())
|
|
@@ -588,7 +609,8 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 588 |
'quote_table.abandoned_notified as has_been_notified',
|
| 589 |
'quote_table.customer_email as customer_email',
|
| 590 |
'quote_table.customer_firstname as customer_firstname',
|
| 591 |
-
'quote_table.customer_lastname as customer_lastname'
|
|
|
|
| 592 |
)
|
| 593 |
)
|
| 594 |
->joinInner(
|
|
@@ -628,7 +650,8 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 628 |
'quote_table.abandoned_notified as has_been_notified',
|
| 629 |
'quote_table.customer_email as customer_email',
|
| 630 |
'quote_table.customer_firstname as customer_firstname',
|
| 631 |
-
'quote_table.customer_lastname as customer_lastname'
|
|
|
|
| 632 |
)
|
| 633 |
)
|
| 634 |
// Name
|
|
@@ -671,7 +694,7 @@ class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstr
|
|
| 671 |
}
|
| 672 |
|
| 673 |
// Send the emails
|
| 674 |
-
$this->
|
| 675 |
}
|
| 676 |
}
|
| 677 |
catch (Exception $e)
|
| 6 |
class DigitalPianism_Abandonedcarts_Model_Observer extends Mage_Core_Model_Abstract
|
| 7 |
{
|
| 8 |
|
| 9 |
+
protected $_recipients = array();
|
| 10 |
+
protected $_saleRecipients = array();
|
| 11 |
+
protected $_today = "";
|
| 12 |
+
protected $_customerGroups = "";
|
| 13 |
+
|
| 14 |
+
protected function _setToday()
|
| 15 |
{
|
| 16 |
// Date handling
|
| 17 |
$store = Mage_Core_Model_App::ADMIN_STORE_ID;
|
| 32 |
|
| 33 |
date_default_timezone_set($timezone);
|
| 34 |
|
| 35 |
+
$this->_today = $today->toString("Y-MM-dd HH:mm:ss");
|
| 36 |
}
|
| 37 |
|
| 38 |
/**
|
| 39 |
* @return string
|
| 40 |
*/
|
| 41 |
+
protected function _getToday()
|
| 42 |
{
|
| 43 |
+
return $this->_today;
|
| 44 |
}
|
| 45 |
|
| 46 |
/**
|
| 47 |
* @return array
|
| 48 |
*/
|
| 49 |
+
protected function _getRecipients()
|
| 50 |
{
|
| 51 |
+
return $this->_recipients;
|
| 52 |
}
|
| 53 |
|
| 54 |
/**
|
| 55 |
* @return array
|
| 56 |
*/
|
| 57 |
+
protected function _getSaleRecipients()
|
| 58 |
{
|
| 59 |
+
return $this->_saleRecipients;
|
| 60 |
}
|
| 61 |
|
| 62 |
/**
|
| 64 |
*/
|
| 65 |
public function generateRecipients($args)
|
| 66 |
{
|
| 67 |
+
// Customer group check
|
| 68 |
+
if (array_key_exists('customer_group',$args['row']) && !in_array($args['row']['customer_group'],$this->_customerGroups))
|
| 69 |
+
{
|
| 70 |
+
return;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
// Test if the customer is already in the array
|
| 74 |
+
if (!array_key_exists($args['row']['customer_email'], $this->_recipients))
|
| 75 |
{
|
| 76 |
// Create an array of variables to assign to template
|
| 77 |
$emailTemplateVariables = array();
|
| 82 |
$emailTemplateVariables['productname'] = $args['row']['product_name'];
|
| 83 |
|
| 84 |
// Assign the values to the array of recipients
|
| 85 |
+
$this->_recipients[$args['row']['customer_email']]['cartId'] = $args['row']['cart_id'];
|
| 86 |
|
| 87 |
// Get product image via collection
|
| 88 |
$_productCollection = Mage::getResourceModel('catalog/product_collection');
|
| 101 |
else
|
| 102 |
{
|
| 103 |
// We create some extra variables if there is several products in the cart
|
| 104 |
+
$emailTemplateVariables = $this->_recipients[$args['row']['customer_email']]['emailTemplateVariables'];
|
| 105 |
// We increase the product count
|
| 106 |
$emailTemplateVariables['extraproductcount'] += 1;
|
| 107 |
}
|
| 108 |
// Assign the array of template variables
|
| 109 |
+
$this->_recipients[$args['row']['customer_email']]['emailTemplateVariables'] = $emailTemplateVariables;
|
| 110 |
}
|
| 111 |
|
| 112 |
/**
|
| 114 |
*/
|
| 115 |
public function generateSaleRecipients($args)
|
| 116 |
{
|
| 117 |
+
// Customer group check
|
| 118 |
+
if (array_key_exists('customer_group',$args['row']) && !in_array($args['row']['customer_group'],$this->_customerGroups))
|
| 119 |
+
{
|
| 120 |
+
return;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
// Double check if the special from date is set
|
| 124 |
if (!array_key_exists('product_special_from_date',$args['row']) || !$args['row']['product_special_from_date'])
|
| 125 |
{
|
| 126 |
// If not we use today for the comparison
|
| 127 |
+
$fromDate = $this->_getToday();
|
| 128 |
}
|
| 129 |
else $fromDate = $args['row']['product_special_from_date'];
|
| 130 |
|
| 131 |
// Do the same for the special to date
|
| 132 |
if (!array_key_exists('product_special_to_date',$args['row']) || !$args['row']['product_special_to_date'])
|
| 133 |
{
|
| 134 |
+
$toDate = $this->_getToday();
|
| 135 |
}
|
| 136 |
else $toDate = $args['row']['product_special_to_date'];
|
| 137 |
|
| 140 |
if ($args['row']['product_price_in_cart'] > 0.00
|
| 141 |
&& $args['row']['product_special_price'] > 0.00
|
| 142 |
&& ($args['row']['product_price_in_cart'] > $args['row']['product_special_price'])
|
| 143 |
+
&& ($fromDate <= $this->_getToday())
|
| 144 |
+
&& ($toDate >= $this->_getToday()))
|
| 145 |
{
|
| 146 |
|
| 147 |
// Test if the customer is already in the array
|
| 148 |
+
if (!array_key_exists($args['row']['customer_email'], $this->_saleRecipients))
|
| 149 |
{
|
| 150 |
// Create an array of variables to assign to template
|
| 151 |
$emailTemplateVariables = array();
|
| 158 |
$emailTemplateVariables['specialprice'] = number_format($args['row']['product_special_price'],2);
|
| 159 |
|
| 160 |
// Assign the values to the array of recipients
|
| 161 |
+
$this->_saleRecipients[$args['row']['customer_email']]['cartId'] = $args['row']['cart_id'];
|
| 162 |
|
| 163 |
// Get product image via collection
|
| 164 |
$_productCollection = Mage::getResourceModel('catalog/product_collection');
|
| 175 |
else
|
| 176 |
{
|
| 177 |
// We create some extra variables if there is several products in the cart
|
| 178 |
+
$emailTemplateVariables = $this->_saleRecipients[$args['row']['customer_email']]['emailTemplateVariables'];
|
| 179 |
// Discount amount
|
| 180 |
// If one product before
|
| 181 |
if (!array_key_exists('discount',$emailTemplateVariables))
|
| 202 |
}
|
| 203 |
|
| 204 |
// Assign the array of template variables
|
| 205 |
+
$this->_saleRecipients[$args['row']['customer_email']]['emailTemplateVariables'] = $emailTemplateVariables;
|
| 206 |
}
|
| 207 |
}
|
| 208 |
|
| 210 |
* @param $dryrun
|
| 211 |
* @param $testemail
|
| 212 |
*/
|
| 213 |
+
protected function _sendSaleEmails($dryrun,$testemail)
|
| 214 |
{
|
| 215 |
try
|
| 216 |
{
|
| 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)
|
| 283 |
* @param $dryrun
|
| 284 |
* @param $testemail
|
| 285 |
*/
|
| 286 |
+
protected function _sendEmails($dryrun,$testemail)
|
| 287 |
{
|
| 288 |
try
|
| 289 |
{
|
| 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)
|
| 363 |
{
|
| 364 |
if (Mage::helper('abandonedcarts')->getDryRun()) $dryrun = true;
|
| 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 |
{
|
| 371 |
+
$this->_setToday();
|
| 372 |
|
| 373 |
// Get the attribute id for the status attribute
|
| 374 |
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
| 420 |
'quote_items.price as product_price_in_cart',
|
| 421 |
'quote_table.customer_email as customer_email',
|
| 422 |
'quote_table.customer_firstname as customer_firstname',
|
| 423 |
+
'quote_table.customer_lastname as customer_lastname',
|
| 424 |
+
'quote_table.customer_group_id as customer_group'
|
| 425 |
)
|
| 426 |
)
|
| 427 |
->joinInner(
|
| 465 |
'quote_items.price as product_price_in_cart',
|
| 466 |
'quote_table.customer_email as customer_email',
|
| 467 |
'quote_table.customer_firstname as customer_firstname',
|
| 468 |
+
'quote_table.customer_lastname as customer_lastname',
|
| 469 |
+
'quote_table.customer_group_id as customer_group'
|
| 470 |
)
|
| 471 |
)
|
| 472 |
// Name
|
| 527 |
}
|
| 528 |
|
| 529 |
// Send the emails
|
| 530 |
+
$this->_sendSaleEmails($dryrun,$testemail);
|
| 531 |
}
|
| 532 |
}
|
| 533 |
catch (Exception $e)
|
| 546 |
{
|
| 547 |
if (Mage::helper('abandonedcarts')->getDryRun()) $dryrun = true;
|
| 548 |
if (Mage::helper('abandonedcarts')->getTestEmail()) $testemail = Mage::helper('abandonedcarts')->getTestEmail();
|
| 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())
|
| 609 |
'quote_table.abandoned_notified as has_been_notified',
|
| 610 |
'quote_table.customer_email as customer_email',
|
| 611 |
'quote_table.customer_firstname as customer_firstname',
|
| 612 |
+
'quote_table.customer_lastname as customer_lastname',
|
| 613 |
+
'quote_table.customer_group_id as customer_group'
|
| 614 |
)
|
| 615 |
)
|
| 616 |
->joinInner(
|
| 650 |
'quote_table.abandoned_notified as has_been_notified',
|
| 651 |
'quote_table.customer_email as customer_email',
|
| 652 |
'quote_table.customer_firstname as customer_firstname',
|
| 653 |
+
'quote_table.customer_lastname as customer_lastname',
|
| 654 |
+
'quote_table.customer_group_id as customer_group'
|
| 655 |
)
|
| 656 |
)
|
| 657 |
// Name
|
| 694 |
}
|
| 695 |
|
| 696 |
// Send the emails
|
| 697 |
+
$this->_sendEmails($dryrun,$testemail);
|
| 698 |
}
|
| 699 |
}
|
| 700 |
catch (Exception $e)
|
app/code/community/DigitalPianism/Abandonedcarts/etc/config.xml
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
|
| 5 |
<modules>
|
| 6 |
<DigitalPianism_Abandonedcarts>
|
| 7 |
-
<version>0.
|
| 8 |
</DigitalPianism_Abandonedcarts>
|
| 9 |
</modules>
|
| 10 |
|
|
@@ -131,6 +131,7 @@
|
|
| 131 |
<notify_delay>20</notify_delay>
|
| 132 |
<email_template>abandonedcartsconfig_options_email_template</email_template>
|
| 133 |
<email_template_sale>abandonedcartsconfig_options_email_template_sale</email_template_sale>
|
|
|
|
| 134 |
</options>
|
| 135 |
</abandonedcartsconfig>
|
| 136 |
</default>
|
| 4 |
|
| 5 |
<modules>
|
| 6 |
<DigitalPianism_Abandonedcarts>
|
| 7 |
+
<version>0.3.0</version>
|
| 8 |
</DigitalPianism_Abandonedcarts>
|
| 9 |
</modules>
|
| 10 |
|
| 131 |
<notify_delay>20</notify_delay>
|
| 132 |
<email_template>abandonedcartsconfig_options_email_template</email_template>
|
| 133 |
<email_template_sale>abandonedcartsconfig_options_email_template_sale</email_template_sale>
|
| 134 |
+
<customer_groups>1,2,3</customer_groups>
|
| 135 |
</options>
|
| 136 |
</abandonedcartsconfig>
|
| 137 |
</default>
|
app/code/community/DigitalPianism/Abandonedcarts/etc/system.xml
CHANGED
|
@@ -69,7 +69,7 @@
|
|
| 69 |
<show_in_website>1</show_in_website>
|
| 70 |
<show_in_store>1</show_in_store>
|
| 71 |
</email_template>
|
| 72 |
-
<notify_delay translate="label">
|
| 73 |
<label>Send Abandoned Cart Email After</label>
|
| 74 |
<frontend_type>text</frontend_type>
|
| 75 |
<validate>validate-not-negative-number</validate>
|
|
@@ -97,7 +97,16 @@
|
|
| 97 |
<show_in_website>1</show_in_website>
|
| 98 |
<show_in_store>1</show_in_store>
|
| 99 |
</email_template_sale>
|
| 100 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
<label>Dry Run</label>
|
| 102 |
<frontend_type>select</frontend_type>
|
| 103 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
|
@@ -107,7 +116,7 @@
|
|
| 107 |
<show_in_store>1</show_in_store>
|
| 108 |
<comment>Setting this parameter to Yes will log all the email addresses supposed to receive a notification into the var/log/digitalpianism_abandonedcarts.log file and will not send the real email notification</comment>
|
| 109 |
</dryrun>
|
| 110 |
-
<testemail translate="label">
|
| 111 |
<label>Test Email</label>
|
| 112 |
<frontend_type>text</frontend_type>
|
| 113 |
<sort_order>90</sort_order>
|
| 69 |
<show_in_website>1</show_in_website>
|
| 70 |
<show_in_store>1</show_in_store>
|
| 71 |
</email_template>
|
| 72 |
+
<notify_delay translate="label comment">
|
| 73 |
<label>Send Abandoned Cart Email After</label>
|
| 74 |
<frontend_type>text</frontend_type>
|
| 75 |
<validate>validate-not-negative-number</validate>
|
| 97 |
<show_in_website>1</show_in_website>
|
| 98 |
<show_in_store>1</show_in_store>
|
| 99 |
</email_template_sale>
|
| 100 |
+
<customer_groups translate="label">
|
| 101 |
+
<label>Customer Groups Restriction</label>
|
| 102 |
+
<frontend_type>multiselect</frontend_type>
|
| 103 |
+
<source_model>adminhtml/system_config_source_customer_group_multiselect</source_model>
|
| 104 |
+
<sort_order>75</sort_order>
|
| 105 |
+
<show_in_default>1</show_in_default>
|
| 106 |
+
<show_in_website>1</show_in_website>
|
| 107 |
+
<show_in_store>1</show_in_store>
|
| 108 |
+
</customer_groups>
|
| 109 |
+
<dryrun translate="label comment">
|
| 110 |
<label>Dry Run</label>
|
| 111 |
<frontend_type>select</frontend_type>
|
| 112 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 116 |
<show_in_store>1</show_in_store>
|
| 117 |
<comment>Setting this parameter to Yes will log all the email addresses supposed to receive a notification into the var/log/digitalpianism_abandonedcarts.log file and will not send the real email notification</comment>
|
| 118 |
</dryrun>
|
| 119 |
+
<testemail translate="label comment">
|
| 120 |
<label>Test Email</label>
|
| 121 |
<frontend_type>text</frontend_type>
|
| 122 |
<sort_order>90</sort_order>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>DigitalPianism_Abandonedcarts</name>
|
| 4 |
-
<version>0.
|
| 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,12 @@ Save the configuration.
|
|
| 95 |

|
| 96 |
<p>To manually trigger the notification system, please access System &gt; Configuration &gt; Digital Pianism &gt; Abandoned carts email and click on the "Send" button</p>
|
| 97 |
<p>Please note that this functionality will send abandoned carts notification regardless the delay you provided, all possible abandoned carts emails will be sent.</p></description>
|
| 98 |
-
<notes>- Add
|
|
|
|
| 99 |
<authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
|
| 100 |
-
<date>2015-
|
| 101 |
-
<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="
|
| 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.0</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 |

|
| 96 |
<p>To manually trigger the notification system, please access System &gt; Configuration &gt; Digital Pianism &gt; Abandoned carts email and click on the "Send" button</p>
|
| 97 |
<p>Please note that this functionality will send abandoned carts notification regardless the delay you provided, all possible abandoned carts emails will be sent.</p></description>
|
| 98 |
+
<notes>- Add customer groups limitation to the configuration.
|
| 99 |
+
- Rename functions and change their scope in the observer.</notes>
|
| 100 |
<authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
|
| 101 |
+
<date>2015-11-09</date>
|
| 102 |
+
<time>22:05:06</time>
|
| 103 |
+
<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="da44cfc8260e379469d30d084bb657d0"/><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="af76ba643fcdf63b75e636a43dc264a9"/><file name="system.xml" hash="4f3de82fe3221fb6b4f81cd646a8200b"/></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="30565f91c47913465fd184a214c14b23"/><file name="sales_abandonedcarts_sale.html" hash="3cdee557727cb0166741062e5fdcf06f"/></dir></dir></dir></dir><file name="DigitalPianism_Abandonedcarts.csv" hash="4e17b6cae58dd1cdcd43b1113e2e09f4"/></dir><dir name="fr_FR"><file name="DigitalPianism_Abandonedcarts.csv" hash=""/></dir></target></contents>
|
| 104 |
<compatible/>
|
| 105 |
<dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 106 |
</package>
|
