diff --git a/app/code/community/Ebanx/Gateway/Block/Health/Check.php b/app/code/community/Ebanx/Gateway/Block/Health/Check.php index 7f205e51..c081b941 100644 --- a/app/code/community/Ebanx/Gateway/Block/Health/Check.php +++ b/app/code/community/Ebanx/Gateway/Block/Health/Check.php @@ -104,14 +104,21 @@ public function hasAnySupportedCurrency() $this->supportedCurrencies = Currency::all(); try { - array_walk(Mage::app()->getStores(), function ($store) { - if (in_array(Mage::app()->getStore($store->store_id)->getCurrentCurrencyCode(), $this->supportedCurrencies)) { - throw new Exception; + $stores = Mage::app()->getStores(); + $currentSupportedCurrencies = []; + foreach ($stores as $store) { + $currentCurrencyCode = $store->getCurrentCurrencyCode(); + if (in_array($currentCurrencyCode, $this->supportedCurrencies)) { + $currentSupportedCurrencies[] = $currentCurrencyCode; } - }); - } catch (\Exception $e) { + } + if (count($currentSupportedCurrencies) == 0) { + return 'Currency not supported: Your website must support one of these currencies ' + . implode(', ', $this->supportedCurrencies) . '.';; + } + } catch (Exception $e) { return true; } - return 'Currency not supported: Your website must support one of these currencies ' . implode(', ', $this->supportedCurrencies) . '.'; + return true; } }