Custom field to accept only unique value

  • Posts: 25
  • Thank you received: 1
9 years 8 months ago #225264

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.5.26

Hi

I want to create a custom field in table "item" asking for clients to enter a "text" that must be unique.
So validation must check the database to see if the "text" value is unique to accept it or if is already there by another user to create a note pop up.
I want to use table "text" in order to use the "Regular expression check" .

Any idea how to achieve that?

Thank you

Last edit: 9 years 8 months ago by nojunkgoodfood. Reason: Better title

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

  • Posts: 13201
  • Thank you received: 2322
9 years 8 months ago #225294

Hi,

There is no options by default in HikaShop for that, but this can be done by creating a new plugin, so PHP knowledges required.
The plugin can be based on the function "onBeforeCartUpdate()", in this function do the MySQL request to check that the value of the item field is not already in the database, if already in so set the "$do" to false, else let it to true.

Here is the developer documentation:
www.hikashop.com/support/documentation/6...umentation.html#cart

If you are not a developer, you can still post your request in the commercial jobs section of this forum.

The following user(s) said Thank You: nojunkgoodfood

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

  • Posts: 25
  • Thank you received: 1
9 years 8 months ago #225351

Thank you for your advice,
and
Happy New Year!

The following user(s) said Thank You: Xavier

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

Time to create page: 0.068 seconds
Powered by Kunena Forum