So I've created one module to display "hello world" message on single product page like below:
However "Hello world" message is not displaying on product page.
My Custom Module look like below:
registration.php file look like below:
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE, //type
'Paymentblock_Ext', //componentName
__DIR__ //path
);
?>
module.xml file look like below:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Paymentblock_Ext" setup_version="1.0.0">
</module>
</config>
catalog_product_view.xml file look like below:
<?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="Paymentblock\Ext\Block\PaymentMethod" name="custompaymentblock" template="Paymentblock_Ext::custom_ptype.phtml"/>
</referenceContainer>
</body>
custom_ptype.phtml file look like below:
<h3>Hello World</h3>
PaymentMethod.php file look like below:
<?php
namespace Paymentblock\Ext\Block;
use Magento\Framework\View\Element\Template;
class PaymentMethod extends Template {
}
?>
I've applied below command to see the module effects on product page:
php magento setup:di:compile
My module is in the list of enabled module as I can see here by applying below command:
php bin/magento module:status
However, I am still not able to see the "Hello World" message on single product page.
can anyone please point me out what I am doing wrong here????
Theme layout update file '/var/www/html/app/code/Paymentblock/Ext/view/frontend/layout/catalog_product_view.xml' is not valid. Premature end of data in tag page line 2 Line: 8
<?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="Paymentblock\Ext\Block\PaymentMethod" name="custompaymentblock" template="Paymentblock_Ext::custom_ptype.phtml"/>
</referenceContainer>
</body>
</page>
Add </page>