0

Using Magento 2.2.5 - I have an install with many stores - ~30. In the sales order grid, the filter for 'Purchase Point' lists all the stores, but in the order they were created. Is it possible to sort the filter list by the store name rather than store_id?

In vendor/magento/module-sales/view/ui-component/sales_order_grid.xml I see the filter defined as:

<filterSelect name="store_id" provider="${ $.parentName }">
   <settings>
       <options class="Magento\Store\Ui\Component\Listing\Column\Store\Options"/>
       <caption translate="true">All Store Views</caption>
       <label translate="true">Purchase Point</label>
       <dataScope>store_id</dataScope>
       <imports>
          <link name="visible">ns = ${ $.ns }, componentType = column, index = ${ $.index }:visible</link>
       </imports>
   </settings>

What is the ${ $.parentName } in the provider? Is there a way to sort the components data with a setting? (is there a way to default this sorting across all places where the stores select is visible, or does it need to be handled for each UI_Component?)

  • Figured it out: in /vendor/magento/module-store/Ui/Component/Listing/Column/Store/Options.php, you can override the generateCurrentOptions() method and add sorting to the $websiteCollection and $storeCollection vars before they are added to the option array – dbcn Dec 19 '18 at 15:49
  • HI, Did you get a solution.? please share here. I need the same – Ask Bytes Apr 17 at 8:16
0

Figured it out: in /vendor/magento/module-store/Ui/Component/Listing/Column/Store/Options.php, you can create a class to override the generateCurrentOptions() method and add sorting to the $websiteCollection and $storeCollection vars before they are added to the option array.

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.