Hello @infonectar9054
Kindly refer below tutorial:
Custom module creation
Hello @infonectar9054
Kindly refer below link:
https://magento.stackexchange.com/questions/121364/magento-2-how-to-call-any-block-function-in-phtml
I did it but the details of success.phtml is changed when I call the block also the function not appear in view page source.
But if I delete the block from phtml it's work fine !
This is my block file :
<?php
namespace Nectar\Google\Block;
use Magento\Framework\View\Element\Template;
class Success extends Template
{
/**
* @return int
*/
public function getGrandTotal()
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$orders = $objectManager->create('Magento\Sales\Model\Order')->load($block->getOrderId());
return $orders->getGrandTotal();
}
}
Hello @infonectar9054
In your layout page, declare relation of block and phtml file as well, refer below code:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Cloudways\Newmodule\Block\Newmodule" name="cloudways_newmodule" template="newmodule.phtml"></block>
</referenceContainer>
</body>
</page>
Hello @infonectar9054
I think you should take help of developer in this case.
Okay how I can contact with developer. Do you have a list or website ?
Because in my country we don't have Magento developers.