diff --git a/Block/Checkout/Success.php b/Block/Checkout/Success.php index 2214aa8c..8402a956 100644 --- a/Block/Checkout/Success.php +++ b/Block/Checkout/Success.php @@ -30,6 +30,10 @@ class Success extends \Magento\Framework\View\Element\Template * @var \Ebizmarts\MailChimp\Model\MailChimpInterestGroupFactory */ protected $_interestGroupFactory; + /** + * @var \Magento\Framework\View\Element\Template\Context + */ + protected $_context; /** * Success constructor. @@ -54,6 +58,7 @@ public function __construct( $this->_helper = $helper; $this->_subscriberFactory = $subscriberFactory; $this->_interestGroupFactory= $interestGroupFactory; + $this->_context = $context; } public function getInterest() @@ -88,4 +93,11 @@ public function getFormUrl() $order = $this->_checkoutSession->getLastRealOrder(); return $this->_helper->getSuccessInterestUrl($order->getStoreId()); } + public function _toHtml() + { + if (!$this->_helper->isMailChimpEnabled($this->_context->getStoreManager()->getStore()->getId())) { + return ""; + } + return parent::_toHtml(); + } } diff --git a/view/frontend/layout/default.xml b/view/frontend/layout/default.xml index 87a12d62..46070a26 100644 --- a/view/frontend/layout/default.xml +++ b/view/frontend/layout/default.xml @@ -14,7 +14,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> - + diff --git a/view/frontend/layout/mailchimp_cart_loadquote.xml b/view/frontend/layout/mailchimp_cart_loadquote.xml index c09d00c1..df5ff437 100644 --- a/view/frontend/layout/mailchimp_cart_loadquote.xml +++ b/view/frontend/layout/mailchimp_cart_loadquote.xml @@ -10,7 +10,7 @@ - + \ No newline at end of file diff --git a/view/frontend/layout/newsletter_manage_index.xml b/view/frontend/layout/newsletter_manage_index.xml index 2c1a36ff..945632dd 100644 --- a/view/frontend/layout/newsletter_manage_index.xml +++ b/view/frontend/layout/newsletter_manage_index.xml @@ -13,7 +13,7 @@ - +