Problem with guest form validation.

  • Posts: 141
  • Thank you received: 3
4 years 5 months ago #311784

-- HikaShop version -- : 4.2.1
-- Joomla version -- : 3.9.12
-- PHP version -- : 7.2.14

Hello, I have found a problem in checkout process with proper presentation of TAX number field related with following settings:

TAX number field - defined in custom field as required for Companies and not required for Individuals.
Buyer field – defined in custom field either as Radio Button or as Checkbox

The problem appears when and you try to accept checkout guest form for Companies without filling in Tax number field: there is a warning “Please complete the VAT number field” but Tax number field disappears from the form (Company Name is also disappear and Ordering Person Data also – so I think that the form "switching" data as required for Individual and not for the Company) – it is becoming visible again only when you change Buyer from Company to Individual and back again to Company.

However this improper situation doesn’t appear when you set Buyer field as Single Dropdown In custom field parameters – but I would like to use for the Buyer field either Radio Button or Checkbox

I would like to ask for a hint how to solve this problem.

I have tested this situation also on Prostar template and I think you shouldn't have problem to reproduce this scenario on your end.

Regards,
Greg

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

  • Posts: 12953
  • Thank you received: 1778
4 years 5 months ago #311791

Hello Greg,

Can you show us some screenshots of
- How you configured your checkout "Hikashop->System->Configuration->Checkout"
- The issue you are having

So that we can also reproduce it on our end ?

Best regards,
Mohamed Thelji.

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

  • Posts: 141
  • Thank you received: 3
4 years 5 months ago #311834

Hi Mohamed, ok, please find below screenshots

1. Configuration – checkout




2. Custom Field – address_vat_company



3. Custom Field – Buyer



4. Form – all required data filled in except VAT number – before Next button is submitted



5. Form – after Next button is submitted – Error Message to complete the VAT number Field but VAT number (and Company Name is not Visible) – in fact only fields, which are linked to Individual Buyer are visible



6. Form – after change Buyer from Company to Individual and back again to Company



Regards,
Greg

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

  • Posts: 12953
  • Thank you received: 1778
4 years 5 months ago #311849

Hello Greg,

Thank you for your feedback, here is a quick fix that you can test on your end, you'll just have to edit the "\media\com_hikashop\js\hikashop.js" file and change these lines :

		if( new_value === null) {
			if(d.getElementById(type + namekey))
				new_value = d.getElementById(type + namekey).value;
			else {
				inputs = d.getElementsByName('data['+field_type+']['+namekey+']');
				for(var i = inputs.length - 1; i >= 0; i--) {
					if(inputs[i].checked)
						new_value = inputs[i].value;
				}
			}
		}

by :
		if( new_value === null) {
			if(d.getElementById(type + namekey))
				new_value = d.getElementById(type + namekey).value;
			else {
				inputs = d.getElementsByName('data['+field_type+']['+namekey+']');
				if(!inputs.length) {
					var row = d.getElementById( prefix + field_type + '_' + namekey );
					if(row) {
						inputs = row.getElementsByTagName('input');
					}
				}
				if(inputs.length) {
					for(var i = inputs.length - 1; i >= 0; i--) {
						if(inputs[i].checked)
							new_value = inputs[i].value;
					}
				}
			}
		}

Kind regards,
Mohamed Thelji.

The following user(s) said Thank You: Greg_C

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

  • Posts: 141
  • Thank you received: 3
4 years 5 months ago #311881

Hi Mohamed, ok, it works - thank you for your help !

will you also add this change on your end in the next version of Hikashop ?

Regards,
Greg

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

  • Posts: 141
  • Thank you received: 3
4 years 5 months ago #311897

Hi Mohamed, Unfortunately after further tests (on other devices and browsers) it is turned out that this changed caused problems with proper site functioning - Slideshow Module is now not working (there is only empty space) and we have problem with presentation of list of products which are now presented only in one column. It means this changed in the hikashop.js is causing problem with other elements.

Regards,
Greg

Last edit: 4 years 5 months ago by Greg_C.

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

  • Posts: 12953
  • Thank you received: 1778
4 years 5 months ago #311941

Hello,

Can you send us a link to the page where you are having that issue so that we can check and reproduce it ?

Kind regards,
Mohamed Thelji.

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

  • Posts: 141
  • Thank you received: 3
4 years 5 months ago #311971

Hello Mohamed, I have found what caused the problem - it was caused because I have missed the last mark "}" in your code !

once again thank you for your help !

will you also add this change on your end in the next version of Hikashop ?

Regards,
Greg

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

  • Posts: 12953
  • Thank you received: 1778
4 years 5 months ago #311990

Hello Greg,

Sure we'll add this change on next Hikashop release !

Kind regards,
Mohamed Thelji.

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

Time to create page: 0.131 seconds
Powered by Kunena Forum