Page 1 of 4

Create customers in admin & assign categories to users

Posted: Tue Jun 21, 2022 2:35 pm
by LeeFoster
I'm looking for 2 addons for a site I'm working on.

1. Create Customers from admin
2. Assign Categories to Customers

Number 1 is pretty self explanatory, number 2 I would like to have some categories show to specific customers.

Before I start working on these does anyone know of anything similar that already exists?

Re: Create customers in admin & assign categories to users

Posted: Tue Jun 21, 2022 4:46 pm
by raiwa
1.: There was an addon in the old marketplace "Create Account & Manual Order Maker" which was linked to the old order editor. You could use the part of create account as a starting point.
2..: If you wish to assign categories to customer groups, it should be possible to extend my Wholesale addon to assign categories to wholesale group(s). If you need it for individual customers/different categories for each customer, it's not useful.

Re: Create customers in admin & assign categories to users

Posted: Tue Jun 21, 2022 5:38 pm
by burt
I haven't tried, but in recent versions of Phoenix, the admin pages are sort of modular using views and actions. So you may be able to add in a new view in the customers.php page?

A bit like editing an existing customer? You would just be "editing" a blank customer.

As I say, untried.

Re: Create customers in admin & assign categories to users

Posted: Tue Jun 21, 2022 7:46 pm
by LeeFoster
raiwa wrote: Tue Jun 21, 2022 4:46 pm 2..: If you wish to assign categories to customer groups, it should be possible to extend my Wholesale addon to assign categories to wholesale group(s). If you need it for individual customers/different categories for each customer, it's not useful.
No it's single category single customer.
burt wrote: Tue Jun 21, 2022 5:38 pm I haven't tried, but in recent versions of Phoenix, the admin pages are sort of modular using views and actions. So you may be able to add in a new view in the customers.php page?

A bit like editing an existing customer? You would just be "editing" a blank customer.

As I say, untried.
Will have a look into this tomorrow

Re: Create customers in admin & assign categories to users

Posted: Wed Jun 22, 2022 9:26 am
by LeeFoster
LeeFoster wrote: Tue Jun 21, 2022 2:35 pm 2. Assign Categories to Customers
Working on this first, I have the drop down to select a category hooked in. I'm struggling to see how to process this into the database though. Normally I'd have used the hook for updateAction but this doesn't exist in customers.php at the moment.

Any suggestions appreciated.

Site is Phoenix 1.0.8.14 for reference.

Re: Create customers in admin & assign categories to users

Posted: Wed Jun 22, 2022 9:34 am
by Kofod95
onchange=this.form.submit()?

//Daniel

Re: Create customers in admin & assign categories to users

Posted: Wed Jun 22, 2022 9:44 am
by LeeFoster
Thought I'd share a list of things I think I'm going to need to do and hopefully cross them off as I go. Happy to listen to ideas on how to achieve some of these.

1. Create hook to add categories to customer.
2. Add category type (private, public etc).
3. Create table - customers_to_categories
4. Create hook to hide "private" categories.

Re: Create customers in admin & assign categories to users

Posted: Wed Jun 22, 2022 10:03 am
by ecartz
LeeFoster wrote: Wed Jun 22, 2022 9:26 am Normally I'd have used the hook for updateAction but this doesn't exist in customers.php at the moment.
Have you tried it? There are hook listeners for both the actions processed by admin/customers.php : updateAction and deleteConfirmAction

But it would probably make more sense to create a new action, as update won't work for a customer who doesn't exist.

Re: Create customers in admin & assign categories to users

Posted: Wed Jun 22, 2022 10:18 am
by LeeFoster
ecartz wrote: Wed Jun 22, 2022 10:03 am
Have you tried it? There are hook listeners for both the actions processed by admin/customers.php : updateAction and deleteConfirmAction

But it would probably make more sense to create a new action, as update won't work for a customer who doesn't exist.
I haven't tried it, I didn't know there were listeners for it that would work without there being an actual hook in the file.

Re: Create customers in admin & assign categories to users

Posted: Wed Jun 22, 2022 11:08 am
by LeeFoster
This
LeeFoster wrote: Wed Jun 22, 2022 9:44 am 1. Create hook to add categories to customer.
And this
LeeFoster wrote: Wed Jun 22, 2022 9:44 am 3. Create table - customers_to_categories
Are now done and working for existing customers. It is configured to use check boxes to allow multiple categories to be selected for each customer.

Next on to
LeeFoster wrote: Wed Jun 22, 2022 9:44 am 2. Add category type (private, public etc).
@ecartz are there any listeners I can use on catalog.php?