Skip to main content

Override function in helper.php

More
5 years 2 months ago #334251 by braverman
-- 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.

More
5 years 2 months ago #334252 by nicolas
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.

More
5 years 2 months ago - 5 years 2 months ago #334286 by braverman
Super, thanks, I'll do it this way. It would be fine to mention these events in Hikashop developer documentation.

Jan
Last edit: 5 years 2 months ago by braverman.

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

More
5 years 2 months ago #334287 by nicolas
Hi,

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

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

More
4 years 1 week ago #344596 by Bender
What is helpers ?

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

More
4 years 1 week ago #344601 by nicolas
Hi,

Joomla is based on the MVC model ( en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller ). And HikaShop too.
So in HikaShop's folder, you'll find "classes" which is for the models, "controllers", for the controllers and "views" for the views.
The "helpers" folder contains files with helpers that can be used by the MVC elements which aren't tied to one view, one controller or one model. For example the "translation" helper has functions that are used by the views and controllers to manage the translations of the content.

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

Time to create page: 0.208 seconds
Powered by Kunena Forum