OpenCart v1.x Framework Explanation
1 post
• Page 1 of 1
OpenCart v1.x Framework Explanation
OpenCart 1.x uses an MVC(+L) style framework. The +L isn't part of the framework persay, but it is important to understand the localization and how text for different languages is used:
First off, OpenCart's root directory looks something like this:
admin - the admin directory path is all the code on the front end of your site. This is completely separate from the catalog area and can even be stored on a different host if you prefer.
catalog - the catalog directory path stores all the code on the front end of your site
image - the image directory path is where all the product images are stored
download - the download directory path is where all the downloads are stored
system - the system path has all the common libraries and engine code. Both admin and catalog use this folder, so if storing admin on another server, you will also need to copy the system folder there.
In the catalog and admin directories, a common tree based on the MVC(+L) architecture is formed:
Model - Database layer - All calls to the database are done here, referenced from the controller
View - Template display - This is where the HTML and designing is done in the respective tpl files.
Controller - Main controlling code base - This is where the functional code logic is processed
Language - Localization/Language - This is where you set which constants translate to text for things like heading titles, static links and text, etc.
So for example, for the product page on the frontend, there are 4 main files:
M: \catalog\model\catalog\product.php
V: \catalog\view\theme\default\template\product\product.tpl
C: \catalog\controller\product\product.php
L: \catalog\language\english\product\product.php
Similarly, on the admin side, to set those fields, there are 4 main files as well:
M: \admin\model\catalog\product.php
V: \admin\view\template\catalog\product_form.tpl
C: \admin\controller\catalog\product.php
L: \admin\language\english\catalog\product.php
Try to follow those files for existing fields, like 'model number' and see if you can duplicate all the places you find model number being used and replace it with your new field(s). Don't forget to also add the new columns to the product table in the database.
First off, OpenCart's root directory looks something like this:
admin - the admin directory path is all the code on the front end of your site. This is completely separate from the catalog area and can even be stored on a different host if you prefer.
catalog - the catalog directory path stores all the code on the front end of your site
image - the image directory path is where all the product images are stored
download - the download directory path is where all the downloads are stored
system - the system path has all the common libraries and engine code. Both admin and catalog use this folder, so if storing admin on another server, you will also need to copy the system folder there.
In the catalog and admin directories, a common tree based on the MVC(+L) architecture is formed:
Model - Database layer - All calls to the database are done here, referenced from the controller
View - Template display - This is where the HTML and designing is done in the respective tpl files.
Controller - Main controlling code base - This is where the functional code logic is processed
Language - Localization/Language - This is where you set which constants translate to text for things like heading titles, static links and text, etc.
So for example, for the product page on the frontend, there are 4 main files:
M: \catalog\model\catalog\product.php
V: \catalog\view\theme\default\template\product\product.tpl
C: \catalog\controller\product\product.php
L: \catalog\language\english\product\product.php
Similarly, on the admin side, to set those fields, there are 4 main files as well:
M: \admin\model\catalog\product.php
V: \admin\view\template\catalog\product_form.tpl
C: \admin\controller\catalog\product.php
L: \admin\language\english\catalog\product.php
Try to follow those files for existing fields, like 'model number' and see if you can duplicate all the places you find model number being used and replace it with your new field(s). Don't forget to also add the new columns to the product table in the database.
-

Qphoria - Global Moderator
- Posts: 10193
- Joined: Mon Jul 21, 2008 7:02 pm
1 post
• Page 1 of 1
Who is online
Users browsing this forum: abrb, Baidu [Spider], Google [Bot], konservasi, PeterK and 13 guests


