Override function in helper.php

  • Posts: 12
  • Thank you received: 0
  • Hikashop Business
2 months 1 week ago #334251

-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.9.28
-- PHP version -- : 7.4.20
-- Browser(s) name and version -- : all

Hi,

I have a question how to correctly override function in /administrator/components/com_hikashop/helpers/helper.php? I need to change a little the generation of order number in hikashop_encode function. I know how to override some class in helpers (eg image.php) but don't know how to do it with this helper functions.

Thanks, Jan

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

  • Posts: 73703
  • Thank you received: 11298
  • MODERATOR
2 months 1 week ago #334252

Hi,

Well, it's possible to override the whole function with a system plugin implementing a function of the same name.
However, I would rather recommend you do a normal plugin of the group "hikashop" and implement the onBeforeOrderNumberGenerate(&$data, &$result) and / or the onBeforeInvoiceNumberGenerate(&$data, &$result) events.
In $data, you'll have the information of the order and you can just set in $result whatever you want and it will become the order / invoice number.
If you want to know how to make a plugin, you can read the two first parts of the page www.hikashop.com/support/documentation/6...mentation.html#intro and use the link to the Joomla documentation which goes in depth about creating plugins for Joomla.

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

  • Posts: 12
  • Thank you received: 0
  • Hikashop Business
2 months 1 week ago #334286

Super, thanks, I'll do it this way. It would be fine to mention these events in Hikashop developer documentation.

Jan

Last edit: 2 months 1 week ago by braverman.

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

  • Posts: 73703
  • Thank you received: 11298
  • MODERATOR
2 months 1 week ago #334287

Hi,

Thanks for the feedback. I've added these to the developer documentation.

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

Time to create page: 0.063 seconds
Powered by Kunena Forum