I am working on module which will work for sync product from Third party Api.I have already created admin controller page but don't have Idea how to add button Sync Products whose action will call a controller file . Have anyone idea how to add new custom button with action controller?
I have added menu in admin section with Parent Catalog->
Admin menu is
app/code/Vendorname/Syncfromshopify/etc/adminhtml/menu.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Vendorname_Syncfromshopify::sync_product" title="Sync From Shopiofy" module="Vendorname_Syncfromshopify" parent="Magento_Catalog::catalog" sortOrder="30" resource="Vendorname_Syncfromshopify::sync_product" action="syncproductshopify/syncproduct/" />
</menu>
</config>
My controller is
app/code/Vendorname/Syncfromshopify/Controller/Adminhtml/Syncproduct/Index.php
namespace Vendorname\Syncfromshopify\Controller\Adminhtml\Syncproduct;
use Magento\Backend\App\Action\Context;
use Magento\Framework\View\ResultPageFactory;
class Index extends \Magento\Backend\App\Action
{
/**
* @var PageFactory
*/
public function execute()
{
$this->_view->loadLayout();
$this->_view->renderLayout();
}
}
My above controller is working fine and redirecting to admin page.
Now I want to add a button (ABC name) and in action of another controller which will responsible for sync data from third party and Insert in Magento.
So How we will create new button in admin controller and give action?