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

#   How to modify custom fields with a plug-in

##

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

Less More

- Posts: 45
- Thank you received: 0
-
-

8 years 8 months ago [\#287716](#287716) by [paulvanharen](/forum/user/20480-paulvanharen "View paulvanharen's Profile")  *[How to modify custom fields with a plug-in](/forum/31-development/893763-how-to-modify-custom-fields-with-a-plug-in#287716 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.1  I've created some custom fields for the table &quot;order&quot;, and a skeleton plug-in in plugins/hikashop. When the plugin is triggered by the onAfterOrderCreate event, I'd like to log some data in my newly created fields. I would expect the fields to be found in the order object, but alas!  Where can I access these order fields?  Thanks and regards, Paul")* was created by *[paulvanharen](/forum/user/20480-paulvanharen "View paulvanharen's Profile")*

-- HikaShop version -- : 3.2.2
-- Joomla version -- : 3.8.5
-- PHP version -- : 7.1

I've created some custom fields for the table "order", and a skeleton plug-in in plugins/hikashop. When the plugin is triggered by the onAfterOrderCreate event, I'd like to log some data in my newly created fields. I would expect the fields to be found in the order object, but alas!

Where can I access these order fields?

Thanks and regards, Paul

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

8 years 8 months ago [\#287719](#287719) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[How to modify custom fields with a plug-in](/forum/31-development/893763-how-to-modify-custom-fields-with-a-plug-in#287719 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.1  I've created some custom fields for the table &quot;order&quot;, and a skeleton plug-in in plugins/hikashop. When the plugin is triggered by the onAfterOrderCreate event, I'd like to log some data in my newly created fields. I would expect the fields to be found in the order object, but alas!  Where can I access these order fields?  Thanks and regards, Paul")*

Hello,

Order custom fields are in the order object ; if the object contains data to modify the field content.
But it's possible that a save do not contains the fields because it don't want to change the value.
It does not mean that you can't put some data into.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

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

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

Less More

- Posts: 45
- Thank you received: 0
-
-

8 years 8 months ago [\#287769](#287769) by [paulvanharen](/forum/user/20480-paulvanharen "View paulvanharen's Profile")  Replied by *[paulvanharen](/forum/user/20480-paulvanharen "View paulvanharen's Profile")* on topic *[How to modify custom fields with a plug-in](/forum/31-development/893763-how-to-modify-custom-fields-with-a-plug-in#287769 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.1  I've created some custom fields for the table &quot;order&quot;, and a skeleton plug-in in plugins/hikashop. When the plugin is triggered by the onAfterOrderCreate event, I'd like to log some data in my newly created fields. I would expect the fields to be found in the order object, but alas!  Where can I access these order fields?  Thanks and regards, Paul")*

Hi Jerome,

Do I understand correctly that the field is not available in case no value is set yet?
That would explain a lot.

Regards, Paul

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5Mzc2My1ob3ctdG8tbW9kaWZ5LWN1c3RvbS1maWVsZHMtd2l0aC1hLXBsdWctaW4/dG1wbD1tYXJrZG93bg==) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14269
-
-

8 years 8 months ago [\#287772](#287772) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to modify custom fields with a plug-in](/forum/31-development/893763-how-to-modify-custom-fields-with-a-plug-in#287772 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.1  I've created some custom fields for the table &quot;order&quot;, and a skeleton plug-in in plugins/hikashop. When the plugin is triggered by the onAfterOrderCreate event, I'd like to log some data in my newly created fields. I would expect the fields to be found in the order object, but alas!  Where can I access these order fields?  Thanks and regards, Paul")*

Hi,

Yes, In the $order object you get in onAfterOrderCreate , you only have the custom order fields that are being saved with the order creation. If your custom order field is not in the checkout, then it won't be in $order in that trigger.

But as Jerome said, you can run a MySQL query to set it.
Or you can even use the onBeforeOrderCreate trigger to set it in $order and it will be saved for you when the order is created in the database.

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5Mzc2My1ob3ctdG8tbW9kaWZ5LWN1c3RvbS1maWVsZHMtd2l0aC1hLXBsdWctaW4/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.177 seconds

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

[](#top)
