How to check if checkout guest form is submited?

  • Posts: 1119
  • Thank you received: 114
6 years 3 months ago #296130

Hi,

I am looking for some help regarding checkout guest user information.

I would like to disable or add some css class to checkout_shipping_block view untilshow_block_login view is submitted. I am fine with php or js, it doesn't matter. How can this be done?

I am not sure how can I check if user has submitted he's details or not...

Any advise please?

Thanks

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 3 months ago #296141

Hi,

You can do that with javascript.
In the different show_block_ files of the "checkout" view, near the end, you have some javascript called when actions are made.
So you would have by default some CSS, and then, in the javascript of the show_block_login, you would have some custom javascript to change that CSS dynamically.
For example, in the submitLogin function, you can add your javascript for when someone click on the login / register / next button of the login view.

The following user(s) said Thank You: kyratn

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

  • Posts: 1119
  • Thank you received: 114
6 years 3 months ago #296218

Hi,

Well, yes. That's what i was thinking to do but if user refresh page that class will be removed so i still need some kinda variable or state by which i could add my own styling... Is there anything with hikashop?

As example in show_block_address i see this

$this->options['display']
which returns true or false based on guest information is submitted or not, but this doesn't work in views like show_block_shipping. Would it be possible to use it there without modifying core files?

Kind Regards

Last edit: 6 years 3 months ago by kyratn.

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

  • Posts: 1119
  • Thank you received: 114
6 years 3 months ago #296228

Also how could i refresh shipping block after login is submitted?

Been playing with "window.checkout.refreshShipping" and "window.Oby.registerAjax" but still couldn't do it properly.

Thanks

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 3 months ago #296226

Hi,

In any PHP file on your website, if you want to know if a user is logged in to a joomla user account or not, you can use this code:
$user = JFactory::getUser();
if($user->guest) {
// not logged in
}

Similarily, in any PHP where HikaShop has been loaded before, you can use such code to know whether or not the user is connected to a HikaShop customer:
$hkuser = hikashop_loadUser();
if($hkuser) {
// connected as a guest or a user account
}
so then you can just mix both to know the exact situation of the customer in any view file of HikaShop.

With window.Oby.registerAjax you can register functions to be run when something changes. But that's different from "when something is submitted". In that case, you should rather change the submitLogin function as I was saying previously and from there, directly trigger the refresh of the shipping view (with a delay using the setTimeout function of js).

Last edit: 6 years 3 months ago by nicolas.
The following user(s) said Thank You: kyratn

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

  • Posts: 1119
  • Thank you received: 114
6 years 3 months ago #296267

Hi,

Your hints was very useful Nicolas. I have managed to do what i want and all works fine now. The only issue is the user points not showing after registration or login as per other topic regarding this issue....

Thank you for your help

Kind Regards

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

Time to create page: 0.061 seconds
Powered by Kunena Forum