- Posts: 16
- Thank you received: 0
Conditional required field at checkout
6 years 3 months ago #321199
by ildiwhite
Conditional required field at checkout was created by ildiwhite
-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.0
Hi,
I would like to achieve the following at checkout:
If the address_company field (that is not mandatory) has a value, then the address_tax_number field should be mandatory. If the address_company field is empty, the address_tax_number field is not mandatory.
Is it possible?
Thank you,
Ildikó
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.0
Hi,
I would like to achieve the following at checkout:
If the address_company field (that is not mandatory) has a value, then the address_tax_number field should be mandatory. If the address_company field is empty, the address_tax_number field is not mandatory.
Is it possible?
Thank you,
Ildikó
Please Log in or Create an account to join the conversation.
6 years 3 months ago - 6 years 3 months ago #321215
by Philip
Replied by Philip on topic Conditional required field at checkout
Hello,
Yes, it's possible but with a little difference, follow me step by step to understand my idea :
1. Create a custom field like this screenshot :
The point here, is to know if you have a person OR a company
2. Then if you have a company, the Address field will be displayed AND mandatory (and not displayed if previous custom field value is "No"), and then idea is to have 2 "address_tax_number" custom field, first is mandatory (required) associated with "Cie" value and the second one, not required and associatiated with Ind (individual)
Hope this will fit your needs.
Regards
Yes, it's possible but with a little difference, follow me step by step to understand my idea :
1. Create a custom field like this screenshot :
The point here, is to know if you have a person OR a company
2. Then if you have a company, the Address field will be displayed AND mandatory (and not displayed if previous custom field value is "No"), and then idea is to have 2 "address_tax_number" custom field, first is mandatory (required) associated with "Cie" value and the second one, not required and associatiated with Ind (individual)
Hope this will fit your needs.
Regards
Last edit: 6 years 3 months ago by Philip.
The following user(s) said Thank You: ildiwhite
Please Log in or Create an account to join the conversation.
6 years 3 months ago - 6 years 3 months ago #321323
by ildiwhite
Replied by ildiwhite on topic Conditional required field at checkout
Hi Philip,
Many thanks for the quick solution, it works. I haven't notice this feature yet.
So does it mean that we have two columns in a table with the same name?
I still have a minor question:
What should I override to get rid of the word "error" in the custom error message (see attachement)?
Many thanks for the quick solution, it works. I haven't notice this feature yet.
So does it mean that we have two columns in a table with the same name?
I still have a minor question:
What should I override to get rid of the word "error" in the custom error message (see attachement)?
Last edit: 6 years 3 months ago by ildiwhite.
Please Log in or Create an account to join the conversation.
6 years 2 months ago #321337
by nicolas
Replied by nicolas on topic Conditional required field at checkout
Hi,
I'm not sure what you mean by "we have two columns in a table with the same name". Why do you think you have two columns with the same name in the same table (which is impossible in MySQL) ?
Regarding the "error" word, it's a bug. Change the line:
to:
in the file administrator/components/com_hikashop/classes/field.php and that will fix the problem. We'll add the patch on our end too.
I'm not sure what you mean by "we have two columns in a table with the same name". Why do you think you have two columns with the same name in the same table (which is impossible in MySQL) ?
Regarding the "error" word, it's a bug. Change the line:
Code:
$this->parent->messages[$this->prefix.$field->field_namekey] = array($message, 'error');
Code:
$this->parent->messages[$this->prefix.$field->field_namekey] = array($message);
Please Log in or Create an account to join the conversation.
Time to create page: 0.200 seconds