Home - xerocrypt/opencart GitHub Wiki

Overview

The OpenCart system follows the MVC (Model, View, Controller) pattern. A simple description of how this works is that a View determines the layout and appearance of a Web site, whereas the content itself is generated and inserted into the View by a Controller. A Model contains data objects that represent database entities being processed by the Controller.

With OpenCart, we have a more complicated implementation of the MVC pattern, mainly because a site's appearance isn't actually determined by a set of HTML/CSHTML files in the /views directory. Also, the pattern is mirrored in the /admin and /catalog directories.

There are a collection of .twig files in /view/theme/default/template/common. These, as I understand, are template files that define the general sections of the Web site's interface, such as right column, left column, header and footer. Beyond the general layout, they don't determine the appearance of an opencart site.

Most users will modify the appearance of an opencart site by adding, removing and configuring modules, through the dashboard. These modules are inserted into the page sections defined by the .twig template files. The views for these modules are found in /view/theme/default/template/extension/module. Styling is determined by stylesheet.css in /view/theme/default/stylesheet. This means, of course, user cannot modify the site by adding arbitrary HTML/JavaScript code, but is limited to what the installed modules allow.

In order to change the site's content or add functionality, we must develop at least one module to be installed through the opencart dashboard - i.e. insert a controller, view and template file.