diff --git a/Observer/Adminhtml/Product/ImportAfter.php b/Observer/Adminhtml/Product/ImportAfter.php new file mode 100644 index 00000000..7a365128 --- /dev/null +++ b/Observer/Adminhtml/Product/ImportAfter.php @@ -0,0 +1,63 @@ +helper = $helper; + $this->productRepository = $productRepository; + } + public function execute(Observer $observer) + { + try { + $bunch = $observer->getBunch(); + foreach ($bunch as $product) { + $sku = $product['sku']; + $storeId = $product['_store']; + $pro = $this->productRepository->get($sku, false,$storeId); + $id = $pro->getId(); + $storeId = $pro->getStoreId(); + $this->_updateProduct($pro->getStoreId(), $pro->getId(), null,null,1); + } + } catch (\Exception $e) { + echo $e->getMessage(); + } + } + protected function _updateProduct( + $storeId, + $entityId, + $sync_delta = null, + $sync_error = null, + $sync_modified = null + ) { + $mailchimpStoreId = $this->helper->getConfigValue( + \Ebizmarts\MailChimp\Helper\Data::XML_MAILCHIMP_STORE, + $storeId + ); + $this->helper->saveEcommerceData( + $mailchimpStoreId, + $entityId, + \Ebizmarts\MailChimp\Helper\Data::IS_PRODUCT, + $sync_delta, + $sync_error, + $sync_modified + ); + } +} \ No newline at end of file diff --git a/etc/events.xml b/etc/events.xml index 33e9fd58..0e7e46b1 100644 --- a/etc/events.xml +++ b/etc/events.xml @@ -26,4 +26,7 @@ + + +