diff --git a/Controller/Cart/Loadquote.php b/Controller/Cart/Loadquote.php index 074dda27..2b4d0dd4 100644 --- a/Controller/Cart/Loadquote.php +++ b/Controller/Cart/Loadquote.php @@ -123,6 +123,7 @@ public function execute() ), ['mc_cid'=> $params['mc_cid']] ); + $quote->setData('mailchimp_campaign_id', $params['mc_cid']); } else { $url = $this->_urlHelper->getUrl( $this->_helper->getConfigValue( diff --git a/Model/Api/Cart.php b/Model/Api/Cart.php index e922be35..6763ec99 100644 --- a/Model/Api/Cart.php +++ b/Model/Api/Cart.php @@ -201,8 +201,10 @@ protected function _getModifiedQuotes($mailchimpStoreId, $magentoStoreId) ['m4m.*'] ); // be sure that the quotes are already in mailchimp and not deleted - $modifiedCarts->getSelect()->where("(m4m.mailchimp_sync_deleted is null or m4m.mailchimp_sync_deleted = 0)". - " AND m4m.mailchimp_sync_delta < main_table.updated_at"); + $modifiedCarts->getSelect()->where( + "(m4m.mailchimp_sync_deleted is null or m4m.mailchimp_sync_deleted = 0)". + " AND m4m.mailchimp_sync_modified = 1" + ); // limit the collection $modifiedCarts->getSelect()->limit(self::BATCH_LIMIT); diff --git a/Model/Plugin/Quote.php b/Model/Plugin/Quote.php index 4582e4fb..27b4c3cb 100644 --- a/Model/Plugin/Quote.php +++ b/Model/Plugin/Quote.php @@ -47,5 +47,19 @@ public function beforeBeforeSave(\Magento\Quote\Model\Quote $quote) if ($mailchimp_landing_page) { $quote->setData('mailchimp_landing_page', $mailchimp_landing_page); } + $mailchimpStoreId = $this->_helper->getConfigValue( + \Ebizmarts\MailChimp\Helper\Data::XML_MAILCHIMP_STORE, + $quote->getStoreId() + ); + $this->_helper->saveEcommerceData( + $mailchimpStoreId, + $quote->getId(), + \Ebizmarts\MailChimp\Helper\Data::IS_QUOTE, + null, + 0, + 1, + 0, + null + ); } }