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

#   Add some extra field to category admin page by plugin

##

- **[mortezafs](/forum/user/67563-mortezafs "View mortezafs's Profile")**
- [![mortezafs's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/67563-mortezafs "View mortezafs's Profile") Topic Author
- [ Offline](/forum/user/67563-mortezafs)

Less More

- Posts: 2
- Thank you received: 2
-
-

4 years 4 months ago [\#343470](#343470) by [mortezafs](/forum/user/67563-mortezafs "View mortezafs's Profile")  *[Add some extra field to category admin page by plugin](/forum/26-product-category-display/904774-add-some-extra-field-to-category-admin-page-by-plugin#343470 "-- HikaShop version -- : 4.5.1 -- Joomla version -- : 4.1.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Mozila FireFox  Hi. I wan't to add some extra field in admin create/edit category form. I wrote a plugin to add some, but there is not useful event for adding fields to form. Anybody can give some guidance on how to add some new fields to the category fields using the plugin?  By regard.")* was created by *[mortezafs](/forum/user/67563-mortezafs "View mortezafs's Profile")*

-- HikaShop version -- : 4.5.1
-- Joomla version -- : 4.1.1
-- PHP version -- : 7.4
-- Browser(s) name and version -- : Mozila FireFox

Hi.
I wan't to add some extra field in admin create/edit category form. I wrote a plugin to add some, but there is not useful event for adding fields to form. Anybody can give some guidance on how to add some new fields to the category fields using the plugin?

By regard.

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

- **[Philip](/forum/user/34318-philip "View Philip's Profile")**
- [![Philip's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34318-philip "View Philip's Profile")
- [ Offline](/forum/user/34318-philip)

Less More

- Posts: 4820
- Thank you received: 652
-
-

4 years 4 months ago -  4 years 4 months ago [\#343473](#343473) by [Philip](/forum/user/34318-philip "View Philip's Profile")  Replied by *[Philip](/forum/user/34318-philip "View Philip's Profile")* on topic *[Add some extra field to category admin page by plugin](/forum/26-product-category-display/904774-add-some-extra-field-to-category-admin-page-by-plugin#343473 "-- HikaShop version -- : 4.5.1 -- Joomla version -- : 4.1.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Mozila FireFox  Hi. I wan't to add some extra field in admin create/edit category form. I wrote a plugin to add some, but there is not useful event for adding fields to form. Anybody can give some guidance on how to add some new fields to the category fields using the plugin?  By regard.")*

Hello,

When you develop a plugin for HikaShop, you can have some elements in our **[ Documentation](https://www.hikashop.com/support/documentation.html)**, here you will find some elements in our Developer Area.
I guess that you will find a solution by using the most useful trigger detailed, **[ here](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#category)**.

Hope this will help you to achieve your plugin.

Regards

Last edit: 4 years 4 months ago by [Philip](/forum/user/34318-philip "View Philip's Profile").

The following user(s) said Thank You: [levelup](/forum/user/61801-levelup "View levelup's Profile")

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

- **[mortezafs](/forum/user/67563-mortezafs "View mortezafs's Profile")**
- [![mortezafs's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/67563-mortezafs "View mortezafs's Profile") Topic Author
- [ Offline](/forum/user/67563-mortezafs)

Less More

- Posts: 2
- Thank you received: 2
-
-

4 years 4 months ago -  4 years 4 months ago [\#343533](#343533) by [mortezafs](/forum/user/67563-mortezafs "View mortezafs's Profile")  Replied by *[mortezafs](/forum/user/67563-mortezafs "View mortezafs's Profile")* on topic *[Add some extra field to category admin page by plugin](/forum/26-product-category-display/904774-add-some-extra-field-to-category-admin-page-by-plugin#343533 "-- HikaShop version -- : 4.5.1 -- Joomla version -- : 4.1.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Mozila FireFox  Hi. I wan't to add some extra field in admin create/edit category form. I wrote a plugin to add some, but there is not useful event for adding fields to form. Anybody can give some guidance on how to add some new fields to the category fields using the plugin?  By regard.")*

> Philip wrote: Hello,
>
> When you develop a plugin for HikaShop, you can have some elements in our **[ Documentation](https://www.hikashop.com/support/documentation.html)**, here you will find some elements in our Developer Area.
> I guess that you will find a solution by using the most useful trigger detailed, **[ here](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#category)**.
>
> Hope this will help you to achieve your plugin.
>
> Regards

Thank you for your help but i read this documentation before i create this topic.
In this duration to you response i found a solution. I'll share it with you. maybe someone need it in the feature.

I simulated the process of creating hikashop's custom fields in the plugin.
1- First of all you need create columns with name of your field in hikashop category table (#__hikashop_category)
2- Then you need append the fields you want to create with bellow structure to the $viewObj-&gt;fields array in onHikashopBeforeDisplayView event.
Note: The structure is the same for all type of field but there is some change with field type like singledropdown or textbox , ...
You can find more about the fields type special serialized data by creating filed in hikashop custom filed and looking to the #__hikashop_field table.
it so important to know the array key in $viewObj-&gt;fields is your field name and value should be an object.

The structure:
Code:

$viewObj-&gt;fields['namekey_of_field'] = (object) [ 'field_id' =&gt; '', 'field_table' =&gt; 'category', 'field_realname' =&gt; '', 'field_namekey' =&gt; '', 'field_type' =&gt; 'text', 'field_value' =&gt; '', 'field_published' =&gt; 1, 'field_ordering' =&gt; 1, 'field_options' =&gt; [ 'errormessage' =&gt; '', 'regex' =&gt; '', 'attribute' =&gt; '', 'placeholder' =&gt; '', 'inline' =&gt; '0', 'target_blank' =&gt; '1', 'allow_add' =&gt; '0', 'cols' =&gt; '', 'filtering' =&gt; '1', 'maxlength' =&gt; '0', 'rows' =&gt; '', 'zone_type' =&gt; 'country', 'pleaseselect' =&gt; '0', 'size' =&gt; '', 'format' =&gt; '%Y-%m-%d', 'allow' =&gt; '', 'allowed_extensions' =&gt; '', 'upload_dir' =&gt; '', 'max_filesize' =&gt; '0', 'max_width' =&gt; '0', 'max_height' =&gt; '0', 'multiple' =&gt; '0', 'readonly' =&gt; '0', 'mysql_query' =&gt; '', 'datepicker_options' =&gt; [ 'today' =&gt; '0', 'inline' =&gt; '0', 'monday_first' =&gt; '0', 'change_month' =&gt; '0', 'change_year' =&gt; '0', 'year_range_start' =&gt; '', 'year_range_end' =&gt; '', 'show_btn_panel' =&gt; '0', 'show_months' =&gt; '1', 'other_month' =&gt; '0', 'exclude_days_format' =&gt; 'mdY', 'waiting' =&gt; '', 'hour_extra_day' =&gt; '', 'check_dates' =&gt; 'all' ] ], 'field_core' =&gt; 0, 'field_required' =&gt; 0, 'field_default' =&gt; '', 'field_access' =&gt; 'all', 'field_categories' =&gt; 'all', 'field_with_sub_categories' =&gt; 0, 'field_products' =&gt; '', 'field_address_type' =&gt; '', 'field_frontcomp' =&gt; 0, 'field_backend' =&gt; 1, 'field_backend_listing' =&gt; 0, 'field_display' =&gt; null, 'field_shipping_id' =&gt; '', 'field_payment_id' =&gt; '', 'guest_mode' =&gt; true, 'field_url' =&gt; str_replace('/', '\/', JURI::base()) . '/administrator\/index.php?option=com_hikashop&amp;ctrl=field&amp;task=state&amp;tmpl=component&amp;' ];

Last edit: 4 years 4 months ago by [mortezafs](/forum/user/67563-mortezafs "View mortezafs's Profile"). Reason: Remove some commented code

The following user(s) said Thank You: [Philip](/forum/user/34318-philip "View Philip's Profile"), [levelup](/forum/user/61801-levelup "View levelup's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS85MDQ3NzQtYWRkLXNvbWUtZXh0cmEtZmllbGQtdG8tY2F0ZWdvcnktYWRtaW4tcGFnZS1ieS1wbHVnaW4/dG1wbD1tYXJrZG93bg==) 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.056 seconds

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