1) Update GoFlyyGetOrder.php Add id in Button and a tag
Vendor/Module/Ui/Component/Listing/Column/GoFlyyGetOrder.php
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item) {
$order = $this->orderRepository->get($item["entity_id"]);
$goFlyyOrderId = $order->getData("goflyy_order_id");
if($goFlyyOrderId){
$item[$fieldName] = "<button"<a href='baseurl/Vendor_Module/index/index?id='.$goFlyyOrderId><button class='button' id='FlyyOrderId_$goFlyyOrderId'><span>$goFlyyOrderId<id='FlyyOrderId_$goFlyyOrderId$'><span>$goFlyyOrderId</span></button>";
}
}
}
return $dataSource;
}
After After Call Phtml in Sales Order Grid
21) Create a File and add the code given below
File : Vendor/Module/viewController/adminhtmlAdminhtml/layoutIndex/sales_order_gridIndex.xmlphp
<?xmlphp
/**
version="1.0"* encoding="UTF-8"?>Copyright © All rights reserved.
<page xmlns:xsi="http://www* See COPYING.w3txt for license details.org
*/2001
declare(strict_types=1);
namespace Vendor\Module\Controller\Adminhtml\Index;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\View\Result\PageFactory;
class Index implements HttpGetActionInterface
{
/XMLSchema-instance"**
xsi:noNamespaceSchemaLocation="urn:magento:framework:View * @var PageFactory
*/Layout
protected $resultPageFactory;
/etc**
* Constructor
*
* @param PageFactory $resultPageFactory
*/page_configuration.xsd">
<body> public function __construct(PageFactory $resultPageFactory)
{
<referenceContainer name="root"> $this->resultPageFactory = $resultPageFactory;
}
/**
<block class="Vendor\Module\Block\Adminhtml\FlyOrder" template="Vendo_Module:: * Execute view/flyorder.phtml" name="vendor.fly.order"action
/> *
* @return </referenceContainer>ResultInterface
< */body>
</page> public function execute()
{
return $this->resultPageFactory->create();
}
}
?>
32) Create a block class and add a code
File : Vendor\Module\Block\Adminhtml\FlyOrderVendor/Module/Block/Adminhtml/Index/Index.php
<?php
/**
* Copyright © All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Vendor\Module\Block\Adminhtml;Vendor\Module\Block\Adminhtml\Index;
class FlyOrderIndex extends \Magento\Backend\Block\Template
{
/**
* Constructor
*
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/Get
Collection of goFlyyOrderId addpublic youfunction Logic__construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\App\Request\Http $request
array $data = []
) {
parent::__construct(
$this->request = $request;
$context,$data
);
}
public function getFlyyOrderId(){
-------------------$FlyyOrderId = $this->request->getParam('id', false);
return $FlyyOrderId;
}
}
?>
43) Create a template file flyordervendor_module_index_index.phtml in pathxml
File : Vendor/Module/view/adminhtml/templates/viewlayout/flyordervendor_module_index_index.xml
<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block name="index.index" class="Vendor\Module\Block\Adminhtml\Index\Index" template="Vendor_Module::index/index.phtml"/>
</referenceContainer>
</body>
</page>
4) Create a template file flyorder.phtml in path
File : Vendor\Module\Block\Adminhtml\Index\Index" template="Vendor_Module::index/index.phtml"
<div id="popup-modal-main<?php echo $block->getFlyyOrderId();?>" style="display:none;">
Fly Order Id <?php echo $block->getFlyyOrderId();?>
</div>
<script type="text/javascript">
require([
'jquery',
'Magento_Ui/js/modal/modal'
], function($, modal) {
$(document).ready(function(){
var options = {
type: 'popup',
responsive: true,
innerScroll: true,
title: 'Open Modal'
};
$("#FlyyOrderId_<?php echo $block->getFlyyOrderId();?>").on('click',function(){
$("#popup-modal-main<?php echo $block->getFlyyOrderId();?>").modal(options).modal('openModal');
});
});
});
</script>