I have added new checkbox called "Split by Country" as a filter in Orders Report section.
File:
vendor/magento/module-reports/Block/Adminhtml/Filter/Form.php
$fieldset->addField(
'split_by_country',
'checkbox',
[
'label' => __('Split by Country'),
'name' => 'split_by_country',
'data-form-part' => $this->getData('target_form'),
'onchange' => 'this.value = this.checked;'
]
);
Then I added a new column in grid called "Country".
File:
vendor/magento/module-reports/Block/Adminhtml/Sales/Sales/Grid.php
$this->addColumn(
'country',
[
'header' => __('Country'),
'type' => 'string',
'index' => 'country',
'sortable' => false
]
);
What I want to achieve here is, when a "Split by Country" checkbox is checked then in a grid I want to display entries order by country.
Please suggest me a solution for this.
Thank you