Skip to content

Commit

Permalink
Merge pull request #1069 from mailchimp/Issue1065-2.2
Browse files Browse the repository at this point in the history
closes #1065 for magento 2.2
  • Loading branch information
gonzaloebiz authored Oct 12, 2020
2 parents 4002f62 + 53bcd0f commit c38747f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions Controller/Cart/Loadquote.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions Model/Api/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
14 changes: 14 additions & 0 deletions Model/Plugin/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}

0 comments on commit c38747f

Please sign in to comment.