What about know more about the Opencart structure?
Hello everyone! Today i will talk a little about the Opencart structure. If you don’t know, Opencart is a simple and powerful e-commerce platform developed using php/mysql and you can download the software for free at this Link.
The Opencart structure
The system was developed according to the classical MVC paradigm, with a well separation between Models, Views and Controls. Other unity is the language models, responsible to make multi-lingual stores at the same administration and templates.
For understand Opencart or another system, is realy important understand how these urls was built, see this example:
This is the category page, where route indicates how controller was loaded, in this case the controller is category, located at product folder after that in path parameter is located the current category id.
Two different worlds
One of the worst things on the system is the full separation between the system front and system admin, both have their own MVC structure and because that we need to repeat a lot of code on the both sides… This is a really waste of energy.
Understanding the Opencart Sintax
See the example of controller about the above url
We have her the classical controller creation and the definition of the first method, called getCategory, after that the language module was loaded following the same approach (folder/file name) at the same style was loaded 2 models.
A bit more
In this case we have on first line the search of category details, by the getCategory call realized to the loaded model, as you can see the pattern was fixed on the model call like:
After that whe have some calls to template methods used to attribute values who will be used on the template files, all data to be used on the template need to be added to $this->data array.
Thats it people, see you on the next week talking more about the Opencart, sorry about the English mistakes 🙂
Like? Dislike? Comment Above!
Until next time!