Magento2: Magento v2.3 - Choosing a child theme for product .. layout xml doesn't work nor does the layout update

Created on 7 Jan 2020  路  13Comments  路  Source: magento/magento2

Preconditions (*)

  1. Magento 2.3.x & 2.4-develop
  2. PHP 7.2

Steps to reproduce (*)

When you apply ThemeC on a product, then only the (extended) layout of ThemeB will be taken in the following scenario:

  |__/ThemeA (parent: Magento/blank)
    |__/Magento_Catalog
      |__/layout
        |--catalog_product_view.xml

VendorB
  |__/ThemeB (parent: VendorA/ThemeA; applied theme for store)
    |__/Magento_Catalog
      |__/layout
        |--catalog_product_view.xml
  |__/ThemeC (parent: VendorB/ThemeB)
    |__/Magento_Catalog
      |__/layout
        |--catalog_product_view.xml

I don't know if there is any difference when all themes are by the same vendor, but at least this is my setup.
Even tough above setup describes extending layouts I've also tried to override the layout with the same effect.

Expected result
Magento pulls the "catalog_product_view.xml" from the child theme(theme C).

Actual result
Magento pulls the "catalog_product_view.xml" from the theme B.


Additional information
Currently I have fixed the issue with this patch provided by kirmorozov.

CD Theme Clear Description Confirmed Format is valid Ready for Work P2 ready for dev Reported on 2.3.x Reproduced on 2.4.x high S2 Dev.Experience

Most helpful comment

Hello @engcom-Hotel

I have to disagree with you and in my opinion this is still a valid issue - reproduced on my side on 2.2.x and 2.3.x

When you apply ThemeC on a product, then only the (extended) layout of ThemeB will be taken in the following scenario:

  |__/ThemeA (parent: Magento/blank)
    |__/Magento_Catalog
      |__/layout
        |--catalog_product_view.xml

VendorB
  |__/ThemeB (parent: VendorA/ThemeA; applied theme for store)
    |__/Magento_Catalog
      |__/layout
        |--catalog_product_view.xml
  |__/ThemeC (parent: VendorB/ThemeB)
    |__/Magento_Catalog
      |__/layout
        |--catalog_product_view.xml

I don't know if there is any difference when all themes are by the same vendor, but at least this is my setup.
Even tough above setup describes extending layouts I've also tried to override the layout with the same effect.

Currently I have fixed the issue with this patch provided by kirmorozov.

All 13 comments

Hi @PaulWatt. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@PaulWatt do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

Hi @engcom-Hotel. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

Hello @PaulWatt

-- theme
--- Magento_Catalog
---- layout
----- catalog_product_view.xml

structure is not valid for overriding theme layout.
How to override theme layouts you can read in this topic.

So i have to close this issue.

Thanks for your report and collaboration!

Hello @engcom-Hotel

I have to disagree with you and in my opinion this is still a valid issue - reproduced on my side on 2.2.x and 2.3.x

When you apply ThemeC on a product, then only the (extended) layout of ThemeB will be taken in the following scenario:

  |__/ThemeA (parent: Magento/blank)
    |__/Magento_Catalog
      |__/layout
        |--catalog_product_view.xml

VendorB
  |__/ThemeB (parent: VendorA/ThemeA; applied theme for store)
    |__/Magento_Catalog
      |__/layout
        |--catalog_product_view.xml
  |__/ThemeC (parent: VendorB/ThemeB)
    |__/Magento_Catalog
      |__/layout
        |--catalog_product_view.xml

I don't know if there is any difference when all themes are by the same vendor, but at least this is my setup.
Even tough above setup describes extending layouts I've also tried to override the layout with the same effect.

Currently I have fixed the issue with this patch provided by kirmorozov.

Hello @felly , thanks for contributing!
I was able to reproduce this issue on the latest Magento 2.4-develop with your theme configuration.

Thanks for opening this issue!

Thanks for opening this issue!

Thanks for opening this issue!

:white_check_mark: Confirmed by @engcom-Hotel
Thank you for verifying the issue. Based on the provided information internal tickets MC-31174 were created

Issue Available: @engcom-Hotel, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

@felly Thank you very much for reporting this issue to me!

I was going crazy why i couldn't see my changes of my child theme when changing the layout.

This is still and issue in Magento 2.3.4.

@felly @PaulWatt @leonhelmus Do you use the default theme(Applied Theme) for store view? This is a required step if you want a theme to be used on a storefront.

https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/themes/theme-apply.html

Please set ThemeC as default for store view. This is should fix the issue.

Also, if you will add some translate file to your theme app/design/frontend/VendorB/ThemeC/i18n/en_US.csv . Translate won't work without "Applied Theme".

Hi @omaxmo
the default/applied theme is (and should be) ThemeB - however the theme on some products should be ThemeC.

https://docs.magento.com/user-guide/catalog/settings-advanced-design.html
https://docs.magento.com/user-guide/catalog/product-scheduled-design-update.html

I'm curious will this be fixed in 2.4.1? I'm seeing it go from high to low priority. Am I missing something here?

Was this page helpful?
0 / 5 - 0 ratings