Skip to content

Commit

Permalink
Merge pull request #1964 from mailchimp/Issue1962-2.3
Browse files Browse the repository at this point in the history
closes #1962 for magento 2.3
  • Loading branch information
gonzaloebiz authored May 7, 2024
2 parents 2503791 + 1e635b5 commit bad361b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
16 changes: 6 additions & 10 deletions Helper/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion Model/Api/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ private function _updateSyncData($mailchimpStoreId, $listId, $type, $id, $error,
null,
null,
null,
$status
$status,
true
);
}
}

0 comments on commit bad361b

Please sign in to comment.