I want to add another action in the grid for the sales in Magento back end

The actions are defined in modules-sales\Ui\Component\Listing\Column\ViewAction.php

So i want to override this file , But how can i override ?

  • Did you try with DI? – Khoa TruongDinh Dec 26 '16 at 14:24
  • How do you do it with the DI.xml ? – Killian Dec 26 '16 at 14:30
  • Take a look my answer. – Khoa TruongDinh Dec 28 '16 at 2:02

1) We can build our own View Action class by "overriding" the action column.


<?xml version="1.0" encoding="UTF-8"?>

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    <columns name="sales_order_columns">
        <actionsColumn name="actions" class="Vendor\Sales\Ui\Component\Listing\Column\ViewAction">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="indexField" xsi:type="string">entity_id</item>
                    <item name="viewUrlPath" xsi:type="string">sales/order/view</item>
                    <item name="urlEntityParamName" xsi:type="string">order_id</item>

Build our own view Action class: app/code/Vendor/Sales/Ui/Component/Listing/Column/ViewAction.php

2) Or can override Magento\Sales\Ui\Component\Listing\Column\ViewAction class. (Not test yet, but not recommend)


<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    <preference for="Magento\Sales\Ui\Component\Listing\Column\ViewAction"
                type="Vendor\Sales\Ui\Component\Listing\Column\ViewAction" />
  • You tried with 2nd solution? – Khoa TruongDinh Dec 28 '16 at 9:17
  • Nope , I didn't try it – Killian Dec 28 '16 at 12:48
  • Ha..ha.. I will try it myself. – Khoa TruongDinh Dec 28 '16 at 12:49
  • If I want to change label of column from ID to Order# then what to do? @KhoaTruongDinh – Ronak Chauhan May 13 '17 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.