Advanced Date Picker

  • Posts: 219
  • Thank you received: 10
  • Hikaserial Subscription Hikashop Multisite
2 weeks 1 day ago #369681

-- HikaShop version -- : 6.1.1
-- Joomla version -- : 5.4.1

Hi,

I'm running into a strange issue with the Advanced Datepicker field. I set the waiting days to one day (see attachment), so customers shouldn’t be able to select the same-day delivery option (see attachment). However, they still can. What makes it even more confusing is that I can’t reproduce it myself on the frontend. When I try the checkout as a regular customer, the current day isn’t selectable for me at all.

So something doesn’t seem to match between what customers are seeing and what I’m seeing. I’m not sure if I misconfigured something or if there’s a bug in how the waiting days are applied.

Could you take a look with me?

Thanks!


Attachments:

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

  • Posts: 84863
  • Thank you received: 13817
  • MODERATOR
2 weeks 1 day ago #369685

Hi,

It's probably a time zone issue.
The plugin must still think that it is the previous day and thus allow for the next day thinking it is 2 days in the future.
Check the settings of the Advanced date picker plugin via the Joomla plugins manager. It has a setting to use noon as the time of the day instead of midnight. That way, even if there is a few hours of time zone difference, it won't be a problem.

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

  • Posts: 219
  • Thank you received: 10
  • Hikaserial Subscription Hikashop Multisite
2 weeks 1 day ago #369687

Hi,

The "Set hour to noon when processing time" option was already set to YES

The problem occurs multiple times in a month with various clients, so i don't understand how they can bypass the "Check Dates"

Attachments:

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

  • Posts: 84863
  • Thank you received: 13817
  • MODERATOR
2 weeks 21 hours ago #369689

Hi,

Then, the first thing is to understand how to reproduce the problem.
For example, it could be that the customer first added the product to the cart, went to the checkout, filled the field for a date 2 or 3 days in the future, then they left their cart as is, and they came back on the day they had selected and placed the order without the check happening as the value was already validated in the cart before.
Are you able to reproduce this process ?
If I look at the code in the file administrator/components/com_hikashop/helpers/checkout/fields.php (which handles the custom order fields on the checkout), I can see that the "check" function (which is called at the end of the checkout) doesn't validate the fields. It's only the "validate" function (which is called each time the step where the custom order fields are displayed is being submitted) which checks the data provided by the user in the fields via the getFilteredInput function call.
So, technically, it would be possible to bypass the test by entering a valid valid, waiting a day or 2, and then validating the order without going through the step of the custom order fields.
So, I suppose it also depends on how your "checkout workflow" is configured.
Supposing that this is indeed what's happening, adding a check in the "check" function could be a solution, but it's not simple because the check needs to handle many things (the "display limited to", the categories and products restrictions, the AJAX fields) and the data it has at this point is not the same as the data it has when the page is being submitted.
A cruder solution would be to implement the onBeforeOrderCreate event in the advanced date picker plugin to target the custom order fields of that type and if the value if filled for them, the automatically applies the checks on them. I prefer this second approach as it is a lot more targeted and will avoid having to mess with all the other custom field types and the complicated things that need to happen for the checks to work properly.

Last edit: 2 weeks 1 day ago by nicolas.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum