How to add custom column as link in sales order grid in magento 2 Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Magento 2 How to Add a New Column to Orders Gridadd button inside custom column in sales order grid pagemagento Add Coupon code at sales order gridHow to obtain customer attribute in sales order grid?Join sales/order and ordered items in grid column render Magento 2customer mail is not showing in custom sales gridMagento 2 Filter not working while Custom column added on Sales Grid Using Ui ComponentAdd custom dynamic column in sales order grid Magento 2add button inside custom column in sales order grid pageAdd custom column and filter to customer grid from joined table in magento 2how to add Custom column with link in sales order grid magentoHOW TO ADD COLUMN TO 'Order Total Report' GRID and display custom customer data to new column in magento 2?

What is "gratricide"?

Selecting user stories during sprint planning

Why aren't air breathing engines used as small first stages?

How much damage would a cupful of neutron star matter do to the Earth?

How often does castling occur in grandmaster games?

Hangman Game with C++

The code below, is it ill-formed NDR or is it well formed?

Using audio cues to encourage good posture

Can the Great Weapon Master feat's damage bonus and accuracy penalty apply to attacks from the Spiritual Weapon spell?

Is there hard evidence that the grant peer review system performs significantly better than random?

If Windows 7 doesn't support WSL, then what does Linux subsystem option mean?

How come Sam didn't become Lord of Horn Hill?

How does light 'choose' between wave and particle behaviour?

Drawing without replacement: why is the order of draw irrelevant?

Can a new player join a group only when a new campaign starts?

Disembodied hand growing fangs

Take 2! Is this homebrew Lady of Pain warlock patron balanced?

Why do we need to use the builder design pattern when we can do the same thing with setters?

What was the first language to use conditional keywords?

How do living politicians protect their readily obtainable signatures from misuse?

Why should I vote and accept answers?

Effects on objects due to a brief relocation of massive amounts of mass

Trademark violation for app?

Should I use a zero-interest credit card for a large one-time purchase?



How to add custom column as link in sales order grid in magento 2



Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Magento 2 How to Add a New Column to Orders Gridadd button inside custom column in sales order grid pagemagento Add Coupon code at sales order gridHow to obtain customer attribute in sales order grid?Join sales/order and ordered items in grid column render Magento 2customer mail is not showing in custom sales gridMagento 2 Filter not working while Custom column added on Sales Grid Using Ui ComponentAdd custom dynamic column in sales order grid Magento 2add button inside custom column in sales order grid pageAdd custom column and filter to customer grid from joined table in magento 2how to add Custom column with link in sales order grid magentoHOW TO ADD COLUMN TO 'Order Total Report' GRID and display custom customer data to new column in magento 2?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I wish to add a column as link in sales order grid. While clicking the link, I wish to perform some logic,



I have reffered the below link for magento 1 which is based on layout grid
add button inside custom column in sales order grid page



I need the same solution for magento 2



Many blogs are available to add custom column in sales order grid, but no luck



Thanks in advance










share|improve this question






















  • Refer this - magento.stackexchange.com/questions/134754/…

    – Vinoth S
    Apr 15 at 5:23











  • Did you get it?

    – Mano M
    Apr 15 at 7:32











  • Thanks for your response,Let you know once i get

    – Jaisa
    Apr 15 at 7:33

















1















I wish to add a column as link in sales order grid. While clicking the link, I wish to perform some logic,



I have reffered the below link for magento 1 which is based on layout grid
add button inside custom column in sales order grid page



I need the same solution for magento 2



Many blogs are available to add custom column in sales order grid, but no luck



Thanks in advance










share|improve this question






















  • Refer this - magento.stackexchange.com/questions/134754/…

    – Vinoth S
    Apr 15 at 5:23











  • Did you get it?

    – Mano M
    Apr 15 at 7:32











  • Thanks for your response,Let you know once i get

    – Jaisa
    Apr 15 at 7:33













1












1








1








I wish to add a column as link in sales order grid. While clicking the link, I wish to perform some logic,



I have reffered the below link for magento 1 which is based on layout grid
add button inside custom column in sales order grid page



I need the same solution for magento 2



Many blogs are available to add custom column in sales order grid, but no luck



Thanks in advance










share|improve this question














I wish to add a column as link in sales order grid. While clicking the link, I wish to perform some logic,



I have reffered the below link for magento 1 which is based on layout grid
add button inside custom column in sales order grid page



I need the same solution for magento 2



Many blogs are available to add custom column in sales order grid, but no luck



Thanks in advance







magento2.2.6 order-grid link custom-column-grid






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 15 at 5:11









JaisaJaisa

9061939




9061939












  • Refer this - magento.stackexchange.com/questions/134754/…

    – Vinoth S
    Apr 15 at 5:23











  • Did you get it?

    – Mano M
    Apr 15 at 7:32











  • Thanks for your response,Let you know once i get

    – Jaisa
    Apr 15 at 7:33

















  • Refer this - magento.stackexchange.com/questions/134754/…

    – Vinoth S
    Apr 15 at 5:23











  • Did you get it?

    – Mano M
    Apr 15 at 7:32











  • Thanks for your response,Let you know once i get

    – Jaisa
    Apr 15 at 7:33
















Refer this - magento.stackexchange.com/questions/134754/…

– Vinoth S
Apr 15 at 5:23





Refer this - magento.stackexchange.com/questions/134754/…

– Vinoth S
Apr 15 at 5:23













Did you get it?

– Mano M
Apr 15 at 7:32





Did you get it?

– Mano M
Apr 15 at 7:32













Thanks for your response,Let you know once i get

– Jaisa
Apr 15 at 7:33





Thanks for your response,Let you know once i get

– Jaisa
Apr 15 at 7:33










1 Answer
1






active

oldest

votes


















1














I have created one column as "sku" in a custom grid. It displays SKU as a link and also its redirect into view page.



In XML:



<column name="sku" class="XXXMovementsUiComponentListingColumnsProduct">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
<item name="filter" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Sku</item>
<item name="sortable" xsi:type="boolean">false</item>
</item>
</argument>
</column>


In Product.php:



<?php

namespace XXXMovementsUiComponentListingColumns;

use MagentoFrameworkViewElementUiComponentFactory;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoCatalogModelProductFactory as ProductCollection;
use MagentoUiComponentListingColumnsColumn;

class Product extends Column


/**
* @var ProductFactory
*/
protected $_product;

public function __construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, ProductCollection $product, array $components = [], array $data = [])

$this->_product = $product;
parent::__construct($context, $uiComponentFactory, $components, $data);


/**
* Prepare Data Source
*
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource)

if (isset($dataSource['data']['items']))
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item)
if (isset($item[$fieldName]))
$productId = $this->_product->create()->getIdBySku($item[$fieldName]);
$html = "<a href='" . $this->context->getUrl('catalog/product/edit', ['id' => $productId]) . "'>";
$html .= $item[$fieldName];
$html .= "</a>";
$item[$fieldName] = $html;




return $dataSource;





It may be helpful for your scenario.






share|improve this answer

























  • if you can add some info (explanation) in your answer it would be better. Please clarify as well in which xml file should the code above be added.

    – magefms
    Apr 15 at 6:45











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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270045%2fhow-to-add-custom-column-as-link-in-sales-order-grid-in-magento-2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














I have created one column as "sku" in a custom grid. It displays SKU as a link and also its redirect into view page.



In XML:



<column name="sku" class="XXXMovementsUiComponentListingColumnsProduct">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
<item name="filter" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Sku</item>
<item name="sortable" xsi:type="boolean">false</item>
</item>
</argument>
</column>


In Product.php:



<?php

namespace XXXMovementsUiComponentListingColumns;

use MagentoFrameworkViewElementUiComponentFactory;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoCatalogModelProductFactory as ProductCollection;
use MagentoUiComponentListingColumnsColumn;

class Product extends Column


/**
* @var ProductFactory
*/
protected $_product;

public function __construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, ProductCollection $product, array $components = [], array $data = [])

$this->_product = $product;
parent::__construct($context, $uiComponentFactory, $components, $data);


/**
* Prepare Data Source
*
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource)

if (isset($dataSource['data']['items']))
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item)
if (isset($item[$fieldName]))
$productId = $this->_product->create()->getIdBySku($item[$fieldName]);
$html = "<a href='" . $this->context->getUrl('catalog/product/edit', ['id' => $productId]) . "'>";
$html .= $item[$fieldName];
$html .= "</a>";
$item[$fieldName] = $html;




return $dataSource;





It may be helpful for your scenario.






share|improve this answer

























  • if you can add some info (explanation) in your answer it would be better. Please clarify as well in which xml file should the code above be added.

    – magefms
    Apr 15 at 6:45















1














I have created one column as "sku" in a custom grid. It displays SKU as a link and also its redirect into view page.



In XML:



<column name="sku" class="XXXMovementsUiComponentListingColumnsProduct">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
<item name="filter" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Sku</item>
<item name="sortable" xsi:type="boolean">false</item>
</item>
</argument>
</column>


In Product.php:



<?php

namespace XXXMovementsUiComponentListingColumns;

use MagentoFrameworkViewElementUiComponentFactory;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoCatalogModelProductFactory as ProductCollection;
use MagentoUiComponentListingColumnsColumn;

class Product extends Column


/**
* @var ProductFactory
*/
protected $_product;

public function __construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, ProductCollection $product, array $components = [], array $data = [])

$this->_product = $product;
parent::__construct($context, $uiComponentFactory, $components, $data);


/**
* Prepare Data Source
*
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource)

if (isset($dataSource['data']['items']))
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item)
if (isset($item[$fieldName]))
$productId = $this->_product->create()->getIdBySku($item[$fieldName]);
$html = "<a href='" . $this->context->getUrl('catalog/product/edit', ['id' => $productId]) . "'>";
$html .= $item[$fieldName];
$html .= "</a>";
$item[$fieldName] = $html;




return $dataSource;





It may be helpful for your scenario.






share|improve this answer

























  • if you can add some info (explanation) in your answer it would be better. Please clarify as well in which xml file should the code above be added.

    – magefms
    Apr 15 at 6:45













1












1








1







I have created one column as "sku" in a custom grid. It displays SKU as a link and also its redirect into view page.



In XML:



<column name="sku" class="XXXMovementsUiComponentListingColumnsProduct">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
<item name="filter" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Sku</item>
<item name="sortable" xsi:type="boolean">false</item>
</item>
</argument>
</column>


In Product.php:



<?php

namespace XXXMovementsUiComponentListingColumns;

use MagentoFrameworkViewElementUiComponentFactory;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoCatalogModelProductFactory as ProductCollection;
use MagentoUiComponentListingColumnsColumn;

class Product extends Column


/**
* @var ProductFactory
*/
protected $_product;

public function __construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, ProductCollection $product, array $components = [], array $data = [])

$this->_product = $product;
parent::__construct($context, $uiComponentFactory, $components, $data);


/**
* Prepare Data Source
*
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource)

if (isset($dataSource['data']['items']))
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item)
if (isset($item[$fieldName]))
$productId = $this->_product->create()->getIdBySku($item[$fieldName]);
$html = "<a href='" . $this->context->getUrl('catalog/product/edit', ['id' => $productId]) . "'>";
$html .= $item[$fieldName];
$html .= "</a>";
$item[$fieldName] = $html;




return $dataSource;





It may be helpful for your scenario.






share|improve this answer















I have created one column as "sku" in a custom grid. It displays SKU as a link and also its redirect into view page.



In XML:



<column name="sku" class="XXXMovementsUiComponentListingColumnsProduct">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
<item name="filter" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Sku</item>
<item name="sortable" xsi:type="boolean">false</item>
</item>
</argument>
</column>


In Product.php:



<?php

namespace XXXMovementsUiComponentListingColumns;

use MagentoFrameworkViewElementUiComponentFactory;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoCatalogModelProductFactory as ProductCollection;
use MagentoUiComponentListingColumnsColumn;

class Product extends Column


/**
* @var ProductFactory
*/
protected $_product;

public function __construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, ProductCollection $product, array $components = [], array $data = [])

$this->_product = $product;
parent::__construct($context, $uiComponentFactory, $components, $data);


/**
* Prepare Data Source
*
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource)

if (isset($dataSource['data']['items']))
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item)
if (isset($item[$fieldName]))
$productId = $this->_product->create()->getIdBySku($item[$fieldName]);
$html = "<a href='" . $this->context->getUrl('catalog/product/edit', ['id' => $productId]) . "'>";
$html .= $item[$fieldName];
$html .= "</a>";
$item[$fieldName] = $html;




return $dataSource;





It may be helpful for your scenario.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 15 at 6:50

























answered Apr 15 at 6:33









Mano MMano M

1,087219




1,087219












  • if you can add some info (explanation) in your answer it would be better. Please clarify as well in which xml file should the code above be added.

    – magefms
    Apr 15 at 6:45

















  • if you can add some info (explanation) in your answer it would be better. Please clarify as well in which xml file should the code above be added.

    – magefms
    Apr 15 at 6:45
















if you can add some info (explanation) in your answer it would be better. Please clarify as well in which xml file should the code above be added.

– magefms
Apr 15 at 6:45





if you can add some info (explanation) in your answer it would be better. Please clarify as well in which xml file should the code above be added.

– magefms
Apr 15 at 6:45

















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270045%2fhow-to-add-custom-column-as-link-in-sales-order-grid-in-magento-2%23new-answer', 'question_page');

);

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







Popular posts from this blog

Sum ergo cogito? 1 nng

419 nièngy_Soadمي 19bal1.5o_g

89ABb ge:tosc0.Ss D z NWw IinKBT:sVv sq8Oo EehesnJj an_ofsssp 2ldeYyBi Z123 Rrg1000c_04C0 4 Z lamme0ec040 YyFf t Un Kleww XP89d 9cEe34Gns 12g H450 LG Jj1 Pk Lsilo Pj 5 TG V Jb Hv xX50Ff e88saIZz Eer d67 Aad25xad X Fl MealVv s T WrAa Ww j Bb key co753Jj ssaann67 Jj D 67Kz