N
N
Nikita Reshetnyak2022-03-03 09:05:38
opencart
Nikita Reshetnyak, 2022-03-03 09:05:38

How to manage categories and products from a module in OpenCart3?

I am writing a module for importing goods through the vendor API, the question is whether it is possible to remove / add a category / product from my module, tell me exactly how it is not difficult for anyone.

And the second question, on the form of the module there is a button that sends JSON to the module, is it possible to somehow specify an action in the request, now I made a crutch that looks at one of the get parameters and calls a method in the controller using it, I think that there is a more kosher method for this affairs.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2022-03-03
@trjflash

The answer to all your questions is in the Opencart files.
Look at the category controller in the admin section - you will see how to work with categories. The same goes for the product.
In short - connect the category / product model to your module - and use ready-made functions for your work.
See how the product is being purchased - opencart also sends JSON to the cart.php controller - see how cart.php processes it....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question