Вопрос

Я пытаюсь расширить страницу просмотра продукта, но не могу переопределить.

CATALOG_PRODUCT_VIEW.XML

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="catalog_product_opengraph" />
    <update handle="page_calendar"/>
    <body>
        <referenceBlock name="product.info">
            <block class="Learning\Product\Block\Share" name="sharing_tool" template="Learning_Product::share.phtml"></block>
        </referenceBlock>
    </body>
</page>
.

share.phtml

<h1> Hi I'm sharing tool!!!!!</h1>
.

<Сильные> Share.php

<?php

namespace Learning\Product\Block;

use Magento\Framework\View\Element\Template;

class Share extends Template{

    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate('Learning_Product::share.phtml');
    }
}
.

Любые предложения?

Это было полезно?

Решение

CATALOG_PRODUCT_VIEW.XML

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="product.info.main">
            <block class="Learning\Product\Block\Share" name="sharing_tool" template="Learning_Product::share.phtml"></block>
        </referenceContainer>
    </body>
</page>
.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с magento.stackexchange
scroll top