@@ -66,7 +66,7 @@ public function beforeUnsubscribeCustomerById(
6666 \Magento \Newsletter \Model \Subscriber $ subscriber ,
6767 $ customerId
6868 ) {
69- $ storeId = $ this ->getStoreIdFromSubscriber ( $ subscriber );
69+ $ storeId = $ this ->_storeManager -> getStore ()-> getId ( );
7070 if ($ this ->_helper ->isMailChimpEnabled ($ storeId )) {
7171 if (!$ this ->_helper ->getConfigValue (\Ebizmarts \MailChimp \Helper \Data::XML_MAGENTO_MAIL , $ storeId )) {
7272 $ subscriber ->setImportMode (true );
@@ -101,8 +101,7 @@ public function beforeSubscribeCustomerById(
101101 \Magento \Newsletter \Model \Subscriber $ subscriber ,
102102 $ customerId
103103 ) {
104-
105- $ storeId = $ this ->getStoreIdFromSubscriber ($ subscriber );
104+ $ storeId = $ this ->_storeManager ->getStore ()->getId ();
106105 if ($ this ->_helper ->isMailChimpEnabled ($ storeId )) {
107106 $ subscriber ->loadByCustomerId ($ customerId );
108107 if (!$ subscriber ->isSubscribed ()) {
@@ -154,7 +153,6 @@ public function beforeSubscribe(
154153 \Magento \Newsletter \Model \Subscriber $ subscriber ,
155154 $ email
156155 ) {
157- //$websiteId = $this->getStoreIdFromSubscriber($subscriber);
158156 $ storeId = $ this ->_storeManager ->getStore ()->getId ();
159157 if ($ this ->_helper ->isMailChimpEnabled ($ storeId )) {
160158 if (!$ this ->_helper ->getConfigValue (\Ebizmarts \MailChimp \Helper \Data::XML_MAGENTO_MAIL , $ storeId )) {
@@ -203,7 +201,7 @@ public function beforeSubscribe(
203201 public function beforeUnsubscribe (
204202 \Magento \Newsletter \Model \Subscriber $ subscriber
205203 ) {
206- $ storeId = $ this ->getStoreIdFromSubscriber ( $ subscriber );
204+ $ storeId = $ this ->_storeManager -> getStore ()-> getId ( );
207205 if ($ this ->_helper ->isMailChimpEnabled ($ storeId )) {
208206 if (!$ this ->_helper ->getConfigValue (\Ebizmarts \MailChimp \Helper \Data::XML_MAGENTO_MAIL , $ storeId )) {
209207 $ subscriber ->setImportMode (true );
@@ -230,8 +228,7 @@ public function beforeUnsubscribe(
230228 public function afterDelete (
231229 \Magento \Newsletter \Model \Subscriber $ subscriber
232230 ) {
233-
234- $ storeId = $ this ->getStoreIdFromSubscriber ($ subscriber );
231+ $ storeId = $ this ->_storeManager ->getStore ()->getId ();
235232 if ($ this ->_helper ->isMailChimpEnabled ($ storeId )) {
236233 $ api = $ this ->_helper ->getApi ($ storeId );
237234 if ($ subscriber ->isSubscribed ()) {
@@ -254,13 +251,4 @@ public function afterDelete(
254251 }
255252 return null ;
256253 }
257-
258- /**
259- * @param \Magento\Newsletter\Model\Subscriber $subscriber
260- * @return int
261- */
262- protected function getStoreIdFromSubscriber (\Magento \Newsletter \Model \Subscriber $ subscriber )
263- {
264- return $ subscriber ->getStoreId ();
265- }
266254}
0 commit comments