- Posts: 107
- Thank you received: 4
Plugin trigger when moving on from basket?
Please Log in or Create an account to join the conversation.
Before answer on what would be appropriate to do that, could you tell us what kind of age verification you wish to implement ? Someone like providing an upload field to upload a scan of an identity card / password with a manual verification of age ? Or just a checkbox with a label "I am more than XX years old", or something else ?
Or do you have some kind of Joomla age verification extension you would like to use ?
Wouldn't this make sense to have that check on the registration form ? That way the user would do it once, and then it would be automatically taken into account for orders in the future ?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Ok. There are several events already available on the checkout:
www.hikashop.com/support/documentation/6...tation.html#checkout
For example, with onCheckoutWorkflowLoad you can check if the age verification has been done. If not, redirect to that verification mechanism, and then redirect back to the URL you were before once done.
So it seems to me it would be the one to use in this case.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Yes. As explained on the documentation of that event, the $cart_id is provided. So you can easily load the cart.
For example:
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
You can get the step number with this code:
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Check the content of $_POST. That way, you can see if the cart is being changed or not. And if not, then you can redirect.
Please Log in or Create an account to join the conversation.
$input = Factory::getApplication()->input;
$post = $input->post->getArray()
But what should I check for to know if this is a deletion of a product and not a move to the next step ?
Please Log in or Create an account to join the conversation.
You want to do something like this:
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
It is. hikaInput is a class defined when the main helper file of HikaShop is loaded.
And if the hikashop plugins are loaded and the event onCheckoutWorkflowLoad is triggered, then HikaShop has to be loaded already and thus the class hikaInput exists.
However, PHP introduced namespaces a while back and many Joomla plugins use that feature.
If you do in your plugin, then you want to add a \ before hikaInput in the code. Otherwise, PHP will search the hikaInput class in your plugin namespace, not in the main namespace where HikaShop defines it.
Example 1 here www.php.net/manual/en/language.namespaces.basics.php presents this case.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Sure, I don't see a problem with that.
You just need to make sure the URL for the redirection contains the "step" parameter with the step number as value.
You should be able to see that parameter in URL of the address bar of your browser when you are on another step than the first step of your checkout.
Please Log in or Create an account to join the conversation.