I want to add a button to the order view called "Print label" and when clicked it will generate and download a text file. So here is the steps I think I should do:
- Create button: How do pass order id + use urlbuilder to make a link?)
- Create a controller that genereates the file (I am familiar with making controllers)
I have already added a button (and a controller) to the sales order grid for another purpose but do not know how to add one to the sales order view:
Vendor/Module/etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Vendor_Module::packinglist" title="Packinglist" module="Vendor_Module" parent="Magento_Sales::sales_operation" action="packinglist/packinglist" resource="Vendor_Module::packinglist"/>
</menu>
</config>
I have tried this guide but I do not know how to make a link and Ithink I rather us above method to add a button.