1

[[ TLDR: I'm looking for info about (or a module) that would allow me to have child themes inherit widgets from their parents. For widgets that were created on the backend. ]]

This is for Magento 1.9x (1.9.3.8 to be exact). I'll describe what I did; and then what I expected it to do but doesn't. To start with, we're using the default theme rwd/default.

Step 1: Make a static block named test_block

magento 1.9 cms static block

Step 2: make a widget, configure it to show on the right-side column

magento 1.9 cms widget

Result: GOOD - This works just fine when viewing the site with rwd/default theme

enter image description here


Step 3: make a new theme: rwd/green

specified parentage in app/design/frontend/rwd/green/etc/theme.xml

<?xml version="1.0"?>
<theme>
    <parent>rwd/default</parent>
</theme>

and switch appropriate settings in Configuration > GENERAL > Design > Themes so the site uses the rwd/green theme.

Result: BAD -- the widget does not get inherited into the child theme

enter image description here

Observed behaviour: widgets don't get inherited.

Expected behaviour: I expected the child theme to inherit the widget from its parent instead of me having to explicitly specify all widgets on all child themes.

This can/will be a significant pain with temporary themes (ie xmas/easter/summer break themes that are minor tweaks based on a parent and used sporadically or for a short time) or with customizations used only under a specific scope (ie. one category or one product with theme tweaks by using a child theme)

As you can imagine, specifying all those widgets explicitly for each theme color variation or for each seasonal theme is going to be an issue. I would like to be able to propagate the widgets into the child themes thus only have to set the widgets once, at the parent.

Is there a module floating around out there that covers this?

To be clear this is a question about widgets/cms blocks made using the backend system and not the layout xml/template phtml files.

0

Solution you may be looking for

I used this quite often for the issue that I believe you are experiencing.

Detailed explanation:

https://ericwie.se/blog/magento-infinite-theme-fallback-fix

Module:

https://github.com/ericthehacker/magento-themefallbackfix


Not solution you are looking for

In addition to the theme.xml in the theme's etc/, you may want to consider adding a widget.xml. Use the enterprise edition's widget.xml as an example, where the rwd/enterprise theme is the child and inherits from the parent rwd/default.

Hopefully, this is not any violation of copyright or Magento's policies. If so, then it obviously can be removed or modified to show an example without exposing a piece of the Enterprise edition's source.

magento/app/design/frontend/rwd/enterprise/etc/widget.xml

<?xml version="1.0"?>
<!--
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magento Enterprise Edition End User License Agreement
 * that is bundled with this package in the file LICENSE_EE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.magento.com/license/enterprise-edition
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     rwd_enterprise
 * @copyright Copyright (c) 2006-2017 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license http://www.magento.com/license/enterprise-edition
 */
-->
<widgets>
    <new_products>
        <parameters>
            <template>
                <values>
                    <list_default translate="label">
                        <value>catalog/product/widget/new/column/new_default_list.phtml</value>
                        <label>New Products Images and Names Template</label>
                    </list_default>
                    <list_names translate="label">
                        <value>catalog/product/widget/new/column/new_names_list.phtml</value>
                        <label>New Products Names Only Template</label>
                    </list_names>
                    <list_images translate="label">
                        <value>catalog/product/widget/new/column/new_images_list.phtml</value>
                        <label>New Products Images Only Template</label>
                    </list_images>
                </values>
            </template>
        </parameters>
        <supported_blocks>
            <left_column>
                <block_name>left</block_name>
                <template>
                    <default>list_default</default>
                    <names_only>list_names</names_only>
                    <images_only>list_images</images_only>
                </template>
            </left_column>
            <main_content>
                <block_name>content</block_name>
                <template>
                    <grid>default</grid>
                    <list>list</list>
                </template>
            </main_content>
            <right_column>
                <block_name>right</block_name>
                <template>
                    <default>list_default</default>
                    <names_only>list_names</names_only>
                    <images_only>list_images</images_only>
                </template>
            </right_column>
        </supported_blocks>
    </new_products>

    <catalog_product_link>
        <!--supported_blocks>
            <page_header>
                <block_name>top.container</block_name>
                <template>
                    <block_link>default</block_link>
                </template>
            </page_header>
            <main_content>
                <block_name>content</block_name>
                <template>
                    <block_link>default</block_link>
                    <inline_link>link_inline</inline_link>
                </template>
            </main_content>
            <left_column>
                <block_name>left</block_name>
                <template>
                    <block_link>default</block_link>
                </template>
            </left_column>
            <right_column>
                <block_name>right</block_name>
                <template>
                    <block_link>default</block_link>
                </template>
            </right_column>
            <page_footer>
                <block_name>footer</block_name>
                <template>
                    <block_link>default</block_link>
                </template>
            </page_footer>
        </supported_blocks-->
    </catalog_product_link>

    <recently_viewed>
        <parameters>
            <template>
                <values>
                    <list_default translate="label">
                        <value>reports/widget/viewed/column/viewed_default_list.phtml</value>
                        <label>Viewed Products Images and Names Template</label>
                    </list_default>
                    <list_names translate="label">
                        <value>reports/widget/viewed/column/viewed_names_list.phtml</value>
                        <label>Viewed Products Names Only Template</label>
                    </list_names>
                    <list_images translate="label">
                        <value>reports/widget/viewed/column/viewed_images_list.phtml</value>
                        <label>Viewed Products Images Only Template</label>
                    </list_images>
                </values>
            </template>
        </parameters>
        <supported_blocks>
            <left_column>
                <block_name>left</block_name>
                <template>
                    <default>list_default</default>
                    <names_only>list_names</names_only>
                    <images_only>list_images</images_only>
                </template>
            </left_column>
            <main_content>
                <block_name>content</block_name>
                <template>
                    <grid>default</grid>
                    <list>list</list>
                </template>
            </main_content>
            <right_column>
                <block_name>right</block_name>
                <template>
                    <default>list_default</default>
                    <names_only>list_names</names_only>
                    <images_only>list_images</images_only>
                </template>
            </right_column>
        </supported_blocks>
    </recently_viewed>
    <recently_compared>
        <parameters>
            <template>
                <values>
                    <list_default translate="label">
                        <value>reports/widget/compared/column/compared_default_list.phtml</value>
                        <label>Compared Products Images and Names Template</label>
                    </list_default>
                    <list_names translate="label">
                        <value>reports/widget/compared/column/compared_names_list.phtml</value>
                        <label>Compared Product Names Only Template</label>
                    </list_names>
                    <list_images translate="label">
                        <value>reports/widget/compared/column/compared_images_list.phtml</value>
                        <label>Compared Product Images Only Template</label>
                    </list_images>
                </values>
            </template>
        </parameters>
        <supported_blocks>
            <left_column>
                <block_name>left</block_name>
                <template>
                    <default>list_default</default>
                    <names_only>list_names</names_only>
                    <images_only>list_images</images_only>
                </template>
            </left_column>
            <main_content>
                <block_name>content</block_name>
                <template>
                    <grid>default</grid>
                    <list>list</list>
                </template>
            </main_content>
            <right_column>
                <block_name>right</block_name>
                <template>
                    <default>list_default</default>
                    <names_only>list_names</names_only>
                    <images_only>list_images</images_only>
                </template>
            </right_column>
        </supported_blocks>
    </recently_compared>
</widgets>
  • Close, but no cigar. I'd seen this before. It's a fix that includes the parent's theme.xml into the layout. I'm currently hammering away at Mage_Core_Model_Resource_Layout to see if it's the place I need to modify to have the effect I want. I got the hint from magento.stackexchange.com/questions/16075/… – Μάκης Παλάσης Apr 16 '18 at 11:41
0

So, since I couldn't find an extension that does this... I went and made my own :P

Palasis_Inheritwidgets

This makes themes inherit widgets from their parents

https://github.com/mpalasis/Palasis_Inheritwidgets

enjoy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.