fbrnc / aoe_designfallback Goto Github PK
View Code? Open in Web Editor NEWConfigure your custom design fallback strategy using this Magento module.
Home Page: http://www.fabrizio-branca.de/custom-design-fallbacks-in-magento.html
Configure your custom design fallback strategy using this Magento module.
Home Page: http://www.fabrizio-branca.de/custom-design-fallbacks-in-magento.html
When we use widgets we encounter some problems:
I have the following fallback setup:
twiszt:default
bootstrap:nl
bootstrap:default
base:default
This poses a bit of a problem, because the system doesn't know about the design fallback scheme at this point. Any suggestions how to fix it?
The following change fixes it so it loads the frontend instead of the admin
Index: app/code/local/Aoe/DesignFallback/Model/Design/Package.php:30
- $configuration = Mage::getStoreConfig('design/fallback/fallback', $this->getStore());
+ $configuration = Mage::getStoreConfig('design/fallback/fallback', $defaults['_store']);
2a) The system doesn't load the correct rows from the core_layout_update.
According to the design fallback scheme it should load all three widgets.
in Mage_Core_Model_Resource_Layout::fetchUpdatesByHandle it only fetches the current theme instead of the fallback themes. In fact it only loads twiszt/default and never even loads the updates for base/default, which could be considered a bug. According to my point of view it should fetch all the updates from the fallback scheme instead of only the current.
The following change fixes it (of course model should be overwritten to really apply):
Index: app/code/core/Mage/Core/Model/Layout/Update.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/code/core/Mage/Core/Model/Layout/Update.php (date 1363194606000)
+++ app/code/core/Mage/Core/Model/Layout/Update.php (revision )
@@ -360,7 +360,18 @@
{
$_profilerKey = 'layout/db_update: '.$handle;
Varien_Profiler::start($_profilerKey);
- $updateStr = $this->_getUpdateString($handle);
+ /* @var $design Aoe_DesignFallback_Model_Design_Package */
+ $design = Mage::getSingleton('core/design_package');
+
+ $params = array();
+ $design->updateParamDefaults($params);
+ $scheme = $design->getFallbackScheme($params);
+ $updateStr = '';
+ foreach ($scheme as $layout) {
+ $updateStr = $this->_getUpdateString($handle,
+ array('package' => $layout['_package'], 'theme' => $layout['_theme'])) . $updateStr;
+ }
+
if (!$updateStr) {
return false;
}
@@ -380,9 +391,9 @@
* @param string $handle
* @return mixed
*/
- protected function _getUpdateString($handle)
+ protected function _getUpdateString($handle, $params = array())
{
- return Mage::getResourceModel('core/layout')->fetchUpdatesByHandle($handle);
+ return Mage::getResourceModel('core/layout')->fetchUpdatesByHandle($handle, $params);
}
public function fetchRecursiveUpdates($updateXml)
Problem: Enter something wrong. Exception is thrown:
Line must contain package and theme separated by ":" #0 /home/me/local-workspace/shop/public/app/code/community/Aoe/DesignFallback/Model/Design/Package.php(29): Mage::throwException('Line must conta...') #1 /home/me/local-workspace/shop/public/app/code/community/Aoe/DesignFallback/Model/Design/Package.php(15): Aoe_DesignFallback_Model_Design_Package->getFallbackScheme(Array) #2 /home/me/local-workspace/shop/public/app/code/core/Mage/Core/Model/Design/Package.php(425): Aoe_DesignFallback_Model_Design_Package->_fallback('translate.csv', Array, Array) #3 /home/me/local-workspace/shop/public/app/code/core/Mage/Core/Model/Design/Package.php(454): Mage_Core_Model_Design_Package->getFilename('translate.csv', Array) #4 /home/me/local-workspace/shop/public/app/code/core/Mage/Core/Model/Translate.php(277): Mage_Core_Model_Design_Package->getLocaleFileName('translate.csv') #5 /home/me/local-workspace/shop/public/app/code/core/Mage/Core/Model/Translate.php(141): Mage_Core_Model_Translate->_loadThemeTranslation(false) #6 /home/me/local-workspace/shop/public/app/code/core/Mage/Core/Model/App/Area.php(146): Mage_Core_Model_Translate->init('adminhtml') #7 /home/me/local-workspace/shop/public/app/code/core/Mage/Core/Model/App/Area.php(121): Mage_Core_Model_App_Area->_initTranslate() #8 /home/me/local-workspace/shop/public/app/code/core/Mage/Core/Model/App/Area.php(93): Mage_Core_Model_App_Area->_loadPart('translate') #9 /home/me/local-workspace/shop/public/app/code/core/Mage/Core/Model/App.php(774): Mage_Core_Model_App_Area->load()
now the admin interface itself does not work any more .. there should be some pre validation so we have a chance to fix it, which diving into the database...
Both modules need to rewrite class Mage_Core_Model_Design_Package as this class does not only implement the fallback mechnism, but also takes care of merging js and css files.
Add correct dependencies in both modules
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.