From 7faca4f8982133d80a6917e1e64ec3878eb8a18b Mon Sep 17 00:00:00 2001 From: gonzalo Date: Tue, 19 Jul 2022 14:34:08 -0300 Subject: [PATCH 1/2] new version 102.3.46 for magento 2.3 --- CHANGELOG.md | 19 ++ Ui/Component/Listing/Column/Products.php | 174 ++++++++++++++++++ composer.json | 2 +- etc/module.xml | 2 +- .../ui_component/product_listing.xml | 15 ++ 5 files changed, 210 insertions(+), 2 deletions(-) create mode 100644 Ui/Component/Listing/Column/Products.php create mode 100644 view/adminhtml/ui_component/product_listing.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 37e8d725..1f6e743e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Change Log +## [102.3.46](https://github.com/mailchimp/mc-magento2/tree/102.3.46) (2022-07-19) + +[Full Changelog](https://github.com/mailchimp/mc-magento2/compare/102.3.45...102.3.46) + +**Implemented enhancements:** + +- Rewrite "This MailChimp account is not connected to Magento" label to make it more clear [\#1448](https://github.com/mailchimp/mc-magento2/issues/1448) +- Add a synchorization column in the customer grid [\#1439](https://github.com/mailchimp/mc-magento2/issues/1439) +- Add a synchorization column in the product grid [\#1438](https://github.com/mailchimp/mc-magento2/issues/1438) +- Add button on backend to create the abandoned cart automation [\#1432](https://github.com/mailchimp/mc-magento2/issues/1432) + +**Fixed bugs:** + +- Missing fields in Cart.php on db call [\#1460](https://github.com/mailchimp/mc-magento2/issues/1460) +- Wrong field map value when is null [\#1425](https://github.com/mailchimp/mc-magento2/issues/1425) +- Can't get the response file from a batch [\#1414](https://github.com/mailchimp/mc-magento2/issues/1414) +- Unmark the modified flag in the ecommerce table when an object is synced [\#1408](https://github.com/mailchimp/mc-magento2/issues/1408) +- Don't use Zend\_Db\_Select::COLUMNS [\#1405](https://github.com/mailchimp/mc-magento2/issues/1405) + ## [102.3.45](https://github.com/mailchimp/mc-magento2/tree/102.3.45) [Full Changelog](https://github.com/mailchimp/mc-magento2/compare/102.3.44...102.3.45) diff --git a/Ui/Component/Listing/Column/Products.php b/Ui/Component/Listing/Column/Products.php new file mode 100644 index 00000000..197dc885 --- /dev/null +++ b/Ui/Component/Listing/Column/Products.php @@ -0,0 +1,174 @@ +_productFactory = $productFactory; + $this->_requestInterface = $requestInterface; + $this->_helper = $helper; + $this->_assetRepository = $assetRepository; + $this->_mailChimpErrorsFactory = $mailChimpErrorsFactory; + parent::__construct($context, $uiComponentFactory, $components, $data); + } + + public function prepareDataSource(array $dataSource) + { + if (isset($dataSource['data']['items'])) { + foreach ($dataSource['data']['items'] as & $item) { + /** + * @var $product \Magento\Catalog\Model\Product + */ + $product = $this->_productFactory->create()->load($item['entity_id']); + $params = ['_secure' => $this->_requestInterface->isSecure()]; + $alt = ''; + if ($product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE || + $product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL || + $product->getTypeId() == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE || + $product->getTypeId() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) { + $url = ''; + $text = ''; + if ($this->_helper->getConfigValue(\Ebizmarts\MailChimp\Helper\Data::XML_PATH_ACTIVE, $product->getStoreId())) { + $mailchimpStoreId = $this->_helper->getConfigValue( + \Ebizmarts\MailChimp\Helper\Data::XML_MAILCHIMP_STORE, + $product->getStoreId() + ); + $syncData = $this->_helper->getChimpSyncEcommerce( + $mailchimpStoreId, + $product->getId(), + \Ebizmarts\MailChimp\Helper\Data::IS_PRODUCT + ); + if (!$syncData || $syncData->getMailchimpStoreId() != $mailchimpStoreId || + $syncData->getRelatedId() != $product->getId() || + $syncData->getType() != \Ebizmarts\MailChimp\Helper\Data::IS_PRODUCT) { + $url = $this->_assetRepository->getUrlWithParams( + 'Ebizmarts_MailChimp::images/no.png', + $params + ); + $text = __('Syncing'); + } else { + $sync = $syncData->getMailchimpSent(); + switch ($sync) { + case \Ebizmarts\MailChimp\Helper\Data::SYNCED: + $url = $this->_assetRepository->getUrlWithParams( + 'Ebizmarts_MailChimp::images/yes.png', + $params + ); + $text = __('Synced'); + $alt = $syncData->getMailchimpSyncDelta(); + break; + case \Ebizmarts\MailChimp\Helper\Data::WAITINGSYNC: + $url = $this->_assetRepository->getUrlWithParams( + 'Ebizmarts_MailChimp::images/waiting.png', + $params + ); + $text = __('Waiting'); + $alt = $syncData->getMailchimpSyncDelta(); + break; + case \Ebizmarts\MailChimp\Helper\Data::SYNCERROR: + $url = $this->_assetRepository->getUrlWithParams( + 'Ebizmarts_MailChimp::images/error.png', + $params + ); + $text = __('Error'); + $orderError = $this->_getError($product->getId(), $product->getStoreId()); + if ($orderError) { + $alt = $orderError->getErrors(); + } + break; + case \Ebizmarts\MailChimp\Helper\Data::NEEDTORESYNC: + $url = $this->_assetRepository->getUrlWithParams( + 'Ebizmarts_MailChimp::images/resync.png', + $params + ); + $text = __('Resyncing'); + $alt = $syncData->getMailchimpSyncDelta(); + break; + case \Ebizmarts\MailChimp\Helper\Data::NOTSYNCED: + $url = $this->_assetRepository->getUrlWithParams( + 'Ebizmarts_MailChimp::images/never.png', + $params + ); + $text = __('With error'); + $alt = $syncData->getMailchimpSyncError(); + break; + default: + $url = $this->_assetRepository->getUrlWithParams( + 'Ebizmarts_MailChimp::images/error.png', + $params + ); + $text = __('Error'); + } + } + } + } else { + $url = $this->_assetRepository->getUrlWithParams( + 'Ebizmarts_MailChimp::images/never.png', + $params + ); + $text = __('Unsupported'); + $alt = "Mailchimp does not support bundled or grouped products."; + } + $item['mailchimp_sync'] = + "
$text
"; + } + } + return $dataSource; + } + private function _getError($productId, $storeId) + { + /** + * @var $error \Ebizmarts\MailChimp\Model\MailChimpErrors + */ + $error = $this->_mailChimpErrorsFactory->create(); + return $error->getByStoreIdType($storeId, $productId, \Ebizmarts\MailChimp\Helper\Data::IS_PRODUCT); + } +} \ No newline at end of file diff --git a/composer.json b/composer.json index 45cf855d..e3396526 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ }, "description": "Connect MailChimp with Magento", "type": "magento2-module", - "version": "102.3.45", + "version": "102.3.46", "authors": [ { "name": "Ebizmarts Corp", diff --git a/etc/module.xml b/etc/module.xml index 8ff99063..536af554 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -11,7 +11,7 @@ */ --> - + diff --git a/view/adminhtml/ui_component/product_listing.xml b/view/adminhtml/ui_component/product_listing.xml new file mode 100644 index 00000000..38a8cc19 --- /dev/null +++ b/view/adminhtml/ui_component/product_listing.xml @@ -0,0 +1,15 @@ + ++ + + + mailchimp_sync + 0 + true + + ui/grid/cells/html + false + + + + \ No newline at end of file From 0a4937539f1f39586a8022febf08a974eb5dea54 Mon Sep 17 00:00:00 2001 From: gonzalo Date: Tue, 19 Jul 2022 14:45:14 -0300 Subject: [PATCH 2/2] new version 102.3.46 for magento 2.3 --- Ui/Component/Listing/Column/Customers.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Ui/Component/Listing/Column/Customers.php b/Ui/Component/Listing/Column/Customers.php index dc448e96..572c172c 100644 --- a/Ui/Component/Listing/Column/Customers.php +++ b/Ui/Component/Listing/Column/Customers.php @@ -72,6 +72,8 @@ public function prepareDataSource(array $dataSource) $customer = $this->_customerFactory->create()->load($item['entity_id']); $params = ['_secure' => $this->_requestInterface->isSecure()]; $alt = ''; + $url = ''; + $text = ''; if ($this->_helper->getConfigValue(\Ebizmarts\MailChimp\Helper\Data::XML_PATH_ACTIVE, $customer->getStoreId())) { $mailchimpStoreId = $this->_helper->getConfigValue( \Ebizmarts\MailChimp\Helper\Data::XML_MAILCHIMP_STORE,