├── .gitignore ├── LICENSE ├── README.md ├── app ├── code │ └── community │ │ └── EW │ │ └── ThemeFallbackFix │ │ ├── Helper │ │ └── Data.php │ │ ├── Model │ │ └── Observer.php │ │ └── etc │ │ └── config.xml └── etc │ └── modules │ └── EW_ThemeFallbackFix.xml ├── composer.json └── modman /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Eric 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Magento Infinite Theme Fallback Fix 2 | 3 | This module fixes the infinite fallback layout XML update bug as described in this [blog post](https://ericwie.se/blog/magento-infinite-theme-fallback-fix). 4 | 5 | ## Install via [modman](https://github.com/colinmollenhour/modman): 6 | 7 | ``` 8 | $ cd 9 | $ modman init #if this web root has never used modman, initialize 10 | $ modman clone https://github.com/ericthehacker/magento-themefallbackfix.git 11 | ``` 12 | 13 | Flush cache and relax! 14 | -------------------------------------------------------------------------------- /app/code/community/EW/ThemeFallbackFix/Helper/Data.php: -------------------------------------------------------------------------------- 1 | getUpdates(); 15 | /* @var $designPackage Mage_Core_Model_Design_Package */ 16 | $designPackage = Mage::getSingleton('core/design_package'); 17 | /* @var $fallback Mage_Core_Model_Design_Fallback */ 18 | $fallback = Mage::getModel('core/design_fallback'); 19 | 20 | $fallbacks = $fallback->getFallbackScheme($designPackage->getArea(), $designPackage->getPackageName(), $designPackage->getTheme('layout')); 21 | 22 | for($i=count($fallbacks)-1; $i>=0; $i--) { 23 | $fallback = $fallbacks[$i]; 24 | if(!isset($fallback['_package']) || !isset($fallback['_theme'])) { 25 | continue; 26 | } 27 | 28 | $fallbackPackage = $fallback['_package']; 29 | $fallbackTheme = $fallback['_theme']; 30 | 31 | $themeUpdateGroups = Mage::getSingleton('core/design_config')->getNode("{$designPackage->getArea()}/$fallbackPackage/$fallbackTheme/layout/updates"); 32 | 33 | if(!$themeUpdateGroups) { 34 | continue; 35 | } 36 | 37 | foreach($themeUpdateGroups as $themeUpdateGroup) { 38 | $themeUpdateGroupArray = $themeUpdateGroup->asArray(); 39 | 40 | foreach($themeUpdateGroupArray as $key => $themeUpdate) { 41 | $updateNode = $updates->addChild($key); 42 | $updateNode->addChild('file', $themeUpdate['file']); 43 | } 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/code/community/EW/ThemeFallbackFix/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.0.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | EW_ThemeFallbackFix_Model 13 | 14 | 15 | 16 | 17 | 18 | EW_ThemeFallbackFix_Helper 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | ew_themefallbackfix/observer 29 | addFallbackThemesLayoutUpdates 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/etc/modules/EW_ThemeFallbackFix.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | community 7 | 8 | 9 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ericthehacker/magento-themefallbackfix", 3 | "type": "magento-module", 4 | "description": "Magento Theme Fallback", 5 | "homepage": "https://ericwie.se/blog/magento-infinite-theme-fallback-fix", 6 | "require": { 7 | "magento-hackathon/magento-composer-installer": "*" 8 | }, 9 | "authors": [ 10 | { 11 | "name": "ericthehacker", 12 | "email": "na" 13 | } 14 | ], 15 | "extra": { 16 | "magento_connect": { 17 | "channel": "local", 18 | "php_min": "5.3.0", 19 | "php_max": "6.0.0", 20 | "stability": "beta", 21 | "summary": "Magento Theme Fallback" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /modman: -------------------------------------------------------------------------------- 1 | app/code/community/EW/ThemeFallbackFix app/code/community/EW/ThemeFallbackFix 2 | app/etc/modules/EW_ThemeFallbackFix.xml app/etc/modules/EW_ThemeFallbackFix.xml --------------------------------------------------------------------------------