I would like to add a column after "Product" to have a link to the product on the front end so it is easy to identify the product. Nearly all our products are one off items so I'm looking for an easy way to identify which product exactly the person has ordered, which the front end view of the product provides.
I followed the instructions here https://github.com/magento/magento2/pull/11076, which I found from here Magento2 How to custom column in sales order item renderer in admin order view and I'm getting an error stating my template is invalid
1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Vendor_Module::test.phtml' in module: 'Magento_Sales' block's name: 'column_test_column'
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Vendor_Module::test.phtml' in module: 'Magento_Sales' block's name: 'column_test_column'
#0 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Element\Template->fetchView(false)
#1 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn\Interceptor->___callParent('fetchView', Array)
#2 /var/www/html/magento/vendor/salesigniter/releasedamagewaiver2/Plugin/Catalog/Template.php(84): Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn\Interceptor->Magento\Framework\Interception\{closure}(false)
That continues on for some time.
So for the sales_order_view.xml, what have I got wrong?
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="order_items">
<arguments>
<argument name="columns" xsi:type="array">
<item name="test_column" xsi:type="string" translate="true">Test Header</item>
</argument>
</arguments>
<referenceBlock name="default_order_items_renderer">
<arguments>
<argument name="columns" xsi:type="array">
<item name="test_column" xsi:type="string" translate="true">col-test</item>
</argument>
</arguments>
</referenceBlock>
<block class="Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn"
name="column_test_column"
template="Vendor_Module::test.phtml" group="column" />
</referenceBlock>
</body>
</page>
My test.phtml, as the link above has, simply had "test column" within it, no more code/text.
Secondly, how can I pull the url of the product on the frontend to put in this column? Is there a way I can grab the product id stored in the product_id column of the sales_order_item table to use this to get the front end url? As I haven't been able to get past the custom column step I haven't been able to try getting the url but would love any advice.