Giter Club home page Giter Club logo

aoe_designfallback's Issues

If you have a typo in the backend, you are lost

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...

Widget problems

When we use widgets we encounter some problems:

I have the following fallback setup:

twiszt:default
bootstrap:nl
bootstrap:default
base:default
  1. When creating a widget in twiszt/default it only fetches the block references from twiszt/default and base/default and therefor it can't find the block references added in bootstrap/nl or bootstrap/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?

  1. When I add the widget to bootstrap/nl (or bootstrap/default) it does show the block references as expected, but when trying to save the widget there is not XML saved because it does a template check and can't find 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.

I have three widgets:
Schermafbeelding 2013-03-13 om 22 20 01
Schermafbeelding 2013-03-13 om 22 18 24
Schermafbeelding 2013-03-13 om 22 18 41

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)

This module conflicts with Aoe_JsCssTstamp

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.