storeManager = $storeManager; $this->customerSession = $customerSession; } /** * @param string $key * @param null|int $store * @return null|string */ public function getConfig($key, $store = null) { $store = $this->storeManager->getStore($store); $websiteId = $store->getWebsiteId(); $result = $this->scopeConfig->getValue( 'quickorder/' . $key, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); return $result; } /** * @return boolean */ public function isEnabled() { return $this->getConfig('general/enabled'); } /** * @return string */ public function getTitle() { return $this->getConfig('general/title'); } /** * @return boolean */ public function isGroupValid() { if ($this->getConfig('general/customer_groups')) { $customerGroupId = $this->customerSession->getCustomer()->getGroupId(); $customerGroups = explode(',', $this->getConfig('general/customer_groups')); return in_array($customerGroupId, $customerGroups); } return true; } }