Sandro Cianfarani Posted September 21, 2020 Share Posted September 21, 2020 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 More sharing options...
Shabab Posted September 21, 2020 Share Posted September 21, 2020 Hi, Do you have vat field on customer registration form ? Can you send screenshot of customer form registration ? Link to comment Share on other sites More sharing options...
Sandro Cianfarani Posted September 21, 2020 Author Share Posted September 21, 2020 Hi. This the screenshot: Link to comment Share on other sites More sharing options...
Shabab Posted September 21, 2020 Share Posted September 21, 2020 You need to override Addrees class for this . Link to comment Share on other sites More sharing options...
Sandro Cianfarani Posted September 21, 2020 Author Share Posted September 21, 2020 (edited) 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 September 21, 2020 by Sandro Cianfarani (see edit history) Link to comment Share on other sites More sharing options...
Sandro Cianfarani Posted September 22, 2020 Author Share Posted September 22, 2020 Can anyone help me understand or suggest a solution? Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now