Validation on required custom fields

  • Posts: 5
  • Thank you received: 0
8 years 5 months ago #243606

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.6.15
-- Browser(s) name and version -- : Firefox 47.0
-- Error-message(debug-mod must be tuned on) -- : Validation enqueue messages

We have a few custom fields that are required, under the Order type. They are all assigned to different Categories and do show up correctly according to the different products in your cart.

  • Wine Collection Date (Wine Category) - Required
  • Platters Collection Date (Platters Category) - Required

But, when one only has Wine products in your cart for instance, and importantly you disable Javascript in your browser and then submit, Hikashop comes back and tells you to please select a "Platters Collection Date", but this custom field isn't even visible on the checkout form. So we were forced to make all our custom fields NOT required and add our own Javascript validation on top with overrides. But for people that don't have Javascript enabled, those fields don't validate client side and Hikashop will then allow empty submits.

We did uopgrade Hikashop to the latest version (2.6.3), but this issue still persisted.

Does anyone know of a fix for this?

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

  • Posts: 4753
  • Thank you received: 644
  • MODERATOR
8 years 5 months ago #243811

Hello,

Can you provide a screenshot of your two Custom field back end configuration ?
Because, from what I know I don't see where the issue come from.

Awaiting news from you.

Regards

Last edit: 8 years 5 months ago by Philip.

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

  • Posts: 5
  • Thank you received: 0
8 years 5 months ago #244052

Hi, here are two screenshots.

http://i.imgur.com/KPj65vj.png?1
http://i.imgur.com/7KQYSAn.png?1

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
8 years 5 months ago #244059

Hi,

I found the issue.
Add the code:

if(is_null($oldData))
				$oldData = new stdClass();
			$cart = $this->initCart();
			$oldData->products = $cart->products;
before the code:
$orderData = $fieldClass->getInput('order',$oldData,!$this->cart_update);
in the file components/com_hikashop/controllers/checkout.php and that should fix the problem.

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

  • Posts: 5
  • Thank you received: 0
8 years 5 months ago #244205

Awesome, thank you, that did the trick.

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

Time to create page: 0.061 seconds
Powered by Kunena Forum