Using custom user-profile plugin data in HS

  • Posts: 194
  • Thank you received: 5
8 years 11 months ago #201594

-- url of the page with the problem -- : n/a
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.33
-- Browser(s) name and version -- : Firefox
-- Error-message(debug-mod must be tuned on) -- : n/a

We're in the process of enabling the custom user-profile plugin within Joomla 3.x to gather all the data (address) at the time of the core Joomla registration.
Is there a way that HS can automatically just use that data for it's needs, rather than requiring the user to provide that information again (and maintain 2 different address entries)?

I looked through the docs and searched the forum but couldn't find anything specifically related to this.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 11 months ago #201610

Hi,

I think that this will require the creation of a plugin or the edition of the user-profile one.
In the plugin, you will have to populate the "#__hikashop_address" table, and potentially the #__hikashop_user" one too based on the kind of custom fields that are used.

You can use the function "save" of the HikaShop class "user" by giving the correct "$element" PHP object with the user id.
Same thing for the address class.

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

  • Posts: 194
  • Thank you received: 5
8 years 11 months ago #201662

Xavier,

Thanks, I hadn't thought that I'd have to manually do the populating.

Do you (or anyone else) have any examples of how you've done this before?
(Or does the CB integration do this? Would that be a good place to look at - as far as how to do the HS update portion of the process?)

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 11 months ago #201667

Normally, you simply enable the Redirect Joomla registration to HikaShop plugin via the Joomla plugins manager so that you actually use the HikaShop registration page instead of Joomla's. That way, you get all the custom fields on the core registration page and they are actually HikaShop fields so theyr get filled in HikaShop automatically.
It's way easier than to build a synhchronization plugin between Joomla and HikaShop for the custom fields.

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

  • Posts: 194
  • Thank you received: 5
8 years 11 months ago #201719

That would be great; however, I need two specific functionalities:

1. I need an sql (lookup with dropdown) field

2. I need to have the results of one field limit what optiois are available in the next field (i.e. 'region', 'org', where only the 'orgs' of the chosen 'region' appear in the 'org' selector).

Are these possible within the Hikashop custom fields?
I couldn't find any option that seemed to work (maybe I'm missing something).

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 11 months ago #201729

Hi,

There is no option by default to do that.
But HikaShop's custom field system can be extended to create new types of custom fields and there you can do whatever you want.
To do that, you would have to develop a hikashop plugin taking the plugins/hikashop/datepickerfield plugin as a basis as theis plugin adds the "advanced date picker" type of fields to HikaShop.

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

  • Posts: 194
  • Thank you received: 5
8 years 8 months ago #211861

We're finally trying to get this process working and back with two more questions.

1. If I create a user with the core Joomla user system is a HS user record automatically created?

2. If a user is NOT logged in, enters HS and tries to purchase something that requires being logged in, is there a way that I can override the redirection to the core Joomla registration page (instead of the HS registration page)?

We can't use the HS registration process because we have a number of extensions that we need to use that only work with the core Joomla user profile.

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 8 months ago #211863

Hi,

1. Yes.

2. HikaShop displays its own registration page on three instances:
- You created a menu item of the type HikaShop user registration
- You enabled the Redirect Joomla registration to HikaShop plugin via the Joomla plugins manager and you clicked on a link on your website which wanted to direct you to the Joomla registration page and that plugin kicked in to redirect you to the HikaShop registration page instead.
- You're checking out and you see the fields of the HikaShop registration form as part of the checkout.
The first two points are not a problem to deal with so I assume that you're talking about replacing the registration within the checkout to use Joomla's.
There are a few ways to deal with that:
- You could simply edit the file "login" of the view "checkout" and redirect the customer to the registration page of Joomla.
- You could keep the HikaShop registration in the checkout and develop a small plugin to synchronize the data entered by the customer in the HikaShop fields in the Joomla user fields. That's nicer than the first choice as it will be better integrated in the checkout and transparent to the user.
- You could modify the checkout views/controllers, etc to insert Joomla fields instead of the custom fields of HikaShop and handle them yourself with custom code but that will be quite complex so I don't recommend that.

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

  • Posts: 194
  • Thank you received: 5
8 years 7 months ago #212540

OK ... the logical option would be:

- You could simply edit the file "login" of the view "checkout" and redirect the customer to the registration page of Joomla.

However, looking at the login.php view code, I'm not at all sure where to start.

I would think that this could be a feature that could just be enabled from the config (i.e. 'Use Core Joomla Registration' vs 'Use Hikashop Registration').
But for now can you provide any sample code to show what needs to be done here?

I just need to have HS redirect a user to the core login/registration whenever it is required within HS.

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 7 months ago #212557

The core Joomla registration is not meant to be embedded in another form (the one of the checkout).
That's technically impossible.
That's why we took the second best option which is to create our own registration form which is completely compatible with Joomla's.

I suppose that you want to do that because of your other issue:
www.hikashop.com/forum/customers/878953-...onf-emai.html#212541
If so, the solution you're looking for is not in redirecting the customer to the Joomla registration but in simply fixing the reason why the notification email is not sent.

Adding a redirect to the Joomla registration form is dead simple if you know a bit of HTML.
Just add such line:

<a href="http://mywebsite.com/link/to/my/joomla/registration/page">Register here</a>
But it's a crude solution as it will break the flow of the checkout for customers and that's the last thing you want.

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

  • Posts: 194
  • Thank you received: 5
8 years 7 months ago #212648

OK ... we can't break the checkout flow (that would not be acceptable to client) ... and we can't embed the core Joomla registration (technical limits) ... and using the HS registration process is not an option for our needs either (due to other customizations related to the user-profile system) ... so we just have to live with 2 independent registration systems. That is really not a great solution, but I guess we'll have to live with it.

It would sure be nice if we could just have the core Joomla registration available via a pop-up box during the check-out process, or to somehow be able to just redirect to the core registration but not loose the check-out flow.

The current HS approach is fine if your site is primarily an ecommerce site; however, if your site has a lot of other functionality (i.e. major components) and ecommerce is just one of those, it really is not an ideal implementation of registration for HS. (Esp. considering every other extension just works with the core user system directly).

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 7 months ago #212650

Hi,

I'm not sure what you mean.
When you register via HikaShop, HikaShop will create a standard Joomla user account. And all the other components also base themselves on that.
So it's not like you have two separate registration systems where you can't login with an account created on the other system.
And even regarding the profile data, it's just a matter of synchronization between Joomla and HikaShop that could be solved by the development of a plugin.

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

  • Posts: 194
  • Thank you received: 5
8 years 7 months ago #212930

OK ... it sounds like the BEST solution would be to build the integration plugin.

However, that would also mean that I need to create a new set of fields for the registration process within the HS registration form.
We have a bit of a complex field structure in our registration process.
You can see it here:
cmdtest.developmentsite.net/register-test
Our custom fields are in the 'parish,school,....' section.
If you check the box (My parish is not listed) and then the next box (My arch/diocese is not listed) you'll see the complex set of fields.
All the selector fields are mysql table lookups (from the Joomla db).

Is there any documentation on how to create custom fields like this within HS?
(I think I can manage creating the plugin to synchronize the data once we get it into the HS user profile).

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

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
8 years 7 months ago #212936

Hi,

Having fields to display or not based on another one is possible with the "display limited to" setting of the custom fields.
So besides the fact that you want the values to be loaded dynamically from the database, it's already possible to have such form.
And if you want to have such dynamic field, you can create a custom field type plugin for HikaShop in order to extend the normal dropdown field type to do that. It shouldn't be too complex.
I recommend to look at the plugins/hikashopdatepickerfield folder where you'll see an example of custom field type plugin for the "advanced date picker" type.

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

Time to create page: 0.084 seconds
Powered by Kunena Forum