Pass address to the $data upon user registration

  • Posts: 59
  • Thank you received: 2
3 years 10 months ago #328440

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.4.13
-- Error-message(debug-mod must be tuned on) -- : user address not passing to the $data on HIKA_USER_ACCOUNT_ADMIN_NOTIFICATION_SUBJECT

Hi, is it possible to pass the user Address the costumer created upon registration on the website?

I Print_r the $data variable but it doesn't contain the user address.
example below




thank you

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 10 months ago #328457

Hi,

What you say is strange.
It's been several years now that the address data from the registration form is passed in the $data object.
It's done with the code:

$mailClass = hikashop_get('class.mail');
			$registerData->user_data =& $userData;
			$registerData->address_data =& $addressData;
			$registerData->shipping_address_data =& $shippingAddressData;
			$registerData->active = $useractivation;
in the file administrator/components/com_hikashop/classes/user.php
It's this $registerData which is given to the email notification when loading it with the line:
$mail = $mailClass->get('user_account', $registerData);
So I don't see how you can print_r an object with user_data and active but without address_data and shipping_address_data in the email.
I suppose I'm missing some information about what you're trying to do where...

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

  • Posts: 59
  • Thank you received: 2
3 years 10 months ago #328472

Hi nicolas, thanks for the reply.

I edit that file and it was as you showed, but it seams to have no effect on the email.
i even comment those lines and had the same result on the email. with the same information on the $data var, and (at least i did't find any) overwrite of that file.

also if I activate that administration email, the admin is not receiving the email notification, the client is working, but the admin email is not.

also is intended that every time we preview an email it shows on the email history?

thanks.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 10 months ago #328478

Hi,

Ah wait, I think you gave a clue here.
If you try a print_r of $data with the preview button, you won't have the address data in $data as $data is generated in the media/com_hikashop/mail/user_account_admin_notification.preview.php file and it does a simple loading of the data, not as complete as what you get with a real registration.
So I would recommend to do your test with a real registration and you should see the additional object attributes with the address information.

And yes, it's normal that the preview email appears in the email history, even though the email is not really sent.
That's because the email history is done via a plugin which implements the trigger onBeforeMailSend which is actually called after the email is generated and before the email is sent.
We do that so that other plugins can potentially modify the generated email.
Ideally, two triggers would be better, one after the email is generated and one before the email is sent, but changing the way it works would create backward compatibility issues so we preferred to leave it like that.

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

  • Posts: 59
  • Thank you received: 2
3 years 9 months ago #328679

Hi Nicolas,

thanks for the reply, I used the preview so it was that, i was thinking it was loading the address.

but we still have the problem that the new account admin notification is not getting send by the hikashop.
all the others notifications being used are being correctly send.
the HIKA_USER_ACCOUNT_ADMIN_NOTIFICATION is the only one not being send, and no information being registered on the Emails History.

how can debug where the problem is at?

thank you

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 9 months ago #328683

Hi,

That email is only sent if:
- the user registered through HikaShop's registration form (and not from Joomla's or another extension)
- the "Send Mail to Administrators" setting of the Joomla user manager is activated.

The following user(s) said Thank You: allbs

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

  • Posts: 59
  • Thank you received: 2
3 years 9 months ago #328718

Hi nicolas,

thank you, it was this option

- the "Send Mail to Administrators" setting of the Joomla user manager is activated.

The following user(s) said Thank You: Philip

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

Time to create page: 0.073 seconds
Powered by Kunena Forum