Skip to content

Commit

Permalink
Merge pull request #1955 from mailchimp/Issue1951-2.3.6-p1
Browse files Browse the repository at this point in the history
closes #1951 for magento 2.3.6-p1
  • Loading branch information
gonzaloebiz authored Apr 8, 2024
2 parents 334065d + 81b24f5 commit e99e16b
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
Expand Up @@ -84,7 +84,6 @@ class Order
protected $_counter;

protected $_batchId;
protected $modifiedOrder = false;

/**
* @param \Ebizmarts\MailChimp\Helper\Data $helper
Expand Down Expand Up @@ -205,10 +204,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);
Expand Down Expand Up @@ -291,10 +286,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);
Expand Down Expand Up @@ -346,11 +337,10 @@ protected function generatePOSTPayload(
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;
}
}

Expand Down

0 comments on commit e99e16b

Please sign in to comment.