Version Notes
Thanks to Septoctobre for all the bug reports and pull requests
- Fix a bug where the delay would not be taken into consideration when the cron ran: https://github.com/digitalpianism/abandonedcarts/issues/17
- Fix a bug where the area would not be properly loaded: https://github.com/digitalpianism/abandonedcarts/issues/8 and https://github.com/digitalpianism/abandonedcarts/issues/7
- Fix a bug where the count of total would be wrong because of the quantity : https://github.com/digitalpianism/abandonedcarts/issues/13
- Implement prices columns with currencies : https://github.com/digitalpianism/abandonedcarts/issues/13
- Fix a bug where the sale abandoned carts report would display nothing when flat catalog is enabled : https://github.com/digitalpianism/abandonedcarts/issues/15
- Fix a bug where an error would be triggered when filtering the grid by one date (from OR to) : https://github.com/digitalpianism/abandonedcarts/issues/9
- Fix a bug where the count in the grid would be wrong: https://github.com/digitalpianism/abandonedcarts/issues/11
Release Info
| Developer | Digital Pianism |
| Extension | DigitalPianism_Abandonedcarts |
| Version | 1.0.7 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.5 to 1.0.7
- app/code/community/DigitalPianism/Abandonedcarts/Block/Adminhtml/Abandonedcarts/Grid.php +21 -3
- app/code/community/DigitalPianism/Abandonedcarts/Block/Adminhtml/Saleabandonedcarts/Grid.php +26 -6
- app/code/community/DigitalPianism/Abandonedcarts/Model/Collection.php +2 -2
- app/code/community/DigitalPianism/Abandonedcarts/Model/Notifier.php +28 -2
- app/code/community/DigitalPianism/Abandonedcarts/Model/Resource/Catalog/Product/Collection.php +37 -0
- app/code/community/DigitalPianism/Abandonedcarts/controllers/Adminhtml/AbandonedcartsController.php +2 -2
- app/code/community/DigitalPianism/Abandonedcarts/etc/config.xml +1 -1
- package.xml +13 -5
|
@@ -55,7 +55,7 @@ class DigitalPianism_Abandonedcarts_Block_Adminhtml_Abandonedcarts_Grid extends
|
|
| 55 |
array(
|
| 56 |
'product_ids' => 'GROUP_CONCAT(e.entity_id)',
|
| 57 |
'product_names' => 'GROUP_CONCAT(catalog_flat.name)',
|
| 58 |
-
'product_prices' => 'SUM(catalog_flat.price)'
|
| 59 |
)
|
| 60 |
);
|
| 61 |
} else {
|
|
@@ -63,7 +63,7 @@ class DigitalPianism_Abandonedcarts_Block_Adminhtml_Abandonedcarts_Grid extends
|
|
| 63 |
array(
|
| 64 |
'product_ids' => 'GROUP_CONCAT(e.entity_id)',
|
| 65 |
'product_names' => 'GROUP_CONCAT(catalog_name.value)',
|
| 66 |
-
'product_prices' => 'SUM(catalog_price.value)'
|
| 67 |
)
|
| 68 |
);
|
| 69 |
}
|
|
@@ -75,6 +75,8 @@ class DigitalPianism_Abandonedcarts_Block_Adminhtml_Abandonedcarts_Grid extends
|
|
| 75 |
|
| 76 |
protected function _prepareColumns()
|
| 77 |
{
|
|
|
|
|
|
|
| 78 |
$this->addColumn('customer_email', array(
|
| 79 |
'header' => Mage::helper('abandonedcarts')->__('Customer Email'),
|
| 80 |
'index' => 'customer_email',
|
|
@@ -110,6 +112,8 @@ class DigitalPianism_Abandonedcarts_Block_Adminhtml_Abandonedcarts_Grid extends
|
|
| 110 |
$this->addColumn('product_prices', array(
|
| 111 |
'header' => Mage::helper('abandonedcarts')->__('Cart Total'),
|
| 112 |
'index' => 'product_prices',
|
|
|
|
|
|
|
| 113 |
'filter' => false
|
| 114 |
));
|
| 115 |
|
|
@@ -204,7 +208,21 @@ class DigitalPianism_Abandonedcarts_Block_Adminhtml_Abandonedcarts_Grid extends
|
|
| 204 |
{
|
| 205 |
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
|
| 206 |
$value = $column->getFilter()->getValue();
|
| 207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
}
|
| 209 |
|
| 210 |
}
|
| 55 |
array(
|
| 56 |
'product_ids' => 'GROUP_CONCAT(e.entity_id)',
|
| 57 |
'product_names' => 'GROUP_CONCAT(catalog_flat.name)',
|
| 58 |
+
'product_prices' => 'SUM(catalog_flat.price * quote_items.qty)'
|
| 59 |
)
|
| 60 |
);
|
| 61 |
} else {
|
| 63 |
array(
|
| 64 |
'product_ids' => 'GROUP_CONCAT(e.entity_id)',
|
| 65 |
'product_names' => 'GROUP_CONCAT(catalog_name.value)',
|
| 66 |
+
'product_prices' => 'SUM(catalog_price.value * quote_items.qty)'
|
| 67 |
)
|
| 68 |
);
|
| 69 |
}
|
| 75 |
|
| 76 |
protected function _prepareColumns()
|
| 77 |
{
|
| 78 |
+
$currencyCode = $this->_getStore()->getCurrentCurrencyCode();
|
| 79 |
+
|
| 80 |
$this->addColumn('customer_email', array(
|
| 81 |
'header' => Mage::helper('abandonedcarts')->__('Customer Email'),
|
| 82 |
'index' => 'customer_email',
|
| 112 |
$this->addColumn('product_prices', array(
|
| 113 |
'header' => Mage::helper('abandonedcarts')->__('Cart Total'),
|
| 114 |
'index' => 'product_prices',
|
| 115 |
+
'type' => 'price',
|
| 116 |
+
'currency_code' => $currencyCode,
|
| 117 |
'filter' => false
|
| 118 |
));
|
| 119 |
|
| 208 |
{
|
| 209 |
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
|
| 210 |
$value = $column->getFilter()->getValue();
|
| 211 |
+
|
| 212 |
+
$where = false;
|
| 213 |
+
|
| 214 |
+
if (is_array($value) && array_key_exists('from', $value)) {
|
| 215 |
+
$where = sprintf("%s > '%s'", $field, $value['from']->toString('Y-MM-dd HH:mm:ss'));
|
| 216 |
+
if (array_key_exists('to', $value)) {
|
| 217 |
+
$where .= sprintf(" AND %s < '%s'", $field, $value['to']->toString('Y-MM-dd HH:mm:ss'));
|
| 218 |
+
}
|
| 219 |
+
} elseif (is_array($value) && array_key_exists('to', $value)) {
|
| 220 |
+
$where = sprintf("%s < '%s'", $field, $value['to']->toString('Y-MM-dd HH:mm:ss'));
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
if ($where) {
|
| 224 |
+
$collection->getSelect()->where($where);
|
| 225 |
+
}
|
| 226 |
}
|
| 227 |
|
| 228 |
}
|
|
@@ -53,19 +53,19 @@ class DigitalPianism_Abandonedcarts_Block_Adminhtml_Saleabandonedcarts_Grid exte
|
|
| 53 |
array(
|
| 54 |
'product_ids' => 'GROUP_CONCAT(e.entity_id)',
|
| 55 |
'product_names' => 'GROUP_CONCAT(catalog_flat.name)',
|
| 56 |
-
'product_prices' => 'SUM(quote_items.
|
| 57 |
-
'product_special_prices' => 'SUM(IFNULL(catalog_flat.special_price,quote_items.price))',
|
| 58 |
)
|
| 59 |
);
|
| 60 |
|
| 61 |
-
$collection->getSelect()->having("SUM(quote_items.price)
|
| 62 |
} else {
|
| 63 |
$collection->getSelect()->columns(
|
| 64 |
array(
|
| 65 |
'product_ids' => 'GROUP_CONCAT(e.entity_id)',
|
| 66 |
'product_names' => 'GROUP_CONCAT(catalog_name.value)',
|
| 67 |
-
'product_prices' => 'SUM(quote_items.
|
| 68 |
-
'product_special_prices' => 'SUM(IFNULL(catalog_sprice.value,quote_items.price))',
|
| 69 |
)
|
| 70 |
);
|
| 71 |
|
|
@@ -78,6 +78,8 @@ class DigitalPianism_Abandonedcarts_Block_Adminhtml_Saleabandonedcarts_Grid exte
|
|
| 78 |
|
| 79 |
protected function _prepareColumns()
|
| 80 |
{
|
|
|
|
|
|
|
| 81 |
$this->addColumn('customer_email', array(
|
| 82 |
'header' => Mage::helper('abandonedcarts')->__('Customer Email'),
|
| 83 |
'index' => 'customer_email',
|
|
@@ -113,12 +115,16 @@ class DigitalPianism_Abandonedcarts_Block_Adminhtml_Saleabandonedcarts_Grid exte
|
|
| 113 |
$this->addColumn('product_prices', array(
|
| 114 |
'header' => Mage::helper('abandonedcarts')->__('Cart Regular Total'),
|
| 115 |
'index' => 'product_prices',
|
|
|
|
|
|
|
| 116 |
'filter' => false
|
| 117 |
));
|
| 118 |
|
| 119 |
$this->addColumn('product_special_prices', array(
|
| 120 |
'header' => Mage::helper('abandonedcarts')->__('Cart Sale Total'),
|
| 121 |
'index' => 'product_special_prices',
|
|
|
|
|
|
|
| 122 |
'filter' => false
|
| 123 |
));
|
| 124 |
|
|
@@ -213,6 +219,20 @@ class DigitalPianism_Abandonedcarts_Block_Adminhtml_Saleabandonedcarts_Grid exte
|
|
| 213 |
{
|
| 214 |
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
|
| 215 |
$value = $column->getFilter()->getValue();
|
| 216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
}
|
| 218 |
}
|
| 53 |
array(
|
| 54 |
'product_ids' => 'GROUP_CONCAT(e.entity_id)',
|
| 55 |
'product_names' => 'GROUP_CONCAT(catalog_flat.name)',
|
| 56 |
+
'product_prices' => 'SUM(catalog_flat.price * quote_items.qty)',
|
| 57 |
+
'product_special_prices' => 'SUM(IFNULL(catalog_flat.special_price,quote_items.price) * quote_items.qty)',
|
| 58 |
)
|
| 59 |
);
|
| 60 |
|
| 61 |
+
$collection->getSelect()->having("SUM(quote_items.price) > SUM(IFNULL(catalog_flat.special_price,quote_items.price))");
|
| 62 |
} else {
|
| 63 |
$collection->getSelect()->columns(
|
| 64 |
array(
|
| 65 |
'product_ids' => 'GROUP_CONCAT(e.entity_id)',
|
| 66 |
'product_names' => 'GROUP_CONCAT(catalog_name.value)',
|
| 67 |
+
'product_prices' => 'SUM(catalog_price.value * quote_items.qty)',
|
| 68 |
+
'product_special_prices' => 'SUM(IFNULL(catalog_sprice.value,quote_items.price) * quote_items.qty)',
|
| 69 |
)
|
| 70 |
);
|
| 71 |
|
| 78 |
|
| 79 |
protected function _prepareColumns()
|
| 80 |
{
|
| 81 |
+
$currencyCode = $this->_getStore()->getCurrentCurrencyCode();
|
| 82 |
+
|
| 83 |
$this->addColumn('customer_email', array(
|
| 84 |
'header' => Mage::helper('abandonedcarts')->__('Customer Email'),
|
| 85 |
'index' => 'customer_email',
|
| 115 |
$this->addColumn('product_prices', array(
|
| 116 |
'header' => Mage::helper('abandonedcarts')->__('Cart Regular Total'),
|
| 117 |
'index' => 'product_prices',
|
| 118 |
+
'type' => 'price',
|
| 119 |
+
'currency_code' => $currencyCode,
|
| 120 |
'filter' => false
|
| 121 |
));
|
| 122 |
|
| 123 |
$this->addColumn('product_special_prices', array(
|
| 124 |
'header' => Mage::helper('abandonedcarts')->__('Cart Sale Total'),
|
| 125 |
'index' => 'product_special_prices',
|
| 126 |
+
'type' => 'price',
|
| 127 |
+
'currency_code' => $currencyCode,
|
| 128 |
'filter' => false
|
| 129 |
));
|
| 130 |
|
| 219 |
{
|
| 220 |
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
|
| 221 |
$value = $column->getFilter()->getValue();
|
| 222 |
+
|
| 223 |
+
$where = false;
|
| 224 |
+
|
| 225 |
+
if (is_array($value) && array_key_exists('from', $value)) {
|
| 226 |
+
$where = sprintf("%s > '%s'", $field, $value['from']->toString('Y-MM-dd HH:mm:ss'));
|
| 227 |
+
if (array_key_exists('to', $value)) {
|
| 228 |
+
$where .= sprintf(" AND %s < '%s'", $field, $value['to']->toString('Y-MM-dd HH:mm:ss'));
|
| 229 |
+
}
|
| 230 |
+
} elseif (is_array($value) && array_key_exists('to', $value)) {
|
| 231 |
+
$where = sprintf("%s < '%s'", $field, $value['to']->toString('Y-MM-dd HH:mm:ss'));
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
if ($where) {
|
| 235 |
+
$collection->getSelect()->where($where);
|
| 236 |
+
}
|
| 237 |
}
|
| 238 |
}
|
|
@@ -15,7 +15,7 @@ class DigitalPianism_Abandonedcarts_Model_Collection {
|
|
| 15 |
public function getCollection($delay, $storeId, $websiteId, $emails = array())
|
| 16 |
{
|
| 17 |
// Get the product collection
|
| 18 |
-
$collection = Mage::getResourceModel('
|
| 19 |
|
| 20 |
// Get the attribute id for the status attribute
|
| 21 |
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
|
@@ -135,7 +135,7 @@ class DigitalPianism_Abandonedcarts_Model_Collection {
|
|
| 135 |
public function getSalesCollection($storeId, $websiteId, $emails = array())
|
| 136 |
{
|
| 137 |
// Get the product collection
|
| 138 |
-
$collection = Mage::getResourceModel('
|
| 139 |
|
| 140 |
// Get the attribute id for the status attribute
|
| 141 |
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
| 15 |
public function getCollection($delay, $storeId, $websiteId, $emails = array())
|
| 16 |
{
|
| 17 |
// Get the product collection
|
| 18 |
+
$collection = Mage::getResourceModel('abandonedcarts/catalog_product_collection')->setStore($storeId);
|
| 19 |
|
| 20 |
// Get the attribute id for the status attribute
|
| 21 |
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
| 135 |
public function getSalesCollection($storeId, $websiteId, $emails = array())
|
| 136 |
{
|
| 137 |
// Get the product collection
|
| 138 |
+
$collection = Mage::getResourceModel('abandonedcarts/catalog_product_collection')->setStore($storeId);
|
| 139 |
|
| 140 |
// Get the attribute id for the status attribute
|
| 141 |
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
|
@@ -38,6 +38,11 @@ class DigitalPianism_Abandonedcarts_Model_Notifier extends Mage_Core_Model_Abstr
|
|
| 38 |
*/
|
| 39 |
protected $_currentStoreId;
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
/**
|
| 42 |
* @var
|
| 43 |
*/
|
|
@@ -273,6 +278,12 @@ class DigitalPianism_Abandonedcarts_Model_Notifier extends Mage_Core_Model_Abstr
|
|
| 273 |
|
| 274 |
// Store Id
|
| 275 |
Mage::app()->setCurrentStore($recipient['store_id']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
// Get the transactional email template
|
| 277 |
$templateId = Mage::getStoreConfig('abandonedcartsconfig/email/email_template_sale');
|
| 278 |
// Get the sender
|
|
@@ -360,6 +371,13 @@ class DigitalPianism_Abandonedcarts_Model_Notifier extends Mage_Core_Model_Abstr
|
|
| 360 |
|
| 361 |
// Store ID
|
| 362 |
Mage::app()->setCurrentStore($recipient['store_id']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
// Get the transactional email template
|
| 364 |
$templateId = Mage::getStoreConfig('abandonedcartsconfig/email/email_template');
|
| 365 |
// Get the sender
|
|
@@ -435,7 +453,7 @@ class DigitalPianism_Abandonedcarts_Model_Notifier extends Mage_Core_Model_Abstr
|
|
| 435 |
* @param boolean
|
| 436 |
* @param string
|
| 437 |
*/
|
| 438 |
-
public function sendAbandonedCartsSaleEmail($dryrun = false, $testemail = null, $emails = array())
|
| 439 |
{
|
| 440 |
if (Mage::helper('abandonedcarts')->getDryRun()) {
|
| 441 |
$dryrun = true;
|
|
@@ -449,6 +467,8 @@ class DigitalPianism_Abandonedcarts_Model_Notifier extends Mage_Core_Model_Abstr
|
|
| 449 |
$this->_customerGroups = $this->_customerGroups ? $this->_customerGroups : Mage::helper('abandonedcarts')->getCustomerGroupsLimitation();
|
| 450 |
// Original store id
|
| 451 |
$this->_originalStoreId = Mage::app()->getStore()->getId();
|
|
|
|
|
|
|
| 452 |
try
|
| 453 |
{
|
| 454 |
if (Mage::helper('abandonedcarts')->isSaleEnabled()) {
|
|
@@ -489,12 +509,14 @@ class DigitalPianism_Abandonedcarts_Model_Notifier extends Mage_Core_Model_Abstr
|
|
| 489 |
}
|
| 490 |
$this->_sendSaleEmails($dryrun, $testemail);
|
| 491 |
}
|
|
|
|
| 492 |
Mage::app()->setCurrentStore($this->_originalStoreId);
|
| 493 |
|
| 494 |
return count($this->_getSaleRecipients());
|
| 495 |
}
|
| 496 |
catch (Exception $e)
|
| 497 |
{
|
|
|
|
| 498 |
Mage::app()->setCurrentStore($this->_originalStoreId);
|
| 499 |
Mage::helper('abandonedcarts')->log(sprintf("%s->Error: %s", __METHOD__, $e->getMessage()));
|
| 500 |
return 0;
|
|
@@ -508,7 +530,7 @@ class DigitalPianism_Abandonedcarts_Model_Notifier extends Mage_Core_Model_Abstr
|
|
| 508 |
* @param string $testemail
|
| 509 |
* @internal param if $boolean dryrun is set to true, it won't send emails and won't alter quotes
|
| 510 |
*/
|
| 511 |
-
public function sendAbandonedCartsEmail($nodate = false, $dryrun = false, $testemail = null, $emails = array())
|
| 512 |
{
|
| 513 |
if (Mage::helper('abandonedcarts')->getDryRun()) {
|
| 514 |
$dryrun = true;
|
|
@@ -522,6 +544,8 @@ class DigitalPianism_Abandonedcarts_Model_Notifier extends Mage_Core_Model_Abstr
|
|
| 522 |
$this->_customerGroups = $this->_customerGroups ? $this->_customerGroups : Mage::helper('abandonedcarts')->getCustomerGroupsLimitation();
|
| 523 |
// Original store id
|
| 524 |
$this->_originalStoreId = Mage::app()->getStore()->getId();
|
|
|
|
|
|
|
| 525 |
try
|
| 526 |
{
|
| 527 |
if (Mage::helper('abandonedcarts')->isEnabled()) {
|
|
@@ -575,12 +599,14 @@ class DigitalPianism_Abandonedcarts_Model_Notifier extends Mage_Core_Model_Abstr
|
|
| 575 |
// Send the emails
|
| 576 |
$this->_sendEmails($dryrun, $testemail);
|
| 577 |
}
|
|
|
|
| 578 |
Mage::app()->setCurrentStore($this->_originalStoreId);
|
| 579 |
|
| 580 |
return count($this->_getRecipients());
|
| 581 |
}
|
| 582 |
catch (Exception $e)
|
| 583 |
{
|
|
|
|
| 584 |
Mage::app()->setCurrentStore($this->_originalStoreId);
|
| 585 |
Mage::helper('abandonedcarts')->log(sprintf("%s->Error: %s", __METHOD__, $e->getMessage()));
|
| 586 |
return 0;
|
| 38 |
*/
|
| 39 |
protected $_currentStoreId;
|
| 40 |
|
| 41 |
+
/**
|
| 42 |
+
* @var
|
| 43 |
+
*/
|
| 44 |
+
protected $_originalArea;
|
| 45 |
+
|
| 46 |
/**
|
| 47 |
* @var
|
| 48 |
*/
|
| 278 |
|
| 279 |
// Store Id
|
| 280 |
Mage::app()->setCurrentStore($recipient['store_id']);
|
| 281 |
+
// Area
|
| 282 |
+
if ($recipient['store_id'] === 0) {
|
| 283 |
+
Mage::getDesign()->setArea('adminhtml');
|
| 284 |
+
} else {
|
| 285 |
+
Mage::getDesign()->setArea('frontend');
|
| 286 |
+
}
|
| 287 |
// Get the transactional email template
|
| 288 |
$templateId = Mage::getStoreConfig('abandonedcartsconfig/email/email_template_sale');
|
| 289 |
// Get the sender
|
| 371 |
|
| 372 |
// Store ID
|
| 373 |
Mage::app()->setCurrentStore($recipient['store_id']);
|
| 374 |
+
// Area
|
| 375 |
+
if ($recipient['store_id'] === 0) {
|
| 376 |
+
Mage::getDesign()->setArea('adminhtml');
|
| 377 |
+
} else {
|
| 378 |
+
Mage::getDesign()->setArea('frontend');
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
// Get the transactional email template
|
| 382 |
$templateId = Mage::getStoreConfig('abandonedcartsconfig/email/email_template');
|
| 383 |
// Get the sender
|
| 453 |
* @param boolean
|
| 454 |
* @param string
|
| 455 |
*/
|
| 456 |
+
public function sendAbandonedCartsSaleEmail(Mage_Cron_Model_Schedule $schedule = null, $dryrun = false, $testemail = null, $emails = array())
|
| 457 |
{
|
| 458 |
if (Mage::helper('abandonedcarts')->getDryRun()) {
|
| 459 |
$dryrun = true;
|
| 467 |
$this->_customerGroups = $this->_customerGroups ? $this->_customerGroups : Mage::helper('abandonedcarts')->getCustomerGroupsLimitation();
|
| 468 |
// Original store id
|
| 469 |
$this->_originalStoreId = Mage::app()->getStore()->getId();
|
| 470 |
+
// Original area
|
| 471 |
+
$this->_originalArea = Mage::getDesign()->getArea();
|
| 472 |
try
|
| 473 |
{
|
| 474 |
if (Mage::helper('abandonedcarts')->isSaleEnabled()) {
|
| 509 |
}
|
| 510 |
$this->_sendSaleEmails($dryrun, $testemail);
|
| 511 |
}
|
| 512 |
+
Mage::getDesign()->setArea($this->_originalArea);
|
| 513 |
Mage::app()->setCurrentStore($this->_originalStoreId);
|
| 514 |
|
| 515 |
return count($this->_getSaleRecipients());
|
| 516 |
}
|
| 517 |
catch (Exception $e)
|
| 518 |
{
|
| 519 |
+
Mage::getDesign()->setArea($this->_originalArea);
|
| 520 |
Mage::app()->setCurrentStore($this->_originalStoreId);
|
| 521 |
Mage::helper('abandonedcarts')->log(sprintf("%s->Error: %s", __METHOD__, $e->getMessage()));
|
| 522 |
return 0;
|
| 530 |
* @param string $testemail
|
| 531 |
* @internal param if $boolean dryrun is set to true, it won't send emails and won't alter quotes
|
| 532 |
*/
|
| 533 |
+
public function sendAbandonedCartsEmail(Mage_Cron_Model_Schedule $schedule = null, $nodate = false, $dryrun = false, $testemail = null, $emails = array())
|
| 534 |
{
|
| 535 |
if (Mage::helper('abandonedcarts')->getDryRun()) {
|
| 536 |
$dryrun = true;
|
| 544 |
$this->_customerGroups = $this->_customerGroups ? $this->_customerGroups : Mage::helper('abandonedcarts')->getCustomerGroupsLimitation();
|
| 545 |
// Original store id
|
| 546 |
$this->_originalStoreId = Mage::app()->getStore()->getId();
|
| 547 |
+
// Original area
|
| 548 |
+
$this->_originalArea = Mage::getDesign()->getArea();
|
| 549 |
try
|
| 550 |
{
|
| 551 |
if (Mage::helper('abandonedcarts')->isEnabled()) {
|
| 599 |
// Send the emails
|
| 600 |
$this->_sendEmails($dryrun, $testemail);
|
| 601 |
}
|
| 602 |
+
Mage::getDesign()->setArea($this->_originalArea);
|
| 603 |
Mage::app()->setCurrentStore($this->_originalStoreId);
|
| 604 |
|
| 605 |
return count($this->_getRecipients());
|
| 606 |
}
|
| 607 |
catch (Exception $e)
|
| 608 |
{
|
| 609 |
+
Mage::getDesign()->setArea($this->_originalArea);
|
| 610 |
Mage::app()->setCurrentStore($this->_originalStoreId);
|
| 611 |
Mage::helper('abandonedcarts')->log(sprintf("%s->Error: %s", __METHOD__, $e->getMessage()));
|
| 612 |
return 0;
|
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Class DigitalPianism_Abandonedcarts_Model_Resource_Catalog_Product_Collection
|
| 5 |
+
*/
|
| 6 |
+
class DigitalPianism_Abandonedcarts_Model_Resource_Catalog_Product_Collection
|
| 7 |
+
extends Mage_Catalog_Model_Resource_Product_Collection {
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* @param null $select
|
| 11 |
+
* @param bool $resetLeftJoins
|
| 12 |
+
* @return Varien_Db_Select
|
| 13 |
+
* @throws Zend_Db_Select_Exception
|
| 14 |
+
*/
|
| 15 |
+
protected function _getSelectCountSql($select = null, $resetLeftJoins = true)
|
| 16 |
+
{
|
| 17 |
+
$this->_renderFilters();
|
| 18 |
+
$countSelect = (is_null($select)) ?
|
| 19 |
+
$this->_getClearSelect() :
|
| 20 |
+
$this->_buildClearSelect($select);
|
| 21 |
+
|
| 22 |
+
// Fix the count when group by
|
| 23 |
+
if(count($this->getSelect()->getPart(Zend_Db_Select::GROUP)) > 0) {
|
| 24 |
+
$countSelect->reset(Zend_Db_Select::GROUP);
|
| 25 |
+
$countSelect->distinct(true);
|
| 26 |
+
$group = $this->getSelect()->getPart(Zend_Db_Select::GROUP);
|
| 27 |
+
$countSelect->columns("COUNT(DISTINCT ".implode(", ", $group).")");
|
| 28 |
+
} else {
|
| 29 |
+
$countSelect->columns('COUNT(*)');
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if ($resetLeftJoins) {
|
| 33 |
+
$countSelect->resetJoinLeft();
|
| 34 |
+
}
|
| 35 |
+
return $countSelect;
|
| 36 |
+
}
|
| 37 |
+
}
|
|
@@ -96,7 +96,7 @@ class DigitalPianism_Abandonedcarts_Adminhtml_AbandonedcartsController extends M
|
|
| 96 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('abandonedcarts')->__('Please select email(s)'));
|
| 97 |
} else {
|
| 98 |
try {
|
| 99 |
-
Mage::getModel('abandonedcarts/notifier')->sendAbandonedCartsSaleEmail(false, false, $emails);
|
| 100 |
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 101 |
Mage::helper('abandonedcarts')->__(
|
| 102 |
'%sTotal of %d customer(s) were successfully notified', (Mage::helper('abandonedcarts')->getDryRun() ? "!DRY RUN! " : ""), count($emails)
|
|
@@ -119,7 +119,7 @@ class DigitalPianism_Abandonedcarts_Adminhtml_AbandonedcartsController extends M
|
|
| 119 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('abandonedcarts')->__('Please select email(s)'));
|
| 120 |
} else {
|
| 121 |
try {
|
| 122 |
-
Mage::getModel('abandonedcarts/notifier')->sendAbandonedCartsEmail(false, false, null, $emails);
|
| 123 |
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 124 |
Mage::helper('abandonedcarts')->__(
|
| 125 |
'%sTotal of %d customer(s) were successfully notified', (Mage::helper('abandonedcarts')->getDryRun() ? "!DRY RUN! " : ""), count($emails)
|
| 96 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('abandonedcarts')->__('Please select email(s)'));
|
| 97 |
} else {
|
| 98 |
try {
|
| 99 |
+
Mage::getModel('abandonedcarts/notifier')->sendAbandonedCartsSaleEmail(null, false, false, $emails);
|
| 100 |
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 101 |
Mage::helper('abandonedcarts')->__(
|
| 102 |
'%sTotal of %d customer(s) were successfully notified', (Mage::helper('abandonedcarts')->getDryRun() ? "!DRY RUN! " : ""), count($emails)
|
| 119 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('abandonedcarts')->__('Please select email(s)'));
|
| 120 |
} else {
|
| 121 |
try {
|
| 122 |
+
Mage::getModel('abandonedcarts/notifier')->sendAbandonedCartsEmail(null, false, false, null, $emails);
|
| 123 |
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 124 |
Mage::helper('abandonedcarts')->__(
|
| 125 |
'%sTotal of %d customer(s) were successfully notified', (Mage::helper('abandonedcarts')->getDryRun() ? "!DRY RUN! " : ""), count($emails)
|
|
@@ -4,7 +4,7 @@
|
|
| 4 |
|
| 5 |
<modules>
|
| 6 |
<DigitalPianism_Abandonedcarts>
|
| 7 |
-
<version>1.0.
|
| 8 |
</DigitalPianism_Abandonedcarts>
|
| 9 |
</modules>
|
| 10 |
|
| 4 |
|
| 5 |
<modules>
|
| 6 |
<DigitalPianism_Abandonedcarts>
|
| 7 |
+
<version>1.0.7</version>
|
| 8 |
</DigitalPianism_Abandonedcarts>
|
| 9 |
</modules>
|
| 10 |
|
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>DigitalPianism_Abandonedcarts</name>
|
| 4 |
-
<version>1.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,19 @@ 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
<authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
|
| 100 |
-
<date>2016-11-
|
| 101 |
-
<time>
|
| 102 |
-
<contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="Abandonedcarts"><dir name="Block"><dir name="Adminhtml"><dir name="Abandonedcarts"><file name="Grid.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>1.0.7</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>Thanks to Septoctobre for all the bug reports and pull requests
|
| 99 |
+

|
| 100 |
+
- Fix a bug where the delay would not be taken into consideration when the cron ran: https://github.com/digitalpianism/abandonedcarts/issues/17
|
| 101 |
+
- Fix a bug where the area would not be properly loaded: https://github.com/digitalpianism/abandonedcarts/issues/8 and https://github.com/digitalpianism/abandonedcarts/issues/7
|
| 102 |
+
- Fix a bug where the count of total would be wrong because of the quantity : https://github.com/digitalpianism/abandonedcarts/issues/13
|
| 103 |
+
- Implement prices columns with currencies : https://github.com/digitalpianism/abandonedcarts/issues/13
|
| 104 |
+
- Fix a bug where the sale abandoned carts report would display nothing when flat catalog is enabled : https://github.com/digitalpianism/abandonedcarts/issues/15
|
| 105 |
+
- Fix a bug where an error would be triggered when filtering the grid by one date (from OR to) : https://github.com/digitalpianism/abandonedcarts/issues/9
|
| 106 |
+
- Fix a bug where the count in the grid would be wrong: https://github.com/digitalpianism/abandonedcarts/issues/11</notes>
|
| 107 |
<authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
|
| 108 |
+
<date>2016-11-15</date>
|
| 109 |
+
<time>16:40:41</time>
|
| 110 |
+
<contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="Abandonedcarts"><dir name="Block"><dir name="Adminhtml"><dir name="Abandonedcarts"><file name="Grid.php" hash="4cf347fffef45d52df3ae347c12a8ef9"/></dir><file name="Abandonedcarts.php" hash="5ed2323b6a2ffd66d0738f8635c660e3"/><dir name="Logs"><file name="Grid.php" hash="05c4ca332a6ad168e28e9a9128252231"/></dir><file name="Logs.php" hash="1173ec175c365fa5c01cbc72a98c0284"/><dir name="Saleabandonedcarts"><file name="Grid.php" hash="c8b9f1e3133ace386b6789a05c1009b7"/></dir><file name="Saleabandonedcarts.php" hash="b1195b3697ccc733c61a03cb7d9032b1"/></dir></dir><dir name="Helper"><file name="Data.php" hash="f7d07930e3276bb06e6209293f287dc3"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Observer.php" hash="d54b2bc70a87fca4f0c3bbb519b84c81"/></dir><file name="Collection.php" hash="0068f4b5fc85c96b9df915f2a3689418"/><dir name="Link"><file name="Cleaner.php" hash="aced9e659252056b0f4747a78c6154c8"/></dir><file name="Link.php" hash="6f19c7976980e558d98589021d4d294f"/><file name="Log.php" hash="c9ce940c6a14cfa85c401183559661e4"/><file name="Notifier.php" hash="5c3f67887037a8d35913c779288d336b"/><dir name="Resource"><dir name="Catalog"><dir name="Product"><file name="Collection.php" hash="a92d4c7cbf1dd7b5ce09384f9addd500"/></dir></dir><dir name="Link"><file name="Collection.php" hash="39ea2cfb265412d82b9fda822af6d324"/></dir><file name="Link.php" hash="49d00b249de30aefc978f4515f6dbdd7"/><dir name="Log"><file name="Collection.php" hash="54abd79af31a1a853bc08eeed75dc7d0"/></dir><file name="Log.php" hash="00edba4d934093236ac78b42f066ba73"/></dir><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="5a15bcda2250a1faf5040ed88927c8ff"/></dir><file name="IndexController.php" hash="5c06db338a20d3de9b19c3f606edbc9a"/></dir><dir name="data"><dir name="abandonedcarts_setup"><file name="data-upgrade-0.3.6-1.0.0.php" hash="a60f9bccf9e42a458f808bc697320bb0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ce393eb00049f28ff92401be828cd613"/><file name="config.xml" hash="23f2d48fe85d2e73e39b5a36918e5903"/><file name="system.xml" hash="e6a53269f6223eb246c2495600eb307d"/></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"/><file name="upgrade-0.3.6-1.0.0.php" hash="1ac772ef331c8a2278e2c8df77aeb799"/></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"><file name="list.phtml" hash="6af16de73f1b0a3c580e65a95642722f"/></dir></dir></dir><dir name="layout"><dir name="digitalpianism"><file name="abandonedcarts.xml" hash="2f4ec5178aed1c84213605b5212d676e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="digitalpianism"><dir name="abandonedcarts"><dir name="email"><file name="items.phtml" hash="e1d1990b47b16309e3ea6c09043e15e2"/><file name="sale_items.phtml" hash="47e2298fdedd253a9d9c5e3d1c1c17b7"/></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="a35bd61e1f172b37ac4ed317e1ad44e9"/><file name="sales_abandonedcarts_sale.html" hash="4f437deca852efeacfec0fb3ba929971"/></dir></dir></dir></dir><file name="DigitalPianism_Abandonedcarts.csv" hash="bd3ed00291684eac5149305ed829a824"/></dir><dir name="fr_FR"><dir name="template"><dir name="email"><dir name="digitalpianism"><dir name="abandonedcarts"><file name="sales_abandonedcarts.html" hash="3ec93757d563ed926090a394577f1dbd"/><file name="sales_abandonedcarts_sale.html" hash="3586968516c8e8374cfa913a3eea7995"/></dir></dir></dir></dir><file name="DigitalPianism_Abandonedcarts.csv" hash="2a9c63b4d83cb922b3060a4735dabe38"/></dir></target></contents>
|
| 111 |
<compatible/>
|
| 112 |
<dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 113 |
</package>
|
