First plugin/module for joomla 4 admin panel, fresh impressions, subjective opinion

After the first plugin for WordPress, we decided to write the same plugin for Joomla, which seems to be the second most popular system.

We continue to pursue our idea – to provide the site user with the ability to manage equipment connected locally to his computer.

The theme is basically new and requires a second one on the user's PC server programwhich can already communicate directly with equipment connected to the PC.

Communication between the Joomla plugin and the server is standard via http post json requests to localhost to the server.

What happens as a result?

Essentially, the capabilities of a regular inventory management system are added to your cloud program.

When these features might be useful.

For example, there is a need in the admin panel to accept payment for an order in cash or by card. To do this, the seller must use a cash register and/or a bank terminal.

Now about joomla

Downloaded joomla 4.4.8 at random, so as not to get the latest or the oldest.

The first feeling is that the developers don't bother with documentation. There is a Russian-language forum, they help, but still it seems that joomla is for those who do not look for help from outside, but prefer to study the php code, so to speak, live from the inside (meaning with a debugger).

Need a store

So we need a so-called component of the store type, where the order mechanism is implemented. In Joomla there are several such stores JoomShopping, VirtueMartlike joomKassa and maybe there are a few more. This is what distinguishes Joomla from WordPress, where there is only one WooCommerce.

We choose the first thing that comes to hand JoomShopping.

Module, component, plugin, addon, container, extension,…

Firstwhat we had to understand is that the JoomShopping store, like any store in Joomle, is a component and the code of this component (application) is for us you can't editsince we want to make a universal extension that will work on all sites after installation without modifications to the store itself.

Secondwhat we had to understand is that only events emitted from JoomShopping will be able to help us, specifically those events that transmit the contents of the order so that we can print a receipt, for example.

Thirdwhat we had to understand is that only a plugin can subscribe to events. Which means we need a plugin anyway.

FourthWhat I had to understand was that the plugin had to load before the store page opened the order so that the plugin could receive the event from the store.

And here it turns out that it looks like we need a system plugin, that is, a plugin that has in its manifest group=”system”.

Module

Fifthwhat I had to understand is that it seems that only the module can display the content of our functionality in the window.

Let's say you need to display a couple of buttons and a couple of labels in a module, that is, a small one in terms of content.

The module is displayed in the position specified by the admin user; for example, in our case we display it in top so that it is always displayed at the top of the screen.

In this case, the store order will be visually displayed immediately below our module.

Sixththat it was necessary to understand that the plugin, receiving the contents of the order in the event, must save the order in itself (in the class variable), so that later the module, when it starts to be loaded into the system, could pick up the order contents from the plugin and form an interface for managing the equipment.

I may be wrong and most likely I am definitely wrong somewhere and there is a simpler way, but for us this is the only option that has worked so far.

That is, as a result there is a module and a system plugin.

Note: it should be noted that Joomla works faster than WordPress in the same OS and on the same hardware on a local host.

addScript

A strange nuance in the admin panel is observed when adding your js or css file through the addScript call, namely addScript adds /administrator/… at the beginning of the path to the file, which will definitely not lead to the storage location of media resources such as js and css.

You have to precede the path to the js file with a transition to a higher directory level, that is, add ../ at the beginning of the path.

I don't know if it's possible to post a video here (short) showing the process of installing and configuring the plugin, because although it's free, the second part – the BIT driver KKT program (server) is paid. I don't want to be banned again.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *