Jump to content
thirty bees forum

Recommended Posts

Posted

Hello everyone,

I'd like to announce new upcoming feature, and as always ask for testing and reporting any and all issues, problems, and enhancement requests.

This new functionality is names List Filters. You can test it by upgrading your store to list-filters branch (using core updater in custom targets)

image.png.6694e2b33ba598305e7d930de8a45313.png

What this new functionality do?

On every (filterable) lists in back office you will find a new icon in upper right corner:

image.png.8e3706a5be43b083ade94c9141583e19.png

When you click on it, new section will appear. Here, you can define additional filters that will be applied to the list.

image.thumb.png.b210c45fa90d3d03a342dba0055c2f10.png

The new filters are applied together with the standard filters from list header.

But these new filters are slightly more powerful, because you can select operator - not, contains, starts with, between, any of

Also, developers can define additional filters in AdminControllers that do not depend on list columns. For example, I have added new filter fields for Order list controller - (Customer - Email, Customer - First Name, Customer - Last Name). So you can filter order list by customer email, even though customer email is non one of list columns!

We will be slowly adding more and more filter fields based on your suggestions. Let us know what you need!.

This functionality is not 100% completed, but it's quite stable. I've been using it on few production servers without any issues for a few weeks now, so it should be safe for you to test it as well.

We already have a few enhancement we want to implement. One of them is support for filter presets -- you will be able to save your filter settings, and easily switch between different presets. 

Now it's your turn. Please test and give feedback. I'm sure there is a lot to improve here.

I'm very excited about this new feature, as I wanted to do have this for a few years now. And finally it's coming 🙂

 

  • Like 6
Posted

For developers here:

you can test adding your own filter fields by modifying Admin***Controller classes, using new property filters_list. This property accepts the fields in the same format as property fields_list (which is used to define list columns)

Example from AdminOrdersController:

This is all that is needed to support filtering on customer email and names:

https://github.com/thirtybees/thirtybees/blob/f59054511624de2131f86e4373604f827362468e/controllers/admin/AdminOrdersController.php#L214-L230

        $this->filters_list = [
            'customer_email' => [
                'title' => $this->l('Customer - Email'),
                'type' => 'text',
                'filter_key' => 'c!email'
            ],
            'customer_first_name' => [
                'title' => $this->l('Customer - First Name'),
                'type' => 'text',
                'filter_key' => 'c!firstname'
            ],
            'customer_last_name' => [
                'title' => $this->l('Customer - Last Name'),
                'type' => 'text',
                'filter_key' => 'c!lastname'
            ],
        ];

 

 

Posted
21 hours ago, DRMasterChief said:

Interesting possibility, I don't have a use for it that I can think of yet, but as always, thanks for your work and i will test it!

There are a lot of use cases, but I guess it depends on what needs you have. For example, we have recently used this feature to find all products within certain profit margin range. 

Posted (edited)

Thanks a lot for this new feature! It will be very helpful. Something similair was on my ToDo list as well 😏

I will have break in early april. Afterwards I will update our system to new PHP version and will also upgrade again to bleeding edge. Then I can test it with my live site 🤩

Edited by wakabayashi
  • 1 month later...
Posted

I am now playing around with this... What is the technique behind it, where are the filter values saved? In cookies? 

With a pretty basic list of my module, it seems to work fine. With a very complex list, I get the following:

image.thumb.png.2d5bc79890c37e922f63ea0e2e64e050.png

Posted

Thanks for testing

14 hours ago, wakabayashi said:

I am now playing around with this... What is the technique behind it, where are the filter values saved? In cookies? 

Yes, so far the values are saved in cookies. However, there is now an abstraction (ListViewStorage interface) that will make it possible to save filter values differently in the future. It's a todo task that I would like to implement soon. With this in place, cookies will be much smaller, and we will be able to implement additional features like saved filter presets. I think that will make this quite useful

14 hours ago, wakabayashi said:

With a pretty basic list of my module, it seems to work fine. With a very complex list, I get the following...

Thanks for bug report. I believe I have fixed this - could you please re-test on latest version of this branch? If you still get the error, please send me a controller class, so I can figure out what is wrong.

  • Thanks 1
Posted

Thanks you very much. It works now 👍 This feature will be so great, love it. Especially, if we can save presets. 🤩

As I had this functionality in mind too. I wonder about something. Why do you implement the new $this->filters_list? I wanted to add this functionality $this->fields_list, then I would also allow an employee to select the columns he wants to display. He could then save the columns and also filters. 

IMO this would help merchants to customize their list to their needs even further. They can just hide unnecessary stuff and as a dev we can add more columns, without having to think a lot about "is it too much". 

A module like orderlistcarriers would just be obsolete with a few lines of code. Also your example with the customer email would be good. Maybe some merchants would like to see in orders list!?

I hope you get my proposal. Maybe I don't see the drawbacks!? 😊 

  • Like 1
Posted

I've added the option to set columns as hidden by default. When you create list column, you can pass 'hidden' => true, and thirtybees will not show it by default. Here's example:

https://github.com/thirtybees/thirtybees/blob/f27320165d9e788af9f702af547adaaed6e0db90/controllers/admin/AdminOrdersController.php#L179

Once we implement list column customization, we will be able to show those default hidden columns, hide columns that are displayed by default, or even reorder columns in the list.

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...