Skip to content

Extending Layout .xml files not working in child theme in different <vendor> as to parent theme: Magento 2.0.4. #4330

Open
@shashankitsoft

Description

Root cause description

Steps to reproduce

  1. Add a theme to app/design/frontend folder (i.e. clone https://github.com/sivaschenko/magento2-sample-theme to app/design/frontend/Sivaschenko/default/)
  2. Login to Admin panel (or just reload the admin panel page)
  3. select * from theme to ensure theme is added to the database (type is 0 as it is a physical theme)
  4. Remove the theme files/folder
  5. Reload the admin panel page
  6. select * from theme (type for the theme is now changed to 1 - virtual theme)
  7. Return the theme files back
  8. Reload the admin panel page
  9. select * from theme

Actual Result

type for the theme is still 1 - virtual theme

Expected Result

type for the theme should be 0 - it's a physical theme

Issue description

Summary (*)

  1. Install Magento 2.0.4 on WAMP server 3.0 , Windows 10 Pro - 32bit, PHP 5.6.15, MySQL 5.7.9
  2. Created a child theme themeparent of Magento_blank in app\design\frontend*Vendor1*\themeparent with several layout xml files for extending, along with template .phtml files. Activated from admin. Working Fine.
    theme.xml => <parent>Magento/blank</parent>
  3. Created another child theme themechild of above theme themeparent (which is itself the child of magento blank). This childtheme is created in different vendor folder, i.e. Vendor2
    This theme path is app\design\frontend*Vendor2*\themechild . Created layout .xml file inside to extend its parent theme layout. Activated this second level child theme from admin. The .xml files not even processed. Not working.
    theme.xml => <parent>Vendor1/themeparent</parent>

3b. Although template .phtml files or .css files existing in childtheme are working fine if corresponding layout containers/blocks called in from the Vendor1\themeparent layout files.

  1. If for a test, the same child theme childtheme put inside same vendor of its parent i.e. Vendor1 , the theme path becomes app\design\frontend*Vendor1*\themechild and then the same layout .xml files works fine.

Already tried with clearing public/static and var folders. Also, tried after running with cli commands
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento setup:upgrade

But nothing solved it.

Examples (*)

The required theme inheritance is in this way:
Magento_blank => Vendor1_themeparent => Vendor2_childtheme . (note vendor differ)
Layout .xml fail to load in childtheme.

But if for a test, inheritance made this way:
Magento_blank => Vendor1_themeparent => Vendor1_childtheme . (note vendor same)
Layout .xml load properly and work fine in childtheme.

As per Magento 2 guidelines on http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-inherit.html#set-a-parent-theme it is clearly mentioned that "A parent and a child theme can belong to different vendors. For example, your custom theme can inherit from the Magento Blank theme." . So, if I am creating a second level child theme (in vendor 2) from a parent theme (in vendor 1) which is a child of Magento_blank (vendor: Magento), this should ideally work fine. But its not happening. None of the layout .xml files processed to output if they are under different vendors. If I put both themes in same vendor, they are working fine.

Actual result

Extending layout .xml files in the 2nd level child theme in different vendor folder is not working.

Proposed solution

Why Magento 2.0.4 not working properly for 2 level theme inheritance with different vendor names?
This is a serious issue, as if you suppose purchased a paid theme from somewhere (which they have created by inheriting Magento_blank), and now you want to create your child theme of that paid theme but in different vendorname folder (obviously under your companyname), you will not able to do so!
You have only two choices left, either make your child theme inside their vendor name; or edit their theme .xml files to call your child theme template files or .css/.js (if in ur vendorname); the second case will obviously loose updates, weird way and not recommended.

Then what is the solution??

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: ThemeIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions