Jump to content

Automatically assign a group during customer creation - Prestashop 1.6


Sandro Cianfarani

Recommended Posts

Hi everyone,

I am new to the Forum and to Prestashop, as I come from other development experiences on other CMS always LAMP.

My requirement is as follows: on a Prestashop 1.6 installation, I have to make sure that if a customer with a VAT number registers, they will be assigned a customer group X by default, in order to immediately have reserved prices (business customer)

I know there are modules, but this platform has been customized and so I would like to avoid messing around; I have identified the query that allows me to update the ps_customer_group and ps_customer tables with their joins with ps_address to verify the presence of the VAT number.

What I don't know how to do and I kindly ask you for help is to understand where to insert these instructions and in what way; i guess something like, following the creation of the address execute this block of code in php which executes the that.

 

Thanks to all for the precious collaboration.

Link to comment
Share on other sites

Hi uzishabab,

have you an example in php code?

This is the query:

UPDATE ps_customer INNER JOIN ps_address ON ps_address.id_customer = ps_customer.id_customer
SET ps_customer.id_default_group=6 WHERE ps_address.vat_number <>'' AND ps_address.id_customer=4611

INSERT INTO ps_customer_group (4611,6)

Thanks

Edited by Sandro Cianfarani (see edit history)
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...