diff --git a/Block/Mailchimpjs.php b/Block/Mailchimpjs.php index b58634cd..cc1c321c 100644 --- a/Block/Mailchimpjs.php +++ b/Block/Mailchimpjs.php @@ -13,6 +13,8 @@ namespace Ebizmarts\MailChimp\Block; +use Magento\Store\Model\ScopeInterface; + class Mailchimpjs extends \Magento\Framework\View\Element\Template { /** @@ -44,6 +46,19 @@ public function __construct( public function getJsUrl() { $storeId = $this->_storeManager->getStore()->getId(); - return $this->_helper->getJsUrl($storeId); + + $url = $this->_scopeConfig->getValue( + \Ebizmarts\MailChimp\Helper\Data::XML_MAILCHIMP_JS_URL, ScopeInterface::SCOPE_STORES, + $storeId + ); + $active = $this->_scopeConfig->getValue( + \Ebizmarts\MailChimp\Helper\Data::XML_PATH_ACTIVE, ScopeInterface::SCOPE_STORES, + $storeId + ); + if ($active && !$url) { + $url = $this->_helper->getJsUrl($storeId); + } + + return $url; } } diff --git a/etc/di.xml b/etc/di.xml index ecdb6bb9..11aa1f7b 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -11,6 +11,11 @@ */ --> + + + Ebizmarts\MailChimp\Helper\Data\Proxy + +