Skip to content

Commit

Permalink
Merge pull request #1952 from mailchimp/Issue1951-2.1
Browse files Browse the repository at this point in the history
closes #1951 for magento 2.1
gonzaloebiz authored Apr 8, 2024
2 parents 9a2cde5 + 8cc47fb commit 95c2ece
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions Model/Api/Order.php
Original file line number Diff line number Diff line change
@@ -86,7 +86,6 @@ class Order
protected $_counter;

protected $_batchId;
protected $modifiedOrder = false;

/**
* @param \Ebizmarts\MailChimp\Helper\Data $helper
@@ -202,10 +201,6 @@ protected function _getModifiedOrders($magentoStoreId)
}

$orderJson = $this->GeneratePOSTPayload($order, $mailchimpStoreId, $magentoStoreId, true, $isSynced);
if ($this->modifiedOrder) {
$order->save();
$this->modifiedOrder = false;
}
if ($orderJson!==false) {
if (!empty($orderJson)) {
$this->_helper->modifyCounter(\Ebizmarts\MailChimp\Helper\Data::ORD_MOD);
@@ -284,10 +279,6 @@ protected function _getNewOrders($magentoStoreId)
}
}
$orderJson = $this->GeneratePOSTPayload($order, $mailchimpStoreId, $magentoStoreId, false, $isSynced);
if ($this->modifiedOrder) {
$order->save();
$this->modifiedOrder = false;
}
if ($orderJson!==false) {
if (!empty($orderJson)) {
$this->_helper->modifyCounter(\Ebizmarts\MailChimp\Helper\Data::ORD_NEW);
@@ -334,11 +325,10 @@ protected function GeneratePOSTPayload(\Magento\Sales\Model\Order $order, $mailc
if ($order->getMailchimpCampaignId()) {
$data['campaign_id'] = $order->getMailchimpCampaignId();
} elseif ($isSynced) {
if ($campaignId = $this->getCampaign($magentoStoreId, $order->getCustomerEmail())) {
if (!$isModifiedOrder && $campaignId = $this->getCampaign($magentoStoreId, $order->getCustomerEmail())) {
$data['campaign_id'] = $campaignId;
$order->setMailchimpCampaignId($campaignId);
$order->setMailchimpFlag(1);
$this->modifiedOrder = true;
}
}

0 comments on commit 95c2ece

Please sign in to comment.