mc-magento
mc-magento copied to clipboard
Incorrect DATETIME value
Preconditions
- Magento 1.9.4.5
- Ebizmarts_MailChimp 1.1.22
- PHP 7.3
- MySQL 8
Steps to reproduce
- Not sure, just looked into the log.
Expected result
- No errors in
MailChimp_Errors.log
.
Actual result
-
The following error is logged:
2021-11-25T12:47:36+00:00 DEBUG (7): SQLSTATE[HY000]: General error: 1525 Incorrect DATETIME value: '', query was: SELECT `main_table`.* FROM `newsletter_subscriber` AS `main_table` WHERE (`subscriber_status` = 1) AND (main_table.store_id = 0) AND ((`mailchimp_sync_delta` IS NULL) OR (`mailchimp_sync_delta` = '') OR (`mailchimp_sync_delta` \< '2019-09-06 07:39:53') OR (`mailchimp_sync_modified` = 1)) AND (`mailchimp_sync_error` = '') LIMIT 200
Quick fix:
app\code\community\Ebizmarts\MailChimp\Model\Api\Subscribers.php
$collection = Mage::getResourceModel('newsletter/subscriber_collection')
->addFieldToFilter('subscriber_status', array('eq' => 1))
->addFieldToFilter('store_id', array('eq' => $this->getStoreId()))
->addFieldToFilter(
array(
'mailchimp_sync_delta',
//'mailchimp_sync_delta',
'mailchimp_sync_delta',
'mailchimp_sync_modified'
),
array(
array('null' => true),
//array('eq' => ''),
array('lt' => $helper->getSubMinSyncDateFlag($this->getStoreId())),
array('eq' => 1)
)
);