src/Model/Order.php
public function getDefaultSearchContext()
    {
        $context = parent::getDefaultSearchContext();
        $fields = $context->getFields();

        $validStates = self::config()->placed_status;
        $statusOptions = array_filter(self::get_order_status_options(), function ($k) use ($validStates) {
            return in_array($k, $validStates);
        }, ARRAY_FILTER_USE_KEY);

        $fields->push(
            // TODO: Allow filtering by multiple statuses
            DropdownField::create('Status', $this->fieldLabel('Status'))
                ->setSource($statusOptions)
                ->setHasEmptyDefault(true)
        );

        // add date range filtering
        $fields->insertBefore(
            'Status',
            DateField::create('DateFrom', _t(__CLASS__ . '.DateFrom', 'Date from'))
        );

        $fields->insertBefore(
            'Status',
            DateField::create('DateTo', _t(__CLASS__ . '.DateTo', 'Date to'))
        );

        // get the array, to maniplulate name, and fullname seperately
        $filters = $context->getFilters();
        $filters['DateFrom'] = GreaterThanFilter::create('Placed');
        $filters['DateTo'] = LessThanFilter::create('Placed');

        // filter customer need to use a bunch of different sources
        $filters['Name'] = MultiFieldPartialMatchFilter::create(
            'FirstName',
            false,
            ['SplitWords'],
            [
                'Surname',
                'Member.FirstName',
                'Member.Surname',
                'BillingAddress.FirstName',
                'BillingAddress.Surname',
                'ShippingAddress.FirstName',
                'ShippingAddress.Surname',
            ]
        );

        $context->setFilters($filters);

        $this->extend('updateDefaultSearchContext', $context);
        return $context;
    }
public function getDefaultSearchContext()
    {
        $context = parent::getDefaultSearchContext();
        $fields = $context->getFields();

        $validStates = self::config()->placed_status;
        $statusOptions = array_filter(self::get_order_status_options(), function ($k) use ($validStates) {
            return in_array($k, $validStates);
        }, ARRAY_FILTER_USE_KEY);

        $fields->push(
            // TODO: Allow filtering by multiple statuses
            DropdownField::create('Status', $this->fieldLabel('Status'))
                ->setSource($statusOptions)
                ->setHasEmptyDefault(true)
        );

        // add date range filtering
        $fields->insertBefore(
            'Status',
            DateField::create('DateFrom', _t(__CLASS__ . '.DateFrom', 'Date from'))
        );

        $fields->insertBefore(
            'Status',
            DateField::create('DateTo', _t(__CLASS__ . '.DateTo', 'Date to'))
        );

        // get the array, to maniplulate name, and fullname seperately
        $filters = $context->getFilters();
        $filters['DateFrom'] = GreaterThanFilter::create('Placed');
        $filters['DateTo'] = LessThanFilter::create('Placed');

        // filter customer need to use a bunch of different sources
        $filters['Name'] = MultiFieldPartialMatchFilter::create(
            'FirstName',
            false,
            ['SplitWords'],
            [
                'Surname',
                'Member.FirstName',
                'Member.Surname',
                'BillingAddress.FirstName',
                'BillingAddress.Surname',
                'ShippingAddress.FirstName',
                'ShippingAddress.Surname',
            ]
        );

        $context->setFilters($filters);

        $this->extend('updateDefaultSearchContext', $context);
        return $context;
    }
Adjust scafolded search context

@return SearchContext the updated search context