Magento 2.2 - Add link to product (front end) within a custom column in sales order view items list?
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 (MagentoFrameworkExceptionValidatorException): Invalid template file: 'Vendor_Module::test.phtml' in module: 'Magento_Sales' block's name: 'column_test_column'
Exception #0 (MagentoFrameworkExceptionValidatorException): 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): MagentoFrameworkViewElementTemplate->fetchView(false)
#1 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(138): MagentoSalesBlockAdminhtmlItemsColumnDefaultColumnInterceptor->___callParent('fetchView', Array)
#2 /var/www/html/magento/vendor/salesigniter/releasedamagewaiver2/Plugin/Catalog/Template.php(84): MagentoSalesBlockAdminhtmlItemsColumnDefaultColumnInterceptor->MagentoFrameworkInterception{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="MagentoSalesBlockAdminhtmlItemsColumnDefaultColumn"
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.
magento2 adminhtml sales-order
add a comment |
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 (MagentoFrameworkExceptionValidatorException): Invalid template file: 'Vendor_Module::test.phtml' in module: 'Magento_Sales' block's name: 'column_test_column'
Exception #0 (MagentoFrameworkExceptionValidatorException): 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): MagentoFrameworkViewElementTemplate->fetchView(false)
#1 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(138): MagentoSalesBlockAdminhtmlItemsColumnDefaultColumnInterceptor->___callParent('fetchView', Array)
#2 /var/www/html/magento/vendor/salesigniter/releasedamagewaiver2/Plugin/Catalog/Template.php(84): MagentoSalesBlockAdminhtmlItemsColumnDefaultColumnInterceptor->MagentoFrameworkInterception{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="MagentoSalesBlockAdminhtmlItemsColumnDefaultColumn"
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.
magento2 adminhtml sales-order
What is the location of this test.phtml file?
– ABHISHEK TRIPATHI
1 min ago
add a comment |
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 (MagentoFrameworkExceptionValidatorException): Invalid template file: 'Vendor_Module::test.phtml' in module: 'Magento_Sales' block's name: 'column_test_column'
Exception #0 (MagentoFrameworkExceptionValidatorException): 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): MagentoFrameworkViewElementTemplate->fetchView(false)
#1 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(138): MagentoSalesBlockAdminhtmlItemsColumnDefaultColumnInterceptor->___callParent('fetchView', Array)
#2 /var/www/html/magento/vendor/salesigniter/releasedamagewaiver2/Plugin/Catalog/Template.php(84): MagentoSalesBlockAdminhtmlItemsColumnDefaultColumnInterceptor->MagentoFrameworkInterception{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="MagentoSalesBlockAdminhtmlItemsColumnDefaultColumn"
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.
magento2 adminhtml sales-order
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 (MagentoFrameworkExceptionValidatorException): Invalid template file: 'Vendor_Module::test.phtml' in module: 'Magento_Sales' block's name: 'column_test_column'
Exception #0 (MagentoFrameworkExceptionValidatorException): 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): MagentoFrameworkViewElementTemplate->fetchView(false)
#1 /var/www/html/magento/vendor/magento/framework/Interception/Interceptor.php(138): MagentoSalesBlockAdminhtmlItemsColumnDefaultColumnInterceptor->___callParent('fetchView', Array)
#2 /var/www/html/magento/vendor/salesigniter/releasedamagewaiver2/Plugin/Catalog/Template.php(84): MagentoSalesBlockAdminhtmlItemsColumnDefaultColumnInterceptor->MagentoFrameworkInterception{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="MagentoSalesBlockAdminhtmlItemsColumnDefaultColumn"
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.
magento2 adminhtml sales-order
magento2 adminhtml sales-order
asked 4 mins ago
KaiKai
254
254
What is the location of this test.phtml file?
– ABHISHEK TRIPATHI
1 min ago
add a comment |
What is the location of this test.phtml file?
– ABHISHEK TRIPATHI
1 min ago
What is the location of this test.phtml file?
– ABHISHEK TRIPATHI
1 min ago
What is the location of this test.phtml file?
– ABHISHEK TRIPATHI
1 min ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f263217%2fmagento-2-2-add-link-to-product-front-end-within-a-custom-column-in-sales-or%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f263217%2fmagento-2-2-add-link-to-product-front-end-within-a-custom-column-in-sales-or%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is the location of this test.phtml file?
– ABHISHEK TRIPATHI
1 min ago