7

I need to override sales_order_grid.xml from ui_component of Magento_Sales.

I want to remove some part of it but I don't know how to override it, I know how to override phtml from the custom module but for ui_component I have no idea.

[EDIT]

I will have multiple admin account, I don't want them to have access to some options and also I don't want them to see useless columns. The less thing they have to do the better it is.

[EDIT2]

Ok, i find that I can make in custom module the sales_order_grid.xml file under view/adminhtml/ui_component/. So this is the file :

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="sales_order_columns">
        <column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="visible" xsi:type="boolean">false</item>
                    <item name="filter" xsi:type="string">dateRange</item>
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
                    <item name="dataType" xsi:type="string">date</item>
                    <item name="label" xsi:type="string" translate="true">Purchase Date</item>
                    <item name="dateFormat" xsi:type="string">MMM dd, YYYY, H:MM:SS A</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>

As you can see, I try to set visible to false for created_at column.

Result : The column is still here, but not the filter panel like I show here :

enter image description here

Also, when I inspect element, and I set Display: none to the table, the block is here.

4
  • What do you mean you want to overwrite parts? you know you can choose which columns show via the UI Commented Sep 19, 2017 at 14:33
  • I know, but I want to remove some part, i know it's useless but i will have multiple admin account, I don't want them to have access to some option and also I don't want them to see useless columns. The less thing they have to do the better it is. Commented Sep 19, 2017 at 14:38
  • You can create bookmarks and save profiles in it. Uncheck the columns you don't want and save it.
    – Priyank
    Commented Sep 20, 2017 at 5:07
  • I know, but that's not what i want, I will create multiple admin users, and I want them to already have the correct view, I don't want them have to change columns and save bookmark. Commented Sep 20, 2017 at 7:44

1 Answer 1

8

I was having the same issue while overriding sales_order_grid.xml from ui_component for me the below solution worked:

Add the <sequence> tag as shown in the example:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="CT_OrderCancel" setup_version="1.0.1" active="true">
        <sequence>
            <module name="Magento_Sales" />
        </sequence>
    </module>
</config>

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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