How Magento's controller action which is C from MVC, Block-Layout-Template which is V from MVC and Collections-Helpers which is M from MVC work together to show custom data from a mysql table. It's a confusing concept for someone who is new to magento. Any help would be appreciated. Thanks.


2 Answers 2


You have to clear below points to understand well MVC format of Magento how works.

Basic understanding of mvc pattern in magento:

MVC stand for model-view-controller.

In magento controller acts as C of MVC. All url action management are execute here. This is the entry point for each request.

Block/Templates/Layout acts as V of MVC pattern.

All frontend data render and display of content goes here using xml and phtml files with call view files function inside Block.php file.

Model files acts as M of MVC pattern.

All Business related logics for any modules are process here. E.g. CRUD method of module are done here in model file.

Model files are used to define custom table relations and used for set-get collections. Modules afterSave , beforeSave, afterLoad , beforeLoad logic are defined inside models collection file.

Just example Customer account save logic are process here plus any customer add,delete or update information logic goes to model file.

In magento 1 sql folder are used to create database table, upgrade existing table schema.

Magento 2 Table defination/declaration and table upgrade related data are defined under Setup folder and remove sql folder concept.

Helper files in magento are used to define site specific global common functions.

As per define in above answer link tou can start more MVC patter in details.

Hope this will help you understand MVC pattern in magento.

  • Thanks for your answer and its really great help. Can you please describe how I can upgrade existing table schema in my module insidesql->install1.0.0.php Commented Aug 25, 2016 at 12:50
  • You can refer more info from here link inchoo.net/magento/… Commented Aug 25, 2016 at 13:28
  • good explanation! @Rakesh one correction controller is not an entry point of each request <root>/index.php or <root>/pub/index.php or cron.php or shell. [in magento2] +1 :-) Commented Aug 25, 2016 at 14:03
  • @Rakesh can you please help me regarding how I can add the custom menu to the top navigation of the frontend. I have tried a lot but its a nightmare now lol. I have two controller actions which I need to display on the top menu. Here is the links: **** **** Commented Aug 26, 2016 at 10:40
  • 1
    You can post your questions as new in brief and you getting anser related to your query. Commented Aug 26, 2016 at 10:44

Here is document link for Magento 1.


enter image description here

  • can you please check this one. It would be great help: magento.stackexchange.com/questions/133234/… Commented Aug 26, 2016 at 11:44
  • @muditmehrotra first answer is good for you Commented Aug 26, 2016 at 12:12
  • I am using the ghot theme for magent and there is no topmenu.phtml file inside the theme folder Commented Aug 26, 2016 at 12:15
  • There is top.links.phtml file inside the page/html folder of the theme Commented Aug 26, 2016 at 12:16
  • toplink show on top that is not top menu if you want to add there that is easy Commented Aug 26, 2016 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.