- Posts: 9
- Thank you received: 0
Item custom field validation
- designbuilder
-
Topic Author
- Offline
Less
More
11 years 3 months ago #204248
by designbuilder
Item custom field validation was created by designbuilder
-- HikaShop version -- : 4.2
-- Joomla version -- : 3.4
I have a custom field in the item table (text field) assigned to a product. Customers can enter an existing serial number on the product page. I would like to check that the serial number is valid, via a database query, before the product is added to the cart, or display an error if invalid. Can you advise suitable approach? Thanks
-- Joomla version -- : 3.4
I have a custom field in the item table (text field) assigned to a product. Customers can enter an existing serial number on the product page. I would like to check that the serial number is valid, via a database query, before the product is added to the cart, or display an error if invalid. Can you advise suitable approach? Thanks
Please Log in or Create an account to join the conversation.
11 years 3 months ago - 11 years 3 months ago #204257
by gpraceman
Replied by gpraceman on topic Item custom field validation
From what I have seen, the only validation that you can currently do is whether it is required or not. I earlier recommended that they add in the ability to do a Regex validation on a custom filed. To do a database validation would be more involved, but you could request that feature be added.
I have customers that need to supply a serial number in order to purchase a software upgrade. I made a custom field for the applicable products and made it required, but the customer can enter whatever they want. We have to validate that serial number when we get the order. If they do add that feature, I would be interested in it. If they at least added a Regex validation, the customers couldn't just enter any old value.
I have customers that need to supply a serial number in order to purchase a software upgrade. I made a custom field for the applicable products and made it required, but the customer can enter whatever they want. We have to validate that serial number when we get the order. If they do add that feature, I would be interested in it. If they at least added a Regex validation, the customers couldn't just enter any old value.
Last edit: 11 years 3 months ago by gpraceman.
Please Log in or Create an account to join the conversation.
11 years 3 months ago #204280
by nicolas
Replied by nicolas on topic Item custom field validation
Hi,
A regex validation for the custom fields has already been added to the latest version of HikaShop.
But if you want to validate against a database of valid values, as gpraceman said, it will require something more involved.
HikaShop has a lot of triggers which are listed on our developer documentation:
www.hikashop.com/support/support/documen...r-documentation.html
There, you'll find the triggers for the custom fields.
They allow you to create new types of custom fields via the development of a HikaShop plugin.
So you could create a new type of custom field, basing it on the standard text field type and overriding the check function to do your own check the way you want.
If you want a complete example, you can look at the advanced date picker plugin which is available in the folder plugins/hikashop/datepickerfield of your website.
A regex validation for the custom fields has already been added to the latest version of HikaShop.
But if you want to validate against a database of valid values, as gpraceman said, it will require something more involved.
HikaShop has a lot of triggers which are listed on our developer documentation:
www.hikashop.com/support/support/documen...r-documentation.html
There, you'll find the triggers for the custom fields.
They allow you to create new types of custom fields via the development of a HikaShop plugin.
So you could create a new type of custom field, basing it on the standard text field type and overriding the check function to do your own check the way you want.
If you want a complete example, you can look at the advanced date picker plugin which is available in the folder plugins/hikashop/datepickerfield of your website.
Please Log in or Create an account to join the conversation.
11 years 3 months ago #204303
by gpraceman
Replied by gpraceman on topic Item custom field validation
Two weeks ago, you indicated that you would look at adding such a feature. If that feature has already been added, where is it available? When I edit a custom field, I don't see any Regex option.nicolas wrote: A regex validation for the custom fields has already been added to the latest version of HikaShop.
Please Log in or Create an account to join the conversation.
- designbuilder
-
Topic Author
- Offline
Less
More
- Posts: 9
- Thank you received: 0
11 years 3 months ago - 11 years 3 months ago #204331
by designbuilder
Replied by designbuilder on topic Item custom field validation
Nicolas thanks, creating a new custom field looks the way forward. I will have a look through the Datepickerfield example. It would be nice if there were some comments in these code suggestions.
gpraceman, it seems we are tying to solve the same requirement.
gpraceman, it seems we are tying to solve the same requirement.
Last edit: 11 years 3 months ago by designbuilder.
Please Log in or Create an account to join the conversation.
11 years 3 months ago #204404
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Item custom field validation
Hi,
We released the latest version yesterday and you can see that new feature mentioned on the change log of that new version:
www.hikashop.com/support/support/documen...ashop-changelog.html
Regards,
That's right. Two weeks ago as said that we would look into it, and we did.Two weeks ago, you indicated that you would look at adding such a feature. If that feature has already been added, where is it available? When I edit a custom field, I don't see any Regex option.
We released the latest version yesterday and you can see that new feature mentioned on the change log of that new version:
www.hikashop.com/support/support/documen...ashop-changelog.html
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Time to create page: 0.220 seconds