User synchronization after prior Guest checkout

  • Posts: 116
  • Thank you received: 7
  • Hikashop Business
2 years 11 months ago #337828

-- HikaShop version -- : 4.4.4
-- Joomla version -- : 3.10.3
-- PHP version -- : 7.4

We have allowed Guest checkout in the past. So visitors to the site may have purchases prior to today.

If a visitor returns and creates a Joomla! User account using the same email address as prior Guest purchases, and then makes a purchase, they are unable to checkout in Hikashop.

The problem we found is that there is a user in HIkashop (#__hikashop_user) with the user_cms_id field set to 0 but with the same Email address as the newly registered user.

If I update the table manually with the J! User ID everything works for them.

To avoid this, I have manually updated all newly registered J! users in the hikashop_user table.

We are using a custom registration form. Could this be causing the system hikashopuser plugin from not synchronizing new user registrations into Hikashop?

I have modified our user registration form to trigger an update onUserAfterSave that updates the hikashop_user table with the new J! user CMS id with the same email address.

Is that the right thing to do?

This only started to show up more frequently for us because we have recently began to require all visitors to be registered/logged in before making a purchase. Leaving us with thousands of Hikashiop customers (users) without a CMS id. Initially I though the HIkashop user synchronization plugin would take care of this for us.

Thanks for your help!

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
2 years 11 months ago #337842

Hi,

The HikaShop user synchronization plugin is suppose to do that yes. But this is the case only if you go through Joomla's API to add the Joomla user account to Joomla.
Normally, to add a Joomla user account, you need to use the bind and save functions of JUser:
stackoverflow.com/questions/1904809/how-...from-within-a-script
If you do that, Joomla will call the onUserAfterSave event ( docs.joomla.org/J1.5:Plugin/Events/User#onUserAfterSave ) which the HikaShop user synchronization plugin implements. In there, the plugin will check if there is already a guest user entry in hikashop_user and if there is, it will update the user_cms_id.

What you're saying seems to indicate that you're not going through Joomla API to add the user account, and thus the user synchronization plugin doesn't know that you've created a user account.
In that case, you would indeed have to manually update the user_cms_id in the hikashop_user table (or trigger yourself the onUserAfterSave event).

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

  • Posts: 116
  • Thank you received: 7
  • Hikashop Business
2 years 11 months ago #337869

Okay, thank you. I am currently using Chronoengine's Chronoforms V6 and looking at V7 now to see what their "save user" action does...it seems to use the J! API though because it does trigger the verification email from J! if we have that system option enabled.

But just knowing that updating the user_cms_id is okay for now until I figure out the registration process. I am thinking of just cloning and modifying J!'s login module or I'm looking at another component that combines registration and login into a single form.

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
2 years 11 months ago #337881

Hi,

The verification email is not sent by the Joomla JUser save. It's specific code in the controller which does that.
I know since we have the same capability in HikaShop and we actually send our own verification email if the setting is activated in Joomla while still using the Joomla user API to add the user to the database.
So the fact that the verification email is sent doesn't mean that the user is added using the Joomla user API. That's unrelated.
Looking at the "save user" action of Chronoforms is indeed what I woul recommend, or ask the developer directly.
But yes, updating the user_cms_id yourself it totally fine. You might even prefer doing it like that as if you trigger the onUserAfterSave event, you might have issues with other plugins.
For example, captcha plugins also implement that event and thus the captcha plugins aren't properly called to display on the registration form, they will cancel the registration if you go through Joomla user API for the saving.

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

Time to create page: 0.065 seconds
Powered by Kunena Forum