Understanding MVC Architectural Pattern in OpenCart

understanding mvc in opencart

In earlier article we discussed about OpenCart basic installation on local environment if you missed out that checkout through earlier post. MVC plays mandatory role on OpenCart framework, in fact OpenCart’s developers marginally changed classical MVC architectural pattern and added new element Language to OpenCart front-end. Now it’s called as MVC-L pattern.

Understanding MVC Architectural Pattern

MVC acronym for Model View Controller, In MVC Pattern controller act as administrator, View and Model are a slave. you might see these three folders on site’s admin and catalog directories. Site’s back-end files resides at admin directory as like as front-end files stores at catalog directory.

As an example take register page, this URL looks like http://www.example.com/index.php?route=account/register . Above page clearly explains where  templates come from. Whenever you ask register page from browser controller receiving the request and retrieving data from Model and Language directories and eventually connects with view directory. Easily find controller action for register page via following path controller/account/register.php Template file for above register page can be found at catalog/view/default/template/account/register.tpl

All templates files resides under catalog/view/…/template directory except certain common templates. OpenCart has clear file structure, where by it stores common template under controller/common directory. Don’t be confused with .tpl extension because it written in PHP, that means template file. Further, you can see more great features and change log from GitHub.

You may also like...

Leave a Reply

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