OnAfterUserUpdate is missing some information.

  • Posts: 3
  • Thank you received: 0
5 years 9 months ago #303339

-- HikaShop version -- : HikaShop Business 4.0.0 [1810011756]
-- Joomla version -- : Joomla! 3.9.2 Stable
-- PHP version -- : 7.2.14
-- Browser(s) name and version -- : Google Chrome 71.0.3578.98
-- Error-message(debug-mod must be tuned on) -- : None

I'm trying to make a call to an API with the function "OnAfterUserUpdate". So after a user is updated in Hikashop, it should send some data to an API. But the data I want to use, is not in the variable used in the function. I'm dumping the $element variable on the screen and this is what I get:

stdClass Object
(
    [user_email] => test@test.com
    [user_partner_activated] => 0
    [user_partner_email] => 
    [user_params] => O:8:"stdClass":6:{s:15:"user_custom_fee";s:1:"0";s:20:"partner_fee_currency";s:1:"1";s:21:"user_partner_lead_fee";s:1:"0";s:24:"user_partner_percent_fee";s:1:"0";s:21:"user_partner_flat_fee";s:1:"0";s:22:"user_partner_click_fee";s:1:"0";}
    [user_id] => 1
)

I'm expecting a "Default Billing adres" and also a "Default Shipping adres" but those are, as you can see, not in the $element variable.

Can someone help me with this?

Thanks in advance,
Robin

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
5 years 9 months ago #303346

Hi,

Well, the onAfterUserUpdate trigger is called when the user is saved in the database, and thus it only contains the data to be saved in the hikashop_user table.
The default addresses are stored in hikashop_address.
If you want to be triggered for the addresses saving, you can use onAfterAddressUpdate.
Note also that you can check the data coming from the form in $_POST.
And you can also load the addresses from the database with a MySQL query if necessary.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum