I am trying to reorder the order mass action menu, I can change the Magento menu options in
/vendor/magento/module-sales/view/adminhtml/ui_component/sales_order_grid.xml
but I want to put some of my Modules at the top of the list and I cant figure out what template or xml file I need to change
Thanks
HI @miller75,
but I want to put some of my Modules at the top of the list and I cant figure out what template or xml file I need to change
VT: What do you mean? Do you want any any different link in Top navigation menu?
If poosible please share screenshot.
OR
IF you want add some more action from your custom modules on the top then you will found same file in that custom modules/extension as well.
MODULE PATH/view/adminhtml/ui_component/sales_order_grid.xml
There you can add sort order in the action list.
<item name="sortOrder" xsi:type="number">10</item>
You can change number as per your required sequence.
I hope it will help you!
For example Print Orders is a 3rd party extension and I want this at the top of the list
Hi @miller75,
Got it, I just added my comment in the same post.
Please try once.
For example :
<?xml version="1.0" encoding="UTF-8"?> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Ui/etc/ui_configuration.xsd"> <container name="listing_top"> <massaction name="listing_massaction"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="actions" xsi:type="array"> <item name="delete" xsi:type="array"> <item name="type" xsi:type="string">delete</item> <item name="label" xsi:type="string" translate="true">Delete</item> <item name="url" xsi:type="string">sales/order/massDelete</item> <item name="sortOrder" xsi:type="number">10</item> </item> </item> </item> </argument> </massaction> </container> </listing>
Thanks for the reply, I have tried adding the sort order but it doesn't change anything
Did you flushed the cache after change?
php bin/magento cache:flush
Yes flushed the cache, does it make a difference that I am on 2.3.2?
This can be done using a plugin:
adminhtml/di.xml:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Ui\Component\MassAction"> <plugin name="CustomVendor_CustomActions::sort_actions" type="CustomVendor\CustomActions\Plugin\Component\MassAction" sortOrder="100"/> </type> </config>
Plugin\Component\MassAction.php
<?php namespace CustomVendor\CustomAction\Plugin\Component; use Magento\Framework\App\RequestInterface; class MassAction { /** @var RequestInterface */ private $_request; /** * MassAction constructor. * @param RequestInterface $request */ public function __construct( RequestInterface $request ) { $this->_request = $request; } /** * @param ComponentMassAction $massAction */ public function afterPrepare(ComponentMassAction $massAction) { if ($this->_request->getFullActionName() === 'sales_order_index') { $config = $massAction->getData('config'); if (isset($config['actions']) && $config['actions']) { $count = 0; foreach (["custom_action_1" => 0, "custom_action_2" => 1] as $actionType => $position) { /** @var $config mixed[][] */ foreach ($config['actions'] as $key => $action) { if ($action['type'] == $actionType) { $newPosition = max((int) $position, $count); $this->moveElement($config['actions'], $key, $newPosition); break; } } $count++; } $massAction->setData('config', $config); } } } /** * @param array $actions * @param int $oldPosition * @param int $newPosition */ public function moveElement(&$actions, $oldPosition, $newPosition) { $outputArray = array_splice($actions, $oldPosition, 1); array_splice($actions, $newPosition, 0, $outputArray); } }
I had no luck using module sequence or sortOrder param in XML to achieve this. Plugin is the only method that worked for me in Magento 2.4.3.
Hello.
I have a custom mass action with sub menu and all my submenu apear very low in the screen, it leaves a space between the manu and the submenu of the mass action.
Is there any way to change this. Thanks
please check the image.