outeredge / magento-structured-data-module

Magento Structured Data Module by outer/edge
MIT License
46 stars 13 forks source link

Error with Hyva themes #69

Closed mpchadwick closed 3 months ago

mpchadwick commented 4 months ago

This module causes an error with the default Hyva theme.

Error: Call to a member function getJsonConfigurationHtmlEscaped() on null in /var/www/html/vendor/magento/module-catalog/view/frontend/templates/product/breadcrumbs.phtml:12

Here is what I believe is happening:

This layout directive references the following template path: Magento_Catalog::product/breadcrumbs.phtml

vendor/outeredge/magento-structured-data-module/view/frontend/layout/catalog_product_view.xml:                <argument name="template" xsi:type="string">Magento_Catalog::product/breadcrumbs.phtml</argument>

Hyva puts the template at Magento_Catalog::product/view/breadcrumbs.phtml, however, so Magento loads the template from vendor/magento/module-catalog instead of vendor/hyva-themes/magento2-default-theme.

The template at vendor/magento/module-catalog references a viewModel which isn't defined in

vendor/hyva-themes/magento2-default-theme/Magento_Catalog/layout/catalog_product_view.xml

As such it triggers the error

ollyijb commented 4 months ago

Hi mpchadwick, we will raise an internal task for this and get back to you. Thanks!

ollyijb commented 3 months ago

Hi mpchadwick,

We were unable to reproduce this issue using:

Magento ver. 2.4.6-p4 "hyva-themes/magento2-default-theme": "1.3.2" "outeredge/magento-structured-data-module": "4.0.10"

Can you please let me know which versions you are using?

Thanks!