From 40fd02475b8c2b2d32e79657ae7367a7b9d9b5fa Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun Date: Mon, 26 Dec 2016 15:39:52 +0200 Subject: [PATCH] MAGETWO-62648: [Github] Parameters from website configuration isn't applied to the corresponding store view #7943 --- app/code/Magento/Review/Helper/Data.php | 2 +- .../Magento/Store/Model/Config/Processor/Fallback.php | 7 ++++--- app/code/Magento/Store/Model/ResourceModel/Website.php | 10 ++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Review/Helper/Data.php b/app/code/Magento/Review/Helper/Data.php index a8c3afd6863b2..e5681f43fd1bf 100644 --- a/app/code/Magento/Review/Helper/Data.php +++ b/app/code/Magento/Review/Helper/Data.php @@ -74,7 +74,7 @@ public function getDetailHtml($origDetail) */ public function getIsGuestAllowToWrite() { - return $this->scopeConfig->isSetFlag(self::XML_REVIEW_GUETS_ALLOW, \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES); + return $this->scopeConfig->isSetFlag(self::XML_REVIEW_GUETS_ALLOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Store/Model/Config/Processor/Fallback.php b/app/code/Magento/Store/Model/Config/Processor/Fallback.php index 59b8020d6979b..465cab39bfc50 100644 --- a/app/code/Magento/Store/Model/Config/Processor/Fallback.php +++ b/app/code/Magento/Store/Model/Config/Processor/Fallback.php @@ -158,9 +158,9 @@ private function prepareStoresConfig( } /** - * Retrieve Website Config + * Find by id specific information about website. * - * @param array $websites + * @param array $websites Has next format: (website_code => [website_data]) * @param int $id * @return array */ @@ -168,10 +168,11 @@ private function getWebsiteConfig(array $websites, $id) { foreach ($this->websiteData as $website) { if ($website['website_id'] == $id) { - $code = $website['website_id']; + $code = $website['code']; return isset($websites[$code]) ? $websites[$code] : []; } } + return []; } } diff --git a/app/code/Magento/Store/Model/ResourceModel/Website.php b/app/code/Magento/Store/Model/ResourceModel/Website.php index 5095480aa09ce..3f5aa576d7822 100644 --- a/app/code/Magento/Store/Model/ResourceModel/Website.php +++ b/app/code/Magento/Store/Model/ResourceModel/Website.php @@ -40,17 +40,23 @@ protected function _initUniqueFields() } /** - * Read information about all websites + * Read all information about websites. Convert information to next format: + * [website_code => [website_data (website_id, code, name, etc...)]] * * @return array */ public function readAllWebsites() { + $websites = []; $select = $this->getConnection() ->select() ->from($this->getTable('store_website')); - return $this->getConnection()->fetchAll($select); + foreach($this->getConnection()->fetchAll($select) as $websiteData) { + $websites[$websiteData['code']] = $websiteData; + } + + return $websites; } /**