Magento2: Category design / theme update not inheriting correctly on product pages

Created on 21 Nov 2016  路  11Comments  路  Source: magento/magento2

Preconditions


  1. Magento 2.1.2, PHP 7.0.6, MySQL 14.14
  2. Environment: hypernode-vagrant & production Hypernode
  3. Happens in both developer and production mode

Steps to reproduce

  1. Set the theme for a specific storeview to Magento Blank via Content > Design > Configuration > Edit.
  2. Create and install a theme that inherits from Magento Luma. Add some layout changes. For this example, I created a theme that removes the logo block through default.xml: theme-frontend-test
  3. Deploy static content for the 'LAB51 Test' theme:
    bin/magento setup:static-content:deploy --theme="LAB51/test" en_US
  4. Apply the 'LAB51 Test' theme to a category via Products > Categories > Design > Theme. Be sure to check the "Apply Design to Products" checkbox.

Expected result

  1. When checking the category or a product page, you should not see the logo. It should look like the Luma theme was applied (e.g. the grey top bar and nav bar).

Actual result

  1. On the category page, the logo is removed correctly and it also looks like Luma.
    However on the product page, we see the Luma logo. We also see some links in the top right of the header, that should not be there, since the 'LAB51 Test' theme inherits from Magento Luma, and Luma removes these links. The copyright bar in the footer also looks like a combination of the Blank copyright bar and the Luma copyright bar.
Frontend distributed-cd Fixed in 2.3.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x bug report

All 11 comments

@pascaladriaansen Ignore this if you already know this. Luma inherits from the blank theme, so that explains why you see some elements from the blank theme. Since Luma is already a "child" theme, the Magento code seems to get confused when a theme inherits from luma. Some dependencies seem to break. That's been my experience. Could you try inheriting from the blank theme directly and see if the same behavior occurs?

@Ctucker9233 I'm not so sure that's what's going wrong here, since it works perfectly on category pages. We're using a theme that inherits from Luma on some sites already, and that works great site-wide. It's only problematic on the product page when a theme is applied to a product through a (scheduled) design update.

@pascaladriaansen I see.

See linked bug, I can reproduce this problem : the Theme is correctly applied in \Magento\Catalog\Helper\Product\View::initProductLayout, but only templates are changed, not layout XML updates...

I have a solution for this problem. We don't need to create a default.xml layout for theme. We just need to add custom layout or xml scripts in category custom design. It will apply to products anyway.

@pascaladriaansen, thank you for your report.
We've created internal ticket(s) MAGETWO-81935 to track progress on the issue.

I provided reference fast patch within https://github.com/magento/magento2/issues/8333

I think my issue is related to this. But I tried the patch and it does not work on 2.2.4.
See #16074

This seems to be due to the same bug that was causing the user agent exception to fail on product pages. Just pushed a change for this. See /pull/19124 . The product listing collector was changing the theme to the default one when collecting the data.

Hi @pascaladriaansen. Thank you for your report.
The issue has been fixed in magento/magento2#19124 by @drew7721 in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.1 release.

Was this page helpful?
0 / 5 - 0 ratings