From 1e635b51290a989b2086da3654ee952b328162a5 Mon Sep 17 00:00:00 2001 From: gonzalo Date: Mon, 6 May 2024 15:35:40 -0300 Subject: [PATCH] closes #1962 for magento 2.3 --- Helper/Sync.php | 16 ++++++---------- Model/Api/Result.php | 3 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Helper/Sync.php b/Helper/Sync.php index 5074c59f..7fbd1ca6 100644 --- a/Helper/Sync.php +++ b/Helper/Sync.php @@ -5,7 +5,6 @@ use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Helper\Context; use Magento\Framework\Exception\ValidatorException; -use Magento\Sales\Model\ResourceModel\Order\CollectionFactory as OrderCollectionFactory; use Ebizmarts\MailChimp\Model\MailChimpSyncEcommerceFactory; use Ebizmarts\MailChimp\Model\MailChimpSyncEcommerce; use Ebizmarts\MailChimp\Model\MailChimpErrors; @@ -24,29 +23,22 @@ class Sync extends AbstractHelper * @var MailChimpSyncEcommerce */ private $chimpSyncEcommerce; - /** - * @var OrderCollectionFactory - */ - private $orderCollectionFactory; /** * @param Context $context * @param MailChimpSyncEcommerceFactory $chimpSyncEcommerceFactory * @param MailChimpErrors $mailChimpErrors * @param MailChimpSyncEcommerce $chimpSyncEcommerce - * @param OrderCollectionFactory $orderCollectionFactory */ public function __construct( Context $context, MailChimpSyncEcommerceFactory $chimpSyncEcommerceFactory, MailChimpErrors $mailChimpErrors, - MailChimpSyncEcommerce $chimpSyncEcommerce, - OrderCollectionFactory $orderCollectionFactory + MailChimpSyncEcommerce $chimpSyncEcommerce ) { $this->chimpSyncEcommerceFactory = $chimpSyncEcommerceFactory; $this->mailChimpErrors = $mailChimpErrors; $this->chimpSyncEcommerce = $chimpSyncEcommerce; - $this->orderCollectionFactory = $orderCollectionFactory; parent::__construct($context); } public function saveEcommerceData( @@ -58,12 +50,16 @@ public function saveEcommerceData( $modified = null, $deleted = null, $token = null, - $sent = null + $sent = null, + $isResult = false ) { if (!empty($entityId)) { $chimpSyncEcommerce = $this->getChimpSyncEcommerce($storeId, $entityId, $type); if ($chimpSyncEcommerce->getRelatedId() == $entityId || !$chimpSyncEcommerce->getRelatedId() && $modified != 1) { + if ($isResult && $chimpSyncEcommerce->getMailchimpSyncModified()) { + return; + } $chimpSyncEcommerce->setMailchimpStoreId($storeId); $chimpSyncEcommerce->setType($type); $chimpSyncEcommerce->setRelatedId($entityId); diff --git a/Model/Api/Result.php b/Model/Api/Result.php index 49a298d4..ba057fba 100644 --- a/Model/Api/Result.php +++ b/Model/Api/Result.php @@ -299,7 +299,8 @@ private function _updateSyncData($mailchimpStoreId, $listId, $type, $id, $error, null, null, null, - $status + $status, + true ); } }