Skip to content

Commit

Permalink
closes #895 for magento 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Oct 11, 2019
1 parent 2f54666 commit 60e1f14
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Block/Mailchimpjs.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Ebizmarts\MailChimp\Block;

use Magento\Store\Model\ScopeInterface;

class Mailchimpjs extends \Magento\Framework\View\Element\Template
{
/**
Expand Down Expand Up @@ -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;
}
}
5 changes: 5 additions & 0 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Ebizmarts\MailChimp\Block\Mailchimpjs">
<arguments>
<argument name="helper" xsi:type="object">Ebizmarts\MailChimp\Helper\Data\Proxy</argument>
</arguments>
</type>
<type name="Magento\Quote\Model\Quote">
<plugin name="mailchimp-save-quote" type="Ebizmarts\MailChimp\Model\Plugin\Quote" sortOrder="10"/>
</type>
Expand Down

0 comments on commit 60e1f14

Please sign in to comment.