SlideShare una empresa de Scribd logo
1 de 9
OpenCart Code flow
Request and response in OpenCart
OpenCart Module Development
What this video series covers
Making hello world module
Workflow or markup to make hello world module
-- Installing a module
-- Configuration of module
-- Managing layout and position
-- Uninstalling the module
Admin files created to make hello world module
-- Controller creation
-- Language file creation
-- Template file creation
Front end files created to make hello world
-- Controller creation
-- Language file creation
-- Template file creation
OpenCart Flow
• Introduction
• Why OpenCart?
• Features of OpenCart
• Prerequisites
• Downloading example code
• Installing OpenCart
-Steps to create custom URL to work locally
• Describing folders and files of OpenCart
• OpenCart Code flow, Request and Response in
OpenCart
• Database table schema
• OpenCart Library Global Methods
From Opencart.com documentation
• As described in “OpenCart theme and Module development”
book, it says “OpenCart is an e-commerce shopping cart
application built with its own in-house framework which uses
MVCL (Model, view, controller and language) pattern. Thus,
each module in OpenCart also follows the MVCL pattern. The
controller creates logic and gathers data from the model and
it passes data to display in the view.”
• User request to the controller through website URL,
• controller loads the language and set the variable for any text
used in the data.
• If data is needed from the database controller loads the
model, ask for result and model send back results, then
controller set results to data.
• All these data are sent to View which renders and show the
output
OpenCart for Developer
OpenCart directories structure of MVCL
• Controller - Controller loads the language and set the
variable for any text used in the data. If data is needed
from the database controller loads the model, ask for
result and model send back results, then controller set
results to data.
• Model - Database layer - All calls to the database are
done. It is to structure db calls so that all other files
have access to the same db queries.
• View – Presentation/Template/display layer – Here we
write the html and inserted variables that we get from
the controller, we use twig here.
• Language - Localization/Language - This is layer is to
make the translation easy, variables and text are
assigned and this folder files are translated to the
respective language with the same variables name.
Request and Response in OpenCart
• OpenCart handles each request with simple pattern of URL requested
• Incoming requests are interpreted by the routing URL “route=“ and passed
to controller class method matching the URL route part which perform
business logics, loads respective data to returns Response objects to view.
• Each requested URL “route=” helps on finding respective folder and then
controller file.
• The routing system determines which Controller class method will be
executed based on information from the request and routing URL you've
passed.
• The term controller is a word you'll hear a lot, regardless of the language or
framework you use. It refers simply to the area of your code that processes
user input and prepares the response.
• Returns the appropriate Response object.
It’s that easy
• YES
• Each request executes a front controller file
• The routing system determines which Controller class method
will be executed based on information from the request and
routing URL you've passed.
• Returns the appropriate Response object.
Still confused
• Let’s see some example
http://webocreation.loc/index.php?route=account/login
Here “route=account/login”, it means that the controller to find in
opencart is catalog/controller/account/login.php as there is no third
one so by default the method is index().
• http://webocreation.loc/index.php?route=account/return/add
Here “route=account/return/add”, it means that the controller to find
in opencart is catalog/controller/account/return.php and method is
add().
For Opencart Programmer 
Controller
View
Model
Database
Request: GET value in URL
route=account/login
Response->output
$this->load->language('account/login');
$this->document->setTitle($this->language->get('heading_title’));
//loads the language file and assign to the data variable
$this->load->model(‘account/customer’);
// Check how many login attempts have been made.
$login_info = $this->model_account_customer->getLoginAttempts($this->request->post['email']);
//Controller logics here and set into a data variables
$data[‘email'] = ‘webocreation.com@gmail.com’;
$data['password'] = ‘’; // you can pass “Array, String, language string etc”
//Structure
$data['column_left'] = $this->load->controller('common/column_left');
$data['header'] = $this->load->controller('common/header');
$data['footer'] = $this->load->controller('common/footer’);
$this->response->setOutput($this->load->view(‘account/login', $data));
catalog/model/account/customer.php
public function getLoginAttempts($email) {
$query = $this->db->query("SELECT
* FROM `" . DB_PREFIX . "customer_login`
addCustomer($data) $this->db->query(INSERT)
editCustomer($customer_id, $data)
$this->db->query(UPDATE)
deleteCustomer($customer_id)
$this->db->query(DELETE)
getCustomer($customer_id)
$this->db->query(SELECT)
And many more
Catalog/view/theme/default*/template/account/l
ogin.twig
{{ header }}
<div>
{{ column_left }}
<div>
<div>
{{ text_new_customer }}
{{ email }}
<div>
{{ footer }}
Other html and css included
Which file? catalog/controller/account/login.php
Which controller? ControllerAccountLogin Which method? index
Request result
Response result
Language
$_['heading_title’] = 'Account Login’;
$_['text_new_customer’] = 'New Customer’;
//all of these variables are directly available in template
or twig files in OpenCart 3 but in OpenCart 2 you have to
assign for every variable in controller
Which file? cataloglanguageen-gbaccount/login.php
Which variable? heading_title
MVCL pattern, web flow, code flow, request and response in OpenCart

Más contenido relacionado

La actualidad más candente

Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Dilouar Hossain
 
Apex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXApex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXSergei Martens
 
Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansWindzoon Technologies
 
Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1asim78
 
Infinum Android Talks #09 - DBFlow ORM
Infinum Android Talks #09 - DBFlow ORMInfinum Android Talks #09 - DBFlow ORM
Infinum Android Talks #09 - DBFlow ORMInfinum
 
Weblogic Console Customization
Weblogic Console CustomizationWeblogic Console Customization
Weblogic Console CustomizationPeter van Nes
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsSam Dias
 
Weblogic Console Customization labs
Weblogic Console Customization labsWeblogic Console Customization labs
Weblogic Console Customization labsPeter van Nes
 
Java SE 7 New Features and Enhancements
Java SE 7 New Features and EnhancementsJava SE 7 New Features and Enhancements
Java SE 7 New Features and EnhancementsFu Cheng
 
A User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHubA User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHubRumyana Rumenova
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introductionSimon Funk
 
redCORE: an abstracted development layer for Joomla! - JWC14
redCORE: an abstracted development layer for Joomla! - JWC14redCORE: an abstracted development layer for Joomla! - JWC14
redCORE: an abstracted development layer for Joomla! - JWC14Tito Alvarez
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5Soheil Khodayari
 

La actualidad más candente (20)

What Is Hobo ?
What Is Hobo ?What Is Hobo ?
What Is Hobo ?
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
 
Apex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXApex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEX
 
Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web Artisans
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1
 
Infinum Android Talks #09 - DBFlow ORM
Infinum Android Talks #09 - DBFlow ORMInfinum Android Talks #09 - DBFlow ORM
Infinum Android Talks #09 - DBFlow ORM
 
Weblogic Console Customization
Weblogic Console CustomizationWeblogic Console Customization
Weblogic Console Customization
 
MVC Web Application
MVC Web ApplicationMVC Web Application
MVC Web Application
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 Projects
 
Weblogic Console Customization labs
Weblogic Console Customization labsWeblogic Console Customization labs
Weblogic Console Customization labs
 
Java SE 7 New Features and Enhancements
Java SE 7 New Features and EnhancementsJava SE 7 New Features and Enhancements
Java SE 7 New Features and Enhancements
 
A User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHubA User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHub
 
72d5drupal
72d5drupal72d5drupal
72d5drupal
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introduction
 
redCORE: an abstracted development layer for Joomla! - JWC14
redCORE: an abstracted development layer for Joomla! - JWC14redCORE: an abstracted development layer for Joomla! - JWC14
redCORE: an abstracted development layer for Joomla! - JWC14
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
 
Java
JavaJava
Java
 

Similar a MVCL pattern, web flow, code flow, request and response in OpenCart

(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service BIOVIA
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introductionFajar Baskoro
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8Thomas Robbins
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Thomas Robbins
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_HourDilip Patel
 
Lecture 4_Laravel Controller and Data Pass-Route.pptx
Lecture 4_Laravel Controller and Data Pass-Route.pptxLecture 4_Laravel Controller and Data Pass-Route.pptx
Lecture 4_Laravel Controller and Data Pass-Route.pptxSaziaRahman
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handsonPrashant Kumar
 
Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3kidtangerine
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.pptkstalin2
 
Ei cakephp
Ei cakephpEi cakephp
Ei cakephpeiei lay
 
(ATS6-DEV03) Building an Enterprise Web Solution with AEP
(ATS6-DEV03) Building an Enterprise Web Solution with AEP(ATS6-DEV03) Building an Enterprise Web Solution with AEP
(ATS6-DEV03) Building an Enterprise Web Solution with AEPBIOVIA
 
SOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesSOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesVagif Abilov
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHPEdureka!
 

Similar a MVCL pattern, web flow, code flow, request and response in OpenCart (20)

Codeigniter
CodeigniterCodeigniter
Codeigniter
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service
 
Introduction to CakePHP
Introduction to CakePHPIntroduction to CakePHP
Introduction to CakePHP
 
Introduction to CakePHP
Introduction to CakePHPIntroduction to CakePHP
Introduction to CakePHP
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_Hour
 
Lecture 4_Laravel Controller and Data Pass-Route.pptx
Lecture 4_Laravel Controller and Data Pass-Route.pptxLecture 4_Laravel Controller and Data Pass-Route.pptx
Lecture 4_Laravel Controller and Data Pass-Route.pptx
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlet1.ppt
Servlet1.pptServlet1.ppt
Servlet1.ppt
 
MVC by asp.net development company in india
MVC by asp.net development company in indiaMVC by asp.net development company in india
MVC by asp.net development company in india
 
Ei cakephp
Ei cakephpEi cakephp
Ei cakephp
 
Cakeph pppt
Cakeph ppptCakeph pppt
Cakeph pppt
 
(ATS6-DEV03) Building an Enterprise Web Solution with AEP
(ATS6-DEV03) Building an Enterprise Web Solution with AEP(ATS6-DEV03) Building an Enterprise Web Solution with AEP
(ATS6-DEV03) Building an Enterprise Web Solution with AEP
 
SOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesSOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class Libraries
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHP
 

Último

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Último (20)

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

MVCL pattern, web flow, code flow, request and response in OpenCart

  • 1. OpenCart Code flow Request and response in OpenCart OpenCart Module Development
  • 2. What this video series covers Making hello world module Workflow or markup to make hello world module -- Installing a module -- Configuration of module -- Managing layout and position -- Uninstalling the module Admin files created to make hello world module -- Controller creation -- Language file creation -- Template file creation Front end files created to make hello world -- Controller creation -- Language file creation -- Template file creation OpenCart Flow • Introduction • Why OpenCart? • Features of OpenCart • Prerequisites • Downloading example code • Installing OpenCart -Steps to create custom URL to work locally • Describing folders and files of OpenCart • OpenCart Code flow, Request and Response in OpenCart • Database table schema • OpenCart Library Global Methods
  • 3. From Opencart.com documentation • As described in “OpenCart theme and Module development” book, it says “OpenCart is an e-commerce shopping cart application built with its own in-house framework which uses MVCL (Model, view, controller and language) pattern. Thus, each module in OpenCart also follows the MVCL pattern. The controller creates logic and gathers data from the model and it passes data to display in the view.” • User request to the controller through website URL, • controller loads the language and set the variable for any text used in the data. • If data is needed from the database controller loads the model, ask for result and model send back results, then controller set results to data. • All these data are sent to View which renders and show the output OpenCart for Developer
  • 4. OpenCart directories structure of MVCL • Controller - Controller loads the language and set the variable for any text used in the data. If data is needed from the database controller loads the model, ask for result and model send back results, then controller set results to data. • Model - Database layer - All calls to the database are done. It is to structure db calls so that all other files have access to the same db queries. • View – Presentation/Template/display layer – Here we write the html and inserted variables that we get from the controller, we use twig here. • Language - Localization/Language - This is layer is to make the translation easy, variables and text are assigned and this folder files are translated to the respective language with the same variables name.
  • 5. Request and Response in OpenCart • OpenCart handles each request with simple pattern of URL requested • Incoming requests are interpreted by the routing URL “route=“ and passed to controller class method matching the URL route part which perform business logics, loads respective data to returns Response objects to view. • Each requested URL “route=” helps on finding respective folder and then controller file. • The routing system determines which Controller class method will be executed based on information from the request and routing URL you've passed. • The term controller is a word you'll hear a lot, regardless of the language or framework you use. It refers simply to the area of your code that processes user input and prepares the response. • Returns the appropriate Response object.
  • 6. It’s that easy • YES • Each request executes a front controller file • The routing system determines which Controller class method will be executed based on information from the request and routing URL you've passed. • Returns the appropriate Response object.
  • 7. Still confused • Let’s see some example http://webocreation.loc/index.php?route=account/login Here “route=account/login”, it means that the controller to find in opencart is catalog/controller/account/login.php as there is no third one so by default the method is index(). • http://webocreation.loc/index.php?route=account/return/add Here “route=account/return/add”, it means that the controller to find in opencart is catalog/controller/account/return.php and method is add().
  • 8. For Opencart Programmer  Controller View Model Database Request: GET value in URL route=account/login Response->output $this->load->language('account/login'); $this->document->setTitle($this->language->get('heading_title’)); //loads the language file and assign to the data variable $this->load->model(‘account/customer’); // Check how many login attempts have been made. $login_info = $this->model_account_customer->getLoginAttempts($this->request->post['email']); //Controller logics here and set into a data variables $data[‘email'] = ‘webocreation.com@gmail.com’; $data['password'] = ‘’; // you can pass “Array, String, language string etc” //Structure $data['column_left'] = $this->load->controller('common/column_left'); $data['header'] = $this->load->controller('common/header'); $data['footer'] = $this->load->controller('common/footer’); $this->response->setOutput($this->load->view(‘account/login', $data)); catalog/model/account/customer.php public function getLoginAttempts($email) { $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "customer_login` addCustomer($data) $this->db->query(INSERT) editCustomer($customer_id, $data) $this->db->query(UPDATE) deleteCustomer($customer_id) $this->db->query(DELETE) getCustomer($customer_id) $this->db->query(SELECT) And many more Catalog/view/theme/default*/template/account/l ogin.twig {{ header }} <div> {{ column_left }} <div> <div> {{ text_new_customer }} {{ email }} <div> {{ footer }} Other html and css included Which file? catalog/controller/account/login.php Which controller? ControllerAccountLogin Which method? index Request result Response result Language $_['heading_title’] = 'Account Login’; $_['text_new_customer’] = 'New Customer’; //all of these variables are directly available in template or twig files in OpenCart 3 but in OpenCart 2 you have to assign for every variable in controller Which file? cataloglanguageen-gbaccount/login.php Which variable? heading_title

Notas del editor

  1. It's that easy! Yes!