zone field not validating for blank

  • Posts: 60
  • Thank you received: 8
12 years 4 months ago #57660

We were having an issue with the "Zone" field not being selected properly by the customer.

For example we had a default Country of the United States and therefore a default state/zone of "Alabama", however customers continually were not changing the selection of the zone and so their address would say that they were in Alabama.

So we created a blank zone name and set that to default, so that people would select their proper state in the address field.

However now, we get a lot of customers not filling in anything for the state and even though the field is marked as Required, it still lets a blank value come through.

Is there any way to make it so the form will validate the state field to make it so a blank value doesn't come through if the customer forgets to change their zone/state to the correct one on the form?


Ecommerce expert for hire. DaveKarlsven.com

I love helping businesses make lots of money online.

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
12 years 4 months ago #57725

You need to go in the database and change the namekey of that blank zone to be empty.
You will have to change that in two places:
in the zone_namekey field of the table hikashop_zone and in the zone_child_namekey of the table hikashop_zone_link

Once that's done, set it as the default value in the custom field (you need to save the custom field's options) and make sure that the required option of the custom field is turned on.

That way, I think it will display an error message when the state field is empty.

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

  • Posts: 60
  • Thank you received: 8
12 years 4 months ago #57852

Nicolas,

I have gone through and removed the namekey from the database fields you have specified and made sure to save the custom field with the default the blank one and the field is marked as required,

However it is still not validating the field as empty and lets me progress to the next step in the checkout without a state/zone selected.

Is there anything else you can think of that needs to be added or changed so that the State/Zone field will need to be selected (required to have a value entered to checkout) ?


Ecommerce expert for hire. DaveKarlsven.com

I love helping businesses make lots of money online.

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
12 years 4 months ago #58029

Ah, I know. You will have to also remove the code:
function JSCheck(&$oneField,&$requiredFields,&$validMessages,&$values){

}

in the file administrator/components/com_hikashop/classes/field.php

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

  • Posts: 60
  • Thank you received: 8
12 years 4 months ago #58120

Great, that seemed to do the trick.

Thanks for your help, Nicolas.

I would suggest you think about adding a "--Select--" option as the first option on the drop down lists if a Default option is not set, that is required to be changed so that users don't accidently submit the form without changing their Zone or other options in the drop down lists to their proper ones.

We had several users checkout with the wrong address because for some reason they did not take the time to change the State they lived in from the default State.

The code changes you sent us work great, but we always hate hacking the code because it will be more things to keep track of and change when you come out with new updates.

Thanks for the great software and great support you provide.


Ecommerce expert for hire. DaveKarlsven.com

I love helping businesses make lots of money online.

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
12 years 4 months ago #58152

We'll add that to the todo list.

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

Time to create page: 0.059 seconds
Powered by Kunena Forum