0

Hello guys I need your help to know how to add new column "tracking/mobile number" to sales grid.

  • Try with this i haven't checked this but please try. – Naveenbos May 9 '17 at 6:37
0

if this mobile column is already available in sales_order_grid table then just copy this file into you custom module Magento\Sales\view\adminhtml\ui_component\sales_order_grid.xml to Vendor\Module\view\adminhtml\ui_component\sales_order_grid.xml

Now inside Vendor\Module\view\adminhtml\ui_component\sales_order_grid.xml file add the below line.

<column name="mobile" >
        <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">text</item>
                <item name="label" xsi:type="string" translate="true">Mobile</item>
            </item>
        </argument>
    </column> 

the above code will come under-

<columns name="sales_order_columns">
    ....
    .....
</columns>

mobile is column name in you database

  • Hi Mohammad, i tried this its show mobile field but empty. Do you have any idea how to call it? Thank you – MagEGY May 9 '17 at 13:43
  • did you check if mobile field is available in sales_order_grid table. – Mohammad Mujassam May 9 '17 at 15:15
  • No its not available in sales_order_grid table i found it inside sales_order_address table under telephone name So the question now how to tell xml file call data from sales_order_address – MagEGY May 9 '17 at 21:07
  • Joining two tables just for one field is not good idea instead add new column in sales_order_grid and insert the data in that column after order is placed. still if you want to join you can refer this question. magento.stackexchange.com/questions/123198/… – Mohammad Mujassam May 10 '17 at 4:42
  • I dont prefers this way also but i cant do it without joining. do you have any idea how to insert column from sales_order_address and sales_shipment_track to sales_order_grid to be able to call it inside order grid ? – MagEGY May 10 '17 at 21:39

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.