cancel
Showing results for 
Search instead for 
Did you mean: 

Add custom column in admin grid

SOLVED

Add custom column in admin grid

Hi,
sorry for this maybe strange sounding question to the experts of you. I am working on M 2.2 CE

I added several actions to the sales_order_grid. Works fine so far, I see the items in the menu:

app/code/Hebein /Shipper/view/adminhtml/ui_component/sales_order_grid.xml

<?xml version="1.0"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_$
    <listingToolbar name="listing_top">
        <massaction name="listing_massaction">
            <action name="send_dhl">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="type" xsi:type="string">send_dhl</item>
                        <item name="label" xsi:type="string" translate="true">Versand DHL</item>
                        <item name="url" xsi:type="url" path="massemailcustomers/email/massSendDHL"/>
                        <item name="confirm" xsi:type="array">
                            <item name="title" xsi:type="string" translate="true">Versand mit DHL?</item>
                            <item name="message" xsi:type="string" translate="true">Wollen Sie die ausgewählten Objekte wirklich mi$
                        </item>
                    </item>
                </argument>
            </action>
            <action name="send_dpd">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="type" xsi:type="string">send_dpd</item>
                        <item name="label" xsi:type="string" translate="true">Versand DPD</item>
                        <item name="url" xsi:type="url" path="massemailcustomers/email/massSendDPD"/>
                        <item name="confirm" xsi:type="array">
                            <item name="title" xsi:type="string" translate="true">Versand mit DPD?</item>
                            <item name="message" xsi:type="string" translate="true">Wollen Sie die ausgewählten Objekte wirklich mi$
                        </item>
                    </item>
                </argument>
            </action>
 <action name="send_pta">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="type" xsi:type="string">send_pta</item>
                        <item name="label" xsi:type="string" translate="true">Versand POST</item>
                        <item name="url" xsi:type="url" path="massemailcustomers/email/massSendPTA"/>
                        <item name="confirm" xsi:type="array">
                            <item name="title" xsi:type="string" translate="true">Versand mit POST?</item>
                            <item name="message" xsi:type="string" translate="true">Wollen Sie die ausgewählten Objekte wirklich mi$
                        </item>
                    </item>
                </argument>
            </action>
 <action name="send_auto">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="type" xsi:type="string">send_auto</item>
                        <item name="label" xsi:type="string" translate="true">Versand AUTOMATIK</item>
                        <item name="url" xsi:type="url" path="massemailcustomers/email/massSendAUTO"/>
                        <item name="confirm" xsi:type="array">
                            <item name="title" xsi:type="string" translate="true">Versand AUTOMATISCH?</item>
                            <item name="message" xsi:type="string" translate="true">Wollen Sie die ausgewählten Objekte wirklich **$
                        </item>
                    </item>
                </argument>
            </action>
 <action name="print_all_docs">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="type" xsi:type="string">print_all_docs</item>
                        <item name="label" xsi:type="string" translate="true">DRUCKEN Alle Dokumente</item>
                        <item name="url" xsi:type="url" path="massemailcustomers/email/massPRINT"/>
                        <item name="confirm" xsi:type="array">
                            <item name="title" xsi:type="string" translate="true">ALLES DRUCKEN?</item>
                            <item name="message" xsi:type="string" translate="true">Wollen Sie die ausgewählten Objekte wirklich DR$
                        </item>
                    </item>
                </argument>
            </action>


        </massaction>

     </listingToolbar>
</listing>


But: How can I connect the action to a php that should be executed? How do I reference from

(Actually I would like to save all orders that are selected to a csv).


I found many examples, but I do not understand how action and reaction are connected.

Anybody who could explain that to me?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Add custom column in admin grid

Thanks for your help.
After adding router, everything worked fine Smiley Happy

View solution in original post

4 REPLIES 4

Re: Add custom column in admin grid

hi @kornblumenapo

i already posted the solution regarding this just follow it

Magento 2 mass action to admin grid

Find helpful ? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!"
Qaisar Satti

Re: Add custom column in admin grid

Dear Qaisar,

I saw your solution, but I have so many questions...
How do you reference / link from xml to the php. Where is the code for that?

Why is the php called MassAction.php? Could I call it HelloWorld.php as well?
Where do I put the Massaction.php? (Directory)?

 

Regards,
Gunther

Re: Add custom column in admin grid

@kornblumenapo

Follow this tutorial to How to create admin controller. Then you will able to understand how the admin link work.

Find helpful ? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!"
Qaisar Satti

Re: Add custom column in admin grid

Thanks for your help.
After adding router, everything worked fine Smiley Happy