i created a button in the order/view page in magento2 backend, and would like to call a controller when button in clicked.
In my module, I added : etc/adminhtml/routes.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="adminhtml">
<route frontName="xstateupdate" id="xstateupdate">
<module name="My_Module"/>
</route>
</router>
</config>
Conroller/Xstateupdate/Index.php
<?php
namespace My\Module\Controller\Xstateupdate;
class Index extends \Magento\Framework\App\Action\Action {
public function execute()
{
Breakpoint on something;
}
}
In order to check if my controller was working, I manually entered the url : www.xxx.com/admin_toto/admin/xstateupdate/xstateupdate/index.php But it reloads magento backend page and does not trigger my breakpoint...
Thank you for your help