1

I'm trying to add a new section in the Company User grid, accessible through an new filter (next to the existing ones : Show Active Users | Show Inactive Users)

The new filter is based upon a custom field that I added company_advanced_customer_entity

I see that in company_users_listing.xml filters are defined like so :

<filters name="listing_filters" class="Magento\Company\Ui\Component\Filters\Status" ...

Code:

class Status extends \Magento\Ui\Component\Filters {
public function prepare()
{
    parent::prepare();
    $config = $this->getData('config');
    if (isset($config['params']) && is_array($config['params'])) {
        $config['params']['statusActive'] = \Magento\Company\Api\Data\CompanyCustomerInterface::STATUS_ACTIVE;
        $config['params']['statusInactive'] = \Magento\Company\Api\Data\CompanyCustomerInterface::STATUS_INACTIVE;
        $this->setData('config', $config);
    }
}

but I don't understand how it works, will I have to rewrite \Status or should I create my another Filter and put it somewhere in the listing ?

UPDATE

In the mean time I added a new statusPending state to the native Status:

$config['params']['statusPending'] = \Vendor\Module\Helper\Account\Process::CUSTOMER_COMPANY_PENDING_STATUS_PENDING;

and had to add it in several places :

  • Magento\Company\Ui\Component\Listing\Column\CustomerStatus
  • Magento\Company\Model\Customer\Source\Status

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.