magento2: Custom theme doesn't apply XML layout updates when applied to a product
I was looking to open this issue, but thought I’d try and find one before I did. I think this issue is linked to #7503, but is manifesting is achieved in a different way
We have a theme that does not inherit, and it’s XML updates appear to be ignored.
Preconditions
Magento 2.1.2, PHP 5.6.24
Environment: Windows XAMPP / Windows WSL
Developer Mode
Steps to reproduce
Set the theme for a specific storeview to Purenet/Theme (our default theme for the store) via Content > Design > Configuration > Edit.
Create and install a theme that has no inheritence. Add layout changes. For this example, I created a theme with a catalog_product_view.xml file that removes the main title for the product as Purenet/Client.
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="page.main.title" remove="true"/>
</body>
</page>
- Deploy static content for the ‘Purenet Client’ theme:
- bin/magento setup:static:deploy --theme=“Purenet/Client” en_GB
- Apply the ‘Purenet Client’ theme to a category via Products > Catalog > Actual Product > Schedule Design Update > Set Dates & New theme to be Purenet/Client. Save Product.
Expected result
When checking the the product page, you should not see the main product title.
Actual result
On the Product Page, the main product title is displayed.
Setting a similar XML layout file on a category in the same manner appears to work.
Investigation
So far, it looks like _fetchPackageLayoutUpdates within lib/internal/Magento/Framework/View/Model/Layout/Merge.php doesn’t capture the XML that contains the handle updates. I found moving the XML into catalog_product_prices made it added as an update, however, it was still not removed.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 19 (5 by maintainers)
Commits related to this issue
- Merge pull request #7710 from magento-l3/PR_07_JUN_2022_Odubovyk L3 bugfix delivery — committed to magento/magento2 by dhorytskyi 2 years ago
Go to your database. select theme table. Check custom theme record. If the value of the type field is 1 change it to 0. This fixed my issue.
Here is the main code of the plugin I use, on
Magento\Catalog\Controller\Product\View:Hi @chickenland. 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.