New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending Layout .xml files not working in child theme in different <vendor> as to parent theme: Magento 2.0.4. #4330
Comments
When trying to reproduce the issue in the ticket #4274, we tested it the way you described in current ticket (each theme with different vendor name). As we mentioned in referenced issue, we could not reproduce the issue. |
Hi, Thank you very much for giving me the sample code. I have checked it on same installation and it worked! Then I digged into the magento database, and I found out one amazing thing. In the 'theme' mysql table of magento database, somehow the 'type' column corresponding to my childtheme had value set as '1' and all others were set '0'. Under suspicion, I tried to find what it means by comment in table column name which shows..
I guessed it may be a reason, and manually set the 'type' column value to 0 corresponding to my childtheme. Cleared var and public/static folders. Re-tested, and voila! it worked!! This small issue has wasted my 4-5 days, with no solution. Even deactivation-activation or switching themes from admin was not resetting its value to 0 (it always remained 1) and so it never worked. For a cross check to confirm, I deleted that row from database theme table, and reinstalled the theme, ran Don't know how it was set to 1 and when. Anyways, the issue is solved now, and
, which can waste every developers time if not known. Thanks. |
Hi, shashankitsoft, we are glad that the sample code helped you a lot. And we are sorry that it took so much of your time and efforts. Thank you for the explanation, it will be passed to the team responsible for themes. |
I'm closing it for now. If someone can find a way to reproduce the issue, please notify me to reopen. |
I guess I found what was the problem. If you have your theme fresh installed e.g.
The problem is that if theme is set as Virtual, for example you temporary removed theme directory from app/design/frontend, it's cannot be set again as Physical and you can see it in described class code So if you removed theme files from app/design/frontend and returned it there after some operations, or if you did some stuff that could re-register your theme - check the type field in the database. By myself, I'd say that this is very unsafe to set those type of field, which could affect frontend rendering according to file operations done by site developers and not documenting it, nor giving any recommendations or warnings that theme is set to Virtual. I mean, really? This field exist in database and can cause serious problems, without any documenting or warnings. |
@shashankitsoft Thank you. Had same problem. It's look like on updating magento it removed theme and set it as 'virtual'. So when I've added back my theme it was not reading xml files. |
I've got this same issue. And actually, the one thing I haven't done is change the setting to/from virtual. I don't know if this is best practice tho? |
@shoshweb Do it, as I have found and already suggested. Change virtual to physical, . It will be solved. |
Thank you so much. |
@shoshweb You should have red this post comments first before asking again, its already there. |
Um. lol.. I did read it. |
@shoshweb 'type' is column name, table name is => 'theme', already mentioned. Reading plain english doesn't need advanced user. |
I'm always quite put off about writing on here, It's like a rule to be rude first and ruder later. Odd. |
@shoshweb I'll help you out. Go into phpMyAdmin. Click on the name of your database. You should see a search bar. Search for theme. Sometimes you have to click on the results to see the results. Click on the one that has _theme in the name. Click on that file. Once the table is loaded, look at the "type" column. That's the column you want to edit. There should be an edit button or link at the beginning of the row. Click that and you will be able to edit that column. Hope this clarifies what you need to know. |
I wasted only 2 days! -> set 1 to 0 -> everything works fine! There should be a hint in the official magento docs. Or is there a hidden switch where you can set this value in the magento backend? |
@piotrekkaminski is there a commit related to this bug in |
@firestorm23 's description is very on point. Also, this issue is not fixed, and I'm using It's very easy to reproduce. Take my example:
Steps 5 happens in the |
I'd like to add that we experienced the same issue with Magento 2.2.6 lately. We were migrating a system to a new server and somehow during the installation the "main" theme was set to |
Bump for 2.2.x release fix? |
Hi @engcom-backlog-tomash. Thank you for working on this issue.
|
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
[Owls] MC-16599 Use Escaper methods
We faced similar issue after upgrading to magento 2.4. We replaced value to 0 in table and theme started showing. However now header is missing in child theme. It is coming in parent theme. Please let me know if there can be a fix for it |
Same here, upgraded from 2.3.5-p2 and still, layouts are loaded from parent. |
Added root cause steps, actual and expected result to the description |
I think the issue I'm experiencing is also related to this issue. On 2.4.1 I'm facing an issue where I can't override the default_head_blocks.xml in a Child of a Child theme. E.g. Vendor1 Vendor2 I'm assigning the second child to a category and trying to load a custom css for that child theme only. |
@shashankitsoft Thank you very much you saved my days. |
So this is still an issue on 2.4.5-p1 - what gives ? - can it be fixed without having to modify the theme type in the db ? |
Root cause description
Steps to reproduce
app/design/frontend
folder (i.e. clone https://github.com/sivaschenko/magento2-sample-theme toapp/design/frontend/Sivaschenko/default/
)select * from theme
to ensure theme is added to the database (type
is0
as it is a physical theme)select * from theme
(type
for the theme is now changed to1
- virtual theme)select * from theme
Actual Result
type
for the theme is still1
- virtual themeExpected Result
type
for the theme should be0
- it's a physical themeIssue description
Summary (*)
theme.xml =>
<parent>Magento/blank</parent>
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.
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??
The text was updated successfully, but these errors were encountered: