Jump to content

Add export option to group view (that's the list of customers per group)


Recommended Posts

I know how to add the export option to any admin list. It is done with `$this->allow_export=true` in the corresponding AdminController. But how can you add it to the group view, which is in fact a list of customers for that group?. If I add `$this->allow_export=true` to AdminGroupsController then the list of groups is exportable, but not the list of customers that you get when you click in a group show icon.


I looked at the source code and I saw that the list is generated with the `HelperList` class, but I didn't see anything helpful there.



Link to comment
Share on other sites

  • 3 years later...

Just setting $this->allow_export=true isn't enough. The built-in export functionality is based on only single tables and not joined results like the one asked (join means two or more tables to be scanned through). There isn't an easy way at all with the approach choosen. Simpler would be: make a SQL query which does the select and run the query from backoffice for example.

SELECT cg.id_group, c.firstname, c.lastname, c.email FROM `ps_customer_group` cg
LEFT JOIN ps_customer c on c.id_customer = cg.id_customer
ORDER BY cg.id_group

Above example does such a select and orders the result by group ID.

Link to comment
Share on other sites

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...