[Skip to main content](#vessel-content)

#   additional server side validation custom fields

##

- **[daliose](/forum/user/8901-daliose "View daliose's Profile")**
- [![daliose's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar8901.jpg)](/forum/user/8901-daliose "View daliose's Profile") Topic Author
- [ Offline](/forum/user/8901-daliose)

Less More

- Posts: 3
- Thank you received: 0
-
-
-
- [](https://servgate.jp)
-

14 years 2 days ago [\#75803](#75803) by [daliose](/forum/user/8901-daliose "View daliose's Profile")  *[additional server side validation custom fields](/forum/2-general-talk-about-hikashop/75654-additional-server-side-validation-custom-fields#75803 "I need to write some more detailed validation code (not just only if the filed is empty, or not) for an item set custom field for our products. Where can I write this code?  Maik")* was created by *[daliose](/forum/user/8901-daliose "View daliose's Profile")*

I need to write some more detailed validation code (not just only if the filed is empty, or not) for an item set custom field for our products.
Where can I write this code?

Maik

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc1NjU0LWFkZGl0aW9uYWwtc2VydmVyLXNpZGUtdmFsaWRhdGlvbi1jdXN0b20tZmllbGRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

14 years 2 days ago [\#75871](#75871) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[additional server side validation custom fields](/forum/2-general-talk-about-hikashop/75654-additional-server-side-validation-custom-fields#75871 "I need to write some more detailed validation code (not just only if the filed is empty, or not) for an item set custom field for our products. Where can I write this code?  Maik")*

You should create a new hikashop plugin and implement the trigger onFieldsLoad($types) and the corresponding class of the custom field type in order to add a new type of custom field.

Something like that:

&lt;?php
class plgHikashopMyfield extends JPlugin
{
function __construct(&amp;$subject, $config) {
parent::__construct($subject, $config);
}

function onFieldsLoad(&amp;$fields) {
$me = null;
$me-&gt;name = 'myfield';
$me-&gt;text = 'my field';
$me-&gt;js = 'allTypes["plg.myfield"] = new Array("required","default","columnname");';
$fields[] = $me;
}
}

if(defined('HIKASHOP_COMPONENT')) {
class hikashopMyfield{
//there you should define the different functions of the field classes: show (to display the value entered), display (to display the field), check (to check the value entered). You can take example on the classes in the file administrator/components/com_hikashop/classes/field.php
}
}

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc1NjU0LWFkZGl0aW9uYWwtc2VydmVyLXNpZGUtdmFsaWRhdGlvbi1jdXN0b20tZmllbGRzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.042 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
