I would like to Override Magento\Catalog\Block\Product\View\Description
, but I've got:
[2017-08-21 16:03:47] main.CRITICAL: Invalid template file: 'product/view/attribute.phtml' in module: 'Test_Catalog' block's name: 'product.info.sku' [] []
and detail.phtml
is missing on frontend on product page.
I have done:
etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Catalog\Block\Product\View\Description" type="Test\Catalog\Block\Product\View\Description" />
</config>
in Test/Catalog/Block/Product/View/Description
:
<?php
namespace Test\Catalog\Block\Product\View;
class Description extends \Magento\Catalog\Block\Product\View\Description
{
/**
* @return array|bool
*/
public function getConfigProductChild()
{
//function returns child products in array
}
}
I'm using TemplateMonster Theme so I would like to use getConfigProductChild
function in :
project/app/design/frontend/TemplateMonster/framework/Magento_Catalog/templates/product/view/details.phtml
I read that I should type referenceBlock with template and Mine block but it doest works (or I did something wrong?). Tried something like that:
in view/frontend/layout/default.xml of mine module:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.details" class="Test\Catalog\Block\Product\View\Description" template="Magento_Catalog::product/view/details.phtml" after="product.info.media"/>
</body>
</page>
Instead of Magento_Catalog
I tried also use TemplateMonser etc.
Do You know what's the problem?
EDIT:
path for missing pthml:
project/app/design/frontend/TemplateMonster/framework/Magento_Catalog/templates/product/view/details.phtml
layout using details.phtml:
project/app/design/frontend/TemplateMonster/framework/Magento_Catalog/layout/catalog_product_view.xml
<body>
<referenceContainer name="content">
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.details" template="product/view/details.phtml" after="product.info.media">
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description" template="product/view/attribute.phtml" group="detailed_info">
<arguments>
<argument name="at_call" xsi:type="string">getDescription</argument>
<argument name="at_code" xsi:type="string">description</argument>
<argument name="css_class" xsi:type="string">description</argument>
<argument name="at_label" xsi:type="string">none</argument>
<argument name="title" translate="true" xsi:type="string">Details</argument>
</arguments>
</block>
<block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="product/view/attributes.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">More Information</argument>
</arguments>
</block>
</block>
</referenceBlock>
</body>