Duplicate Custom field on registration

  • Posts: 71
  • Thank you received: 0
10 years 7 months ago #151723

-- url of the page with the problem -- : wpb.es
-- Joomla version -- : 3.1
-- PHP version -- : 5.4
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message


Hi

How can i do to duplicate a custom field in 2 tables?
I have a custom field in table address "address_vat" (required in registration) and a custom field in user table "vat_number"

I want when a customer submit the registration form, the field address_vat is copied in vat_number (I do this to serach the customer better in backend)

I try with this code in mysql and works

UPDATE nnj0c_hikashop_user, nnj0c_hikashop_address SET nnj0c_hikashop_user.vat_number=nnj0c_hikashop_address.address_vat WHERE nnj0c_hikashop_user.user_id=nnj0c_hikashop_address.address_user_id
but i don´t know in what field i must insert this code.

Note: I have restricted only 1 direction per customer

Coul you help me?

thanks

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #151762

Hi,

You have to create a plugin based on the triggers "onAfterUserCreate(&$element)" and "onAfterUserUpdate(&$element)", by this way when the customer register or update his infos the request is executed and update the desired field.

Here is some documentation about that:
www.hikashop.com/support/support/documen...umentation.html#user

Please Log in or Create an account to join the conversation.

Time to create page: 0.051 seconds
Powered by Kunena Forum