8/9/2019 Testing Opencart
1/243
Help Site
OpenCart documentation Designer Guide
Table of Contents
System requirements 1
Getting started 2
Where to download 2
System / server requirements
!ser Guide "
!ser Guide "
Getting Started #
$rowsing the store %ront 1"
&dmin inter%ace 2'
Catalog 2
Catalog 2
()tension "
()tensions "
8/9/2019 Testing Opencart
2/243
Sales #
Sales #
*eports +
*eports +
System ,
System ,
Help -
.iscellaneous "1
.iscellaneous "1
System &dministrator guide "
System administrator guide "
&dding multiple languages ""
Creating a multistore ",
0mage upload #
.oving OpenCart to a new server #1
S(O eywords #2
SS3 Certi%icates and H445S #"
8/9/2019 Testing Opencart
3/243
v6mod#+
$asic security practices #'
Developer guide +1
Developer guide +1
0ntroduction to .7C3 +2
&dding multiple languages +"
Developing modules +,
Developing modules +,
Developing new product %eeds ,2
3oading %iles in the controller ,#
Designer Guide ,-
Designer Guide ,-
Creating a custom theme ,'
8/9/2019 Testing Opencart
4/243
8/9/2019 Testing Opencart
5/243
Copyright 8 21" OpenCart 3imited 5age
8/9/2019 Testing Opencart
6/243
8/9/2019 Testing Opencart
7/243
8/9/2019 Testing Opencart
8/243
Copyright 8 21" OpenCart 3imited 5age 1
8/9/2019 Testing Opencart
9/243
8/9/2019 Testing Opencart
10/243
8/9/2019 Testing Opencart
11/243
Copyright 8 21" OpenCart 3imited 5age 2
8/9/2019 Testing Opencart
12/243
Help Site
Getting started
OpenCart documentation
We9 Server >&pache suggested?
5H5 >at least #:2?
Data9ase >.yS63i suggested?
Required PHP libraries / modules
Curl
A05
Ali9
GD 3i9rary
.crypt
.9strings
4he a9ove 5H5 e)tensions should 9e availa9le 9y almost all hosting providers< during the install processa it will chec you have them
all ena9led: @ou should contact your hosting provider i% one is missing:
8/9/2019 Testing Opencart
13/243
8/9/2019 Testing Opencart
14/243
Copyright 8 21" OpenCart 3imited 5age
8/9/2019 Testing Opencart
15/243
Help Site
!ser Guide
OpenCart documentation
User Guide
Sip to end o% metadata
&ttachments=2
&dded 9y Catherine BHostars< last edited 9y enni%er BHostarson Oct 1< 21 >view change?
Go to start o% metadata
Eone
http://docs.opencart.com/pages/viewpageattachments.action?pageId=753677&metadataLink=truehttp://docs.opencart.com/pages/viewpageattachments.action?pageId=753677&metadataLink=truehttp://docs.opencart.com/pages/viewpageattachments.action?pageId=753677&metadataLink=true8/9/2019 Testing Opencart
16/243
1 Child 5ages
5age= Getting Started5age= $rowsing the store %ront5age=&dmin
inter%ace5age= Catalog5age= ()tensions5age= Sales5age= *eports5age= System5age= Help5age= .iscellaneous
&dd tothedocumentation
Get help %rom
$uy the !ser Guide 5D;
Get import
the community
tools and modules
http://docs.opencart.com/display/opencart/Admin%20interfacehttp://docs.opencart.com/display/opencart/Admin%20interfacehttp://docs.opencart.com/display/opencart/Admin%20interfacehttp://docs.opencart.com/display/opencart/Admin%20interfacehttp://docs.opencart.com/display/opencart/Cataloghttp://docs.opencart.com/display/opencart/Extensionshttp://docs.opencart.com/display/opencart/Saleshttp://docs.opencart.com/display/opencart/Reportshttp://docs.opencart.com/display/opencart/Reportshttp://docs.opencart.com/display/opencart/Systemhttp://docs.opencart.com/display/opencart/Helphttp://docs.opencart.com/display/opencart/Helphttp://docs.opencart.com/display/opencart/Miscellaneoushttp://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/moduleshttp://docs.opencart.com/display/opencart/Admin%20interfacehttp://docs.opencart.com/display/opencart/Admin%20interfacehttp://docs.opencart.com/display/opencart/Cataloghttp://docs.opencart.com/display/opencart/Extensionshttp://docs.opencart.com/display/opencart/Saleshttp://docs.opencart.com/display/opencart/Reportshttp://docs.opencart.com/display/opencart/Systemhttp://docs.opencart.com/display/opencart/Helphttp://docs.opencart.com/display/opencart/Miscellaneoushttp://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/modules8/9/2019 Testing Opencart
17/243
8/9/2019 Testing Opencart
18/243
Help Site
!ser Guide
OpenCart documentation
Getting Started
Sip to end o% metadata
&ttachments=,
&dded 9y ustin BHostars< last edited 9y enni%er BHostarson Oct 2< 21 >view change?
Go to start o% metadata
4here are a num9er o% steps required a%ter installing OpenCart to get started selling %rom your online store: 4his page is
a help%ul guide to getting started: &n OpenCart store is comprised o% a ;rontend and&dmin inter%ace: 4his guide will
primarily %ocus on &dmin inter%ace %unctions and settings: 4hese settings should 9e tested on the %rontend 9e%ore your
site is launched: ;ollowing the steps in this guide will get your store to a ready to use state %rom installation: 4his guide
assumes that you have admin login credentials and are a9le to login to your storeFs &dmin inter%ace via
yourdomain:com/admin< %or e)ample= http=//demo:hostIars:com/admin:
http://docs.opencart.com/pages/viewpageattachments.action?pageId=2326574&metadataLink=truehttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20fronthttp://docs.opencart.com/pages/viewpageattachments.action?pageId=2326574&metadataLink=truehttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front8/9/2019 Testing Opencart
19/243
8/9/2019 Testing Opencart
20/243
8/9/2019 Testing Opencart
21/243
8/9/2019 Testing Opencart
22/243
8/9/2019 Testing Opencart
23/243
8/9/2019 Testing Opencart
24/243
8/9/2019 Testing Opencart
25/243
8/9/2019 Testing Opencart
26/243
Help Site
!ser Guide
OpenCart documentation
8/9/2019 Testing Opencart
27/243
8/9/2019 Testing Opencart
28/243
8/9/2019 Testing Opencart
29/243
8/9/2019 Testing Opencart
30/243
8/9/2019 Testing Opencart
31/243
4he Display (rrors option should always 9e set to Eo %or a live store: 4his will prevent your customers seeing any
errors in your storeFs code while using your site: @our developer will still 9e a9le to diagnose and repair these issues
using the error logs:
Copyright 8 21" OpenCart 3imited 5age '
8/9/2019 Testing Opencart
32/243
8/9/2019 Testing Opencart
33/243
8/9/2019 Testing Opencart
34/243
Copyright 8 21" OpenCart 3imited 5age 1
8/9/2019 Testing Opencart
35/243
8/9/2019 Testing Opencart
36/243
8/9/2019 Testing Opencart
37/243
0% you have product speci%ic ta) rates< you need to de%ine each o% these ta) rates under the 4a) *ates page: @ou will later
choose which ta) rate applies to each product< so you will 9e a9le to manage your product speci%ic ta)es at the product
level:
Copyright 8 21" OpenCart 3imited 5age 11
8/9/2019 Testing Opencart
38/243
8/9/2019 Testing Opencart
39/243
8/9/2019 Testing Opencart
40/243
8/9/2019 Testing Opencart
41/243
Help Site
!ser Guide
OpenCart documentation
categories< manu%acturers and products your store will sell: 4here are two recommended ways to do this=
@ou can manually edit these under the Catalog menu in your OpenCart storeFs admin:
@ou can use an import toolto simpli%y the upload o% your products in 9ul: 4his is more practical %or larger inventories or
dropshippers< and will allow you to remove all e)isting items and replace them at the same time:
&"tensions' %odules and T$emes
OpenCart %unctionality< loo and %eel are all controlled 9y modules and themes: 4he %inal step to get started with
OpenCart is to chec your ()tensions .odules page to ensure the %unctionality you want is ena9led: 4he de%ault
9anners can 9e modi%ied under System $anners< or removed via the Slideshow module at this point: @ou can also
choose other modules that you wish to display< and the pages you wish to display them: 4he OpenCart de%aults are
sensi9le and will not necessarily need editing to get started< e)cept %or the de%ault home page 9anners< which are %or
demonstration purposes only:
0% you do not %ind the %unctionality you need in your store< you can o%ten add it as a rd 5arty ()tension:
8/9/2019 Testing Opencart
42/243
8/9/2019 Testing Opencart
43/243
8/9/2019 Testing Opencart
44/243
8/9/2019 Testing Opencart
45/243
Shopping Cart page
Creating an account
Checout
Store %ront customiKation using the admin dash9oard
(ro#sing t$e store front
4his guide is intended to 9e used as an introduction to the OpenCart de%ault store %ront: 4he store %ront reveals how the
customer views and interacts with the store:
T$e default t$eme
OpenCart comes with a de%ault theme a%ter a %resh installation=
http://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-ShoppingCartpagehttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-Creatinganaccounthttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-Creatinganaccounthttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-Checkouthttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-Checkouthttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-Storefrontcustomizationusingtheadmindashboardhttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-ShoppingCartpagehttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-Creatinganaccounthttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-Checkouthttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front#Browsingthestorefront-Storefrontcustomizationusingtheadmindashboard8/9/2019 Testing Opencart
46/243
8/9/2019 Testing Opencart
47/243
8/9/2019 Testing Opencart
48/243
8/9/2019 Testing Opencart
49/243
Copyright 8 21" OpenCart 3imited 5age 1#
8/9/2019 Testing Opencart
50/243
Help Site
!ser Guide
OpenCart documentation
8/9/2019 Testing Opencart
51/243
8/9/2019 Testing Opencart
52/243
Welcome text: Welcomes the visitor and gives them an option to JloginJ or Jcreate an accountJ: Whenlogged in it will
display J@ou are logged in as B%irst nameJ and gives an option to log out:
Links: 3ins the customer to the Home page< Wish 3ist< .y &ccount< Shopping Cart< and Checout:
T$e to! menu
4he top menu category only displays the top parent categories o% products: See Categories %or more in%ormation on how
to create and assign product categories:
Copyright 8 21" OpenCart 3imited 5age 1+
http://docs.opencart.com/display/opencart/Categorieshttp://docs.opencart.com/display/opencart/Categories8/9/2019 Testing Opencart
53/243
8/9/2019 Testing Opencart
54/243
8/9/2019 Testing Opencart
55/243
4he slideshow displays several product 9anners o% your choice 9y alternating the images in a slideshow: &%ter a certain
amount o% time< one 9anner will shi%t to the the ne)t 9anner: $anners in this slideshow are use%ul %or highlighting certain
products to 9e easily accessi9le 9y the customer: When the 9anner is cliced on< the customer will 9e directed to the
product on the 9annerFs page:
Copyright 8 21" OpenCart 3imited 5age 1,
8/9/2019 Testing Opencart
56/243
8/9/2019 Testing Opencart
57/243
!nlie the top menu and header< the slideshow in the OpenCart de%ault can only 9e viewed on the home page in this
position:
*eatured !roducts
OpenCart gives you the option o% %eaturing speci%ic products o% their choosing on the home page:
8/9/2019 Testing Opencart
58/243
Copyright 8 21" OpenCart 3imited 5age 1-
8/9/2019 Testing Opencart
59/243
Help Site
!ser Guide
OpenCart documentation
8/9/2019 Testing Opencart
60/243
8/9/2019 Testing Opencart
61/243
Copyright 8 21" OpenCart 3imited 5age 1'
8/9/2019 Testing Opencart
62/243
Help Site
!ser Guide
OpenCart documentation
8/9/2019 Testing Opencart
63/243
When a manu%acturer icon is cliced< the customer will 9e directed to a page listing all the products within that
manu%acturerFs category:
4he carousel is only located on the Home 5age in the de%ault:
*ooter
4he %ooter is located at the 9ottom o% every page< not Iust the Home 5age: 4his 9loc o% miscellaneous lins is use%ul in
sorting relevant pages %or the customer that may not logically sort anywhere else:
4he organiKational scheme o% the %ooter can 9e divided into the %ollowing sections=
Information+ J&9out !sJ< JDelivery 0n%ormationJ< J5rivacy 5olicyJ< J4erms N ConditionsJ
Customer Service+ JContact !sJ< J*eturnsJ< JSite .apJ
&"tras+ J$randsJ< JGi%t 7ouchersJ< J&%%iliatesJ< JSpecialsJ
%y ccount+ J.y &ccountJ< JOrder HistoryJ< JWish 3istJ< JEewsletterJ
8/9/2019 Testing Opencart
64/243
Copyright 8 21" OpenCart 3imited 5age 2
8/9/2019 Testing Opencart
65/243
Help Site
!ser Guide
OpenCart documentation
8/9/2019 Testing Opencart
66/243
Product !ages
4he OpenCart de%ault product page will %ollow the structural %ormat seen 9elow >minus header/top menu/%ooter?:
8/9/2019 Testing Opencart
67/243
Copyright 8 21" OpenCart 3imited 5age 21
8/9/2019 Testing Opencart
68/243
Help Site
!ser Guide
OpenCart documentation
8/9/2019 Testing Opencart
69/243
4he product page can 9e divided into the %ollowing sections=
Categories= &ll the products on the shop will 9e organiKed into designated categories: 4he category lin9loc on the
le%tside o% the product page will ena9le the customer to 9rowse other products 9y category:
Product image= 4he product image can 9e displayed under the title on the le%tside< along with alternateviews o% the
product underneath it in smaller 9o): Clicing on the main image will e)pand the image within the window %or thecustomer to see it in greater detail:
Product details= 4he product code< availa9ility< and price are displayed Iust right to the product image:
Cart= 4he customer can select a quanity and add the product to their cart< wishlist< or compare:
Rating/S$aring+ !nderneath the cart can rate the product and/or share the product on di%%erent social media we9sites:
,escri!tion tab+&n area underneath the main product in%ormation to provide a detailed description o%the product:
Revie# tab+&n area %or the customer to write a review on the product:
Category !roduct listings
Category product listings ena9le customers to 9rowse products similar to other products within the same category: 4his
is especially help%ul %or customers looing to compare products< a %eature that will 9e e)plained under Categories: 4he
category page can 9e accessed a num9er o% ways: 0t can 9e accessed %rom the top menu< when a customer clics onone o% the parent categories: &lso< on product pages a customer can access the category product listing page 9y
clicing on a category on the le%t side category 9loc:
http://docs.opencart.com/display/opencart/Categorieshttp://docs.opencart.com/display/opencart/Categories8/9/2019 Testing Opencart
70/243
8/9/2019 Testing Opencart
71/243
Help Site
!ser Guide
OpenCart documentation
8/9/2019 Testing Opencart
72/243
8/9/2019 Testing Opencart
73/243
Product com!are
4he J&dd to CompareJ %eature in the product section allows the customer to compare the di%%erent speci%ications< %eaturesview change?
Go to start o% metadata
Image u!load
4he image and %ile managerin OpenCart can o%ten cause users grie%: Eoting a %ew things can greatly reduce di%%iculty=
.ae sure your system settingsare set to not display errors: 5H5 errors in SOE responses required 9y the image
manager 9rea the SOE and there%ore the image upload:
.ae sure your %iles are valid images o% appropriate %ormat >animated gi% %iles are not supported?:
8/9/2019 Testing Opencart
152/243
8/9/2019 Testing Opencart
153/243
Copyright 8 21" OpenCart 3imited 5age #
8/9/2019 Testing Opencart
154/243
Help Site
System &dministrator guide
OpenCart documentation
%oving 7!enCart to a ne# server
Sip to end o% metadata
&dded 9y Catherine BHostars< last edited 9y Catherine BHostarson Sep 1,< 212
Go to start o% metadata
%oving 7!enCart to a ne# server
OpenCart can 9e easily migrated to a new we9 server: 4he steps are listed 9elow=
Copy all the OpenCart %iles %rom your e)isting we9 server to the new we9 server:
()port the OpenCart data9ase and import it into the new server:
8/9/2019 Testing Opencart
155/243
(dit con%ig:php and admin/con%ig:php: 4hese %iles contain the %ilesystem paths to OpenCart %olders< !*3s to OpenCart
%rontend and admin< and data9ase access details: 4he paths and data9ase details will most liely need to 9e updatedview change?
Go to start o% metadata
OpenCart is not responsi9le %or the securing your we9site< there%ore it is up you to ensure your serverFs level o% sa%ety:
4he %ollowing suggestions aim to improve your OpenCart storeFs security:
4hese additional steps can 9e taen immediately a%ter OpenCart is installed to your serverM or whenever you store
9ecomes active: See 0nstallation %or more in%ormation on how to install your OpenCart store:
,elete t$e install folder
http://docs.opencart.com/display/opencart/Installationhttp://docs.opencart.com/display/opencart/Installationhttp://docs.opencart.com/display/opencart/Installation8/9/2019 Testing Opencart
179/243
Deleting the install %older is advised 9y OpenCart immediately a%ter installation: OpenCart will warn you in the
administration i% the install %older is not deleted:
,irectory !rotection
dmin folder
4he admin directory is where you have access to your storeFs administration: 5eople with access to your store
administration will have access your editing your products< customer in%ormation< store settings< and more valua9le
in%ormation: 4here%ore< it is very important that the admin login 9e di%%icult to %ind and access:
Rename admin
*enaming the admin directory to something unrelated to the the admin is necessary to prevent unwanted eyes %rom
discovering itFs location: @ou can access your admin login through entering your storeFs location< then the path to the
admin: ;or e)ample< i% the admin %older was changed to JcooiemonsterJ< the admin login would 9e at
Jwww:yourstore:com/cooiemonsterJ:
:$taccess ; :$t!ass#d
& :htaccess and :htpasswd %ile in the admin %older will prevent hacers %rom accessing your store< even i% they discover
the admin login location: !sing :htaccess< you can deny all 05 addresses %rom viewing your store< e)cept the adminFs 05
address: & :htpasswd in the admin %older will require an additional password %or the allowed administrator to access this
directory:
Catalog
4he catalog can 9e protected with the traditional :htaccess %ile: !sing %ile match can 9e use%ul %or protecting important %ile
types %or your store< such as php and t)t< rather than all o% them: 4he %ollowing code can 9e used %or :htaccess in your
catalog %older=
Copyright 8 21" OpenCart 3imited 5age #'
8/9/2019 Testing Opencart
180/243
Help Site
System &dministrator guide
OpenCart documentation
Order Deny,Allo
Deny !ro all
Allo !ro "yo#r ip address"
4his will deny access to all template< php< and t)t %iles:
System folder
4he system %older contains two %iles that need to 9e protected= logs/error:t)t and startup:php: 4he logs/error:t)t can 9e
renamed i% necessary:
:Htaccess
4he :htaccess will wor to protect these %iles and the su9%olders o% System %rom 9eing accessed 9y anyone e)cept the
designated administrator: 4o do so< insert the code 9elow into your :htaccess=
Order Deny,Allo Deny !ro all
Allo !ro "yo#r ip address"
*ile !ermissions
8/9/2019 Testing Opencart
181/243
4he %ollowing %iles need to 9e set to +"" or """ to prevent anyone else %rom writing to them=
con%ig:php
inde):php
admin/con%ig:php
admin/inde):php
system/startup:php
Eone
&dd tothedocumentation
Get help %rom
$uy the !ser Guide 5D;
Get import
the community
toolsand modules
http://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/moduleshttp://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/modules8/9/2019 Testing Opencart
182/243
Copyright 8 21" OpenCart 3imited 5age +
8/9/2019 Testing Opencart
183/243
Help Site
Developer guide
OpenCart documentation
,evelo!er guide
Sip to end o% metadata
&dded 9y Catherine BHostars< last edited 9y Catherine BHostarson ;e9 2+< 21 >view change?
Go to start o% metadata
,evelo!er guide
8/9/2019 Testing Opencart
184/243
Eone
" Child 5ages
5age= 0ntroduction to .7C35age= Developing modules5age= Developing new product %eeds5age= 3oading%iles in thecontroller
&dd tothedocumentation
Get help %rom
$uy the !ser Guide 5D;
Get import
the community
toolsand modules
http://docs.opencart.com/display/opencart/Loading%20files%20in%20the%20controllerhttp://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/moduleshttp://docs.opencart.com/display/opencart/Loading%20files%20in%20the%20controllerhttp://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/modules8/9/2019 Testing Opencart
185/243
Copyright 8 21" OpenCart 3imited 5age +1
8/9/2019 Testing Opencart
186/243
Help Site
Developer guide
OpenCart documentation
Introduction to %view change?
Go to start o% metadata
Getting started
OpenCart is an e)cellent plat%orm %or developers looing to understand 5H5 we9 %ramewors in general: 0t is one o% the
easiest to %ollow .7C structured applications availa9le: OpenCart allows you to learn the .7C %ramewor while giving
you access to the %amiliar 5H5< myS63 and H4.3 technologies on which it is 9uilt: 4his guide will assume a 9asic
understanding o% H4.3< CSS< avascript< 5H5 >including classes and inheritance?< and myS63< and will descri9e how
these are used in the OpenCart system:
%
8/9/2019 Testing Opencart
187/243
OpenCart is designed to %ollow an .7C design pattern: 4he components o% .7C >.odel 7iew Controller? can 9e 9roen
down as %ollows:
% . %odel
4his is where you will interact directly with your data9ase< pulling data out and restructuring it to a %ormat that is suita9le
%or your %rontend: 4his will usually mainly consist o% D$ queries< and little more: 0% you are used to writing myS63 queriesview change?
Go to start o% metadata
dding multi!le languages
With shops serving a wider array o% customers across multiple countries< it may 9ecome necessary to add multiplelanguage options %or your customers: 4he de%ault language provided %rom the installation is (nglish: Other availa9le
languages can 9e viewed on the OpenCart 3anguage page:4hese language pacs can 9e downloaded through the
()tension Directory:
*TP a language !ac- to an 7!enCart store
http://docs.opencart.com/pages/viewpageattachments.action?pageId=753869&metadataLink=truehttp://www.opencart.com/index.php?route=feature/feature&path=17http://docs.opencart.com/pages/viewpageattachments.action?pageId=753869&metadataLink=truehttp://www.opencart.com/index.php?route=feature/feature&path=178/9/2019 Testing Opencart
192/243
8/9/2019 Testing Opencart
193/243
Copyright 8 21" OpenCart 3imited 5age +"
8/9/2019 Testing Opencart
194/243
Help Site
Developer guide
OpenCart documentation
dding a language to t$e administration
4he OpenCart administration requires some speci%ic in%ormation in the System area a9out the language a%ter you ;45 it:
7isit 3ocalisation to see what %ields are required: &%ter the language is saved there< the language name will appear in the
language list under 3ocalisation3anguage:
C$anging a language in t$e store front
Saving a language pac in 3ocalisation will mae it immediately availa9le in the store %ront: 4he language area is located
in the header o% every page< ne)t to currency: 0n achieve the e)ample 9elow< a German language pac was downloaded
and ;45Fd to OpenCart: $y assigning German an assorting order o% 2< it is displayed right o% (nglish in the %ooter o% every
page o% our store: 4he customer can clic on the German %lag in the header to change the language:
http://docs.opencart.com/display/opencart/Localisation%20::%20Languagehttp://docs.opencart.com/display/opencart/Localisation%20::%20Languagehttp://docs.opencart.com/display/opencart/Localisation%20::%20Language8/9/2019 Testing Opencart
195/243
8/9/2019 Testing Opencart
196/243
Eone
Copyright 8 21" OpenCart 3imited 5age +#
8/9/2019 Testing Opencart
197/243
Help Site
Developer guide
OpenCart documentation
&dd tothedocumentation
Get help %rom
$uy the !ser Guide 5D;
Get import
the community
toolsand modules
http://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/moduleshttp://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/modules8/9/2019 Testing Opencart
198/243
8/9/2019 Testing Opencart
199/243
Copyright 8 21" OpenCart 3imited 5age ++
8/9/2019 Testing Opencart
200/243
Help Site
Developing modules
OpenCart documentation
,evelo!ing modules
Sip to end o% metadata
&ttachments=2
&dded 9y ustin BHostars< last edited 9y Catherine BHostarson ;e9 2+< 21 >view change?
Go to start o% metadata
Writing OpenCart modules can 9e a very good way to learn how the %undamentals o% OpenCartactually wor: ust as
the rest o% OpenCart< modules %ollow the .7C3 design pattern: 4his documentation guide will descri9e how you use
each o% the .7C3 components to create the admin and %rontend parts o% your module: 4he easiest way to create a
module is to download the D0@ .odule $uilderseleton %rom Hostars: 4his module contains the directory structure:tpl?: We will
go through these %iles one 9y one:
8/9/2019 Testing Opencart
207/243
Controller
4he %irst %ile you mae will 9e the controller %or your moduleFs admin inter%ace page: OpenCart identi%ies e)isting modules
automatically< simply 9y reading the admin/controller/module %older o% your store: &ny modules e)isting in this %older will
automatically 9e shown on the .odules page< and on
the !ser 5ermissions< page: @ou may call your controller %ile mymodule:php:
4he controller %ile is the place where you can load the language %iles to convert te)t into varia9les to 9e utiliKed in the
template %ile: 0n the diagram a9ove< you can see the RBFte)tF varia9le 9eing handled 9y the controller< then sent as Rte)t
to the view: @ou will also utiliKe multiple model %iles and their class %unctions here< including your moduleFs model %ile i% it
has one: ;or more in%ormation on loading %iles see 3oading %iles in the controller:
@ou may also have a %unction de%ined as pu9lic %unction install>?: 4his %unction will 9e triggered when the install lin is
cliced on the ()tensions .odulespage: Similarly< a %unction de%ined as pu9lic %unction uninstall>? will 9e triggered
when the uninstall lin is cliced: @ou can use these %unctions to create and remove any structures >such as data9ase
ta9les or con%ig settings? required 9y your module: 0t is good practice to create an uninstall %unction to clean up any
changes your module has made: 4o see the speci%ic code %or an install>?< uninstall>?< visit 0nstall/!ninstall a module:
ccessed via URL
4he controller is the only %ile in the .7C3 %ramewor to 9e accessed 9y !*3 in OpenCart: 0n the administration< the !*3
will loo lie /admin/inde):phprouteTmodule/mymoduleNtoen: 4he admin adds a toen to the
!*3< whereas the lin in the catalog will not have it: &s a result< the controller %ile will have a %unction de%ined as pu9lic
%unction inde)>?: 4his is a pu9licly accessi9le FpageF that is loaded 9y the !*3< which will 9e shown
http://docs.opencart.com/display/opencart/Moduleshttp://docs.opencart.com/display/opencart/Usershttp://docs.opencart.com/display/opencart/Moduleshttp://docs.opencart.com/display/opencart/Users8/9/2019 Testing Opencart
208/243
Copyright 8 21" OpenCart 3imited 5age +'
8/9/2019 Testing Opencart
209/243
Help Site
Developing modules
OpenCart documentation
when the (dit 9uttonis cliced< and where the view %orm will su9mit to: 4he su9mitted data will 9e processed in this
%unction and saved to the UsettingsU data9ase ta9le through the controllerFs con%ig o9Iect:
8/9/2019 Testing Opencart
210/243
& ey di%%erence in the %rontend o% your module< is that your view %ile will 9e in the
catalog/view/theme/themename/template/module %older: 4his is a signi%icantly deeper %older structure to the admin
view %ile 9ecause o% themes: &n OpenCart store may have many di%%erent %rontend themesavaila9le< 9ut only one
admin template:
On the %rontend part o% your module you will have access to the con%iguration options saved 9y your module< through
9oth the controllerFs con%ig o9Iect< and the Rsettings varia9le passed to the module controllerFs inde) %unction: @ou cancontrol aspects o% the %rontend display on the 9asis o% these settings:
Eone
1 Child 5age
5age= 0nstall/!ninstall a module
Copyright 8 21" OpenCart 3imited 5age ,
8/9/2019 Testing Opencart
211/243
Help Site
Developing modules
OpenCart documentation
&dd to the documentation
Get help %rom
$uy the !ser Guide 5D;
Get import
the community
toolsand modules
http://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/moduleshttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/modules8/9/2019 Testing Opencart
212/243
8/9/2019 Testing Opencart
213/243
Copyright 8 21" OpenCart 3imited 5age ,1
8/9/2019 Testing Opencart
214/243
Help Site
Developing modules
OpenCart documentation
,evelo!ing ne# !roduct feeds
Sip to end o% metadata
&dded 9y ustin BHostars< last edited 9y Catherine BHostarson ;e9 2+< 21 >view change?
Go to start o% metadata
OpenCart includes several use%ul 5roduct ;eedsin the core< 9ut you may %ind you require a custom %ormat and decide to
create your own: Writing OpenCart product %eeds is very similar to writing OpenCart modules< and can 9e a very good
way to learn how the %undamentals o% OpenCartactually wor: ust as the rest o% OpenCart< %eeds %ollow the .7C3
design pattern: 4his documentation guide will descri9e how you use each o% the .7C3 components to create the admin
and%rontend parts o% your product %eed:
dmin feed functionality
When a store owner uses your product %eed< they will want to edit the product %eedFs con%iguration options in the admin in
order to select whether it is ena9led or disa9led and any speci%ic options you mae availa9le: &s the developer< you will
need to create the admin page where the product %eed may 9e edited:
http://docs.opencart.com/display/opencart/Admin%20interfacehttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20fronthttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20fronthttp://docs.opencart.com/display/opencart/Admin%20interfacehttp://docs.opencart.com/display/opencart/Browsing%20the%20store%20front8/9/2019 Testing Opencart
215/243
&ll admin %iles are located in the admin/ %older: @ou will %ind %our %olders within the admin/ %older=
controller
view
language
model
&ll product %eeds will require at least a single %ile in each o% the view and controller %olders: Some will require a %ile in each
o% the model and language %olders: !sually the %iles have the same name< e)cept the view %ile has a di%%erent su%%i) >:tpl?:We will go through these %iles one 9y one:
Controller
4he %irst %ile you mae will 9e the controller %or your product %eedFs admin inter%ace page: OpenCart identi%ies e)isting
product %eeds automatically< simply 9y reading the admin/controller/%eeds %older o% your store: &ny product %eed %iles
e)isting in this %older will automatically 9e shown on the 5roduct ;eedspage< and on
the !ser 5ermissions< page: @ou may call your controller %ile my%eed:php:
4he controller %ile will have a %unction de%ined as pu9lic %unction inde)>?: 4his is a pu9licly accessi9le FpageF< which will 9e
shown when the (dit 9uttonis cliced< and where the view %orm will su9mit to: 4he su9mitted data will 9e processed in
this %unction and saved to the UsettingsU data9ase ta9le through the controllerFs con%ig o9Iect:
@ou may also have a %unction de%ined as pu9lic %unction install>?: 4his %unction will 9e triggered when the install lin is
cliced on the ()tensions %eedspage: Similarly< a %unction de%ined as pu9lic %unction uninstall>? will 9e triggered when
the uninstall lin is cliced: @ou can use these %unctions to create and remove any structures >such as data9ase ta9les or
con%ig settings? required 9y your %eed: 0t is good practice to create an uninstall %unction to clean up any changes your %eed
has made:
Copyright 8 21" OpenCart 3imited 5age ,2
http://docs.opencart.com/display/opencart/Usershttp://docs.opencart.com/display/opencart/Users8/9/2019 Testing Opencart
216/243
Help Site
Developing modules
OpenCart documentation
s?: @ou will need one language %ile per language that
your %eed is compati9le with: 4he language %ile will live in the admin/language/language name/%eed %older: 0t simply
contains a 5H5 associative arraycalled R< which contains the internal name as the ey and the translation as the value:
@ou may call your language %ile my%eed:php< the same as your controller and model %iles:
%odel
0t is uncommon %or %eeds to require a model %ile on the admin side: However< i% your %eed relies on its own data9ase ta9ledoc#ent&>set/itle($this&>lan'#a'e&>'et(headin'title))*
4his will gra9 the te)t %or the varia9le RBFheadingtitleF stored in the moduleFs language %ile:
0% you need the te)t to 9e stored as a php session varia9le< use RthissessiondataBFte)tF instead o% Rthis
dataBFte)tF:
Loading model files
3oading model %iles into your controller %ile will allow your module to utiliKe OpenCartFs 9uiltin %unctions: 4he %unctions
inside the model %iles interact with the storeFs data9ase and to add/pull important in%ormation %or your module: Werecommended that you to tae advantage o% these %unctions< rather than maing your own D$ queries: 4ae some time
to e)plore the model %olders in 9oth the admin and catalog %iles< to see which %iles may 9ene%it your moduleFs purpose:
;or e)ample< i% your module needs to pull product in%ormation %rom the storeFs data9ase< it will 9e use%ul to load the
admin/model/catalog/products:php %ile< since it already has a multitude o% help%ul< 9uiltin %unctions that interact with the
storeFs products in the data9ase:
@our module can load any model %ile its controller %ile using the %ollowing code< granted that they are in the same admin
or catalog %older as the controller:
$this&>load&>odel(settin'settin')*
8/9/2019 Testing Opencart
225/243
@ou will need to speci%y the path to the %ile you want to load %rom the admin %older within the parentheses: 4he code
a9ove will load the settings class so we have access to the %unctions within the .odelSettingSetting class in our
modelFs controller %ile: !se the %ollowing %ormat in your code to call a %unction %rom a loaded model %ile=
$this&>odelsettin'settin'&>edit0ettin'(yod#le,$this&>re1#est&>post)*
4he underscores re%er to the %ile designations %or model/setting/setting:php: 0% you have a model %ile included %or yourmodule your code would %ollow the %ormat mentioned a9ove< since the model %ile is uploaded to model %older:
$this&>load&>odel(od#leyod#le.php)*$this&>odelod#leyod#le&>yF#nction()*
4he code a9ove will load the mymodule:php stored in admin/model/module/mymodule:php:
0nstead o% using spaces in %ile names %or your module< use underscores:
Loading tem!late files
0n the controller you will need to load your moduleFs template %ile in view: 4o do so< set Rthistemplate as so=
$this&>teplate -od#leyod#le.tpl*
Copyright 8 21" OpenCart 3imited 5age ,+
8/9/2019 Testing Opencart
226/243
Help Site
Developing modules
OpenCart documentation
Loading library files
4he OpenCart directory contains a collection o% li9rary %iles that can 9e accessed 9y 9oth the admin and catalog
controller %iles: 4hese %iles are located under system/li9rary in the root %older o% the OpenCart store: 0n the code
e)amples seen in loading the language %ile< 9oth Rthisloadlanguage and Rthisdocument give access to %unctions
within the language:php and document:php %iles in the li9rary %older: 0% you want to access a %unction in a li9rary %ile you
need to call it using RthisBinsert li9rary %ile name%unction>? in the controller class:
dditional information
;or more in%ormation on the concept o% how the controller 9ehaves within the .7C %ramewor or in the conte)t o%
developing a module %or OpenCart< see the 0ntroduction and Developing .odules: 4o see how loaded %iles can 9e
utiliKed in a 9asic module< see the D0@ .odule%rom Hostars:
Eone
http://docs.opencart.com/display/opencart/Introduction%20to%20MVC-L#IntroductiontoMVC-L-C-Controllerhttp://opencart.hostjars.com/http://opencart.hostjars.com/http://docs.opencart.com/display/opencart/Introduction%20to%20MVC-L#IntroductiontoMVC-L-C-Controllerhttp://opencart.hostjars.com/8/9/2019 Testing Opencart
227/243
&dd tothedocumentation
Get help %rom
$uy the !ser Guide 5D;
Get import
the community
toolsandmodules
http://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/moduleshttp://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/modules8/9/2019 Testing Opencart
228/243
Copyright 8 21" OpenCart 3imited 5age ,,
8/9/2019 Testing Opencart
229/243
Help Site
Designer Guide
OpenCart documentation
,esigner Guide
Sip to end o% metadata
&dded 9y ustin BHostars< last edited 9y Catherine BHostarson ;e9 2+< 21 >view change?
Go to start o% metadata
,esigner guide
8/9/2019 Testing Opencart
230/243
Eone
1 Child 5age
5age= Creating a custom theme
&dd tothedocumentation
Get help %rom
$uy the !ser Guide 5D;
Get import
thecommunity
toolsandmodules
http://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/moduleshttp://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/modules8/9/2019 Testing Opencart
231/243
Copyright 8 21" OpenCart 3imited 5age ,-
8/9/2019 Testing Opencart
232/243
Help Site
Designer Guide
OpenCart documentation
Creating a custom t$eme
Sip to end o% metadata
&ttachments=#
&dded 9y Catherine BHostars< last edited 9y Catherine BHostarson ;e9 2+< 21 >view change?
Go to start o% metadata
Table of Content
Creating a custom theme
http://docs.opencart.com/pages/viewpageattachments.action?pageId=754228&metadataLink=truehttp://docs.opencart.com/pages/viewpageattachments.action?pageId=754228&metadataLink=true8/9/2019 Testing Opencart
233/243
De%ault 4heme %older structure
Creating our theme
Creating a custom t$eme
;or many people using OpenCart< the de%ault theme provided with the installation meets their storeFs design needs: ;or
users wanting added customiKation to their storeFs theme< such as a change o% the color scheme< di%%erent 9orders
&%ter we are %inished with styling< we may want to change the structure or content o% our H4.3 %iles: See .odi%ying
content in template %iles%or more in%ormation: 4his is the %inal step o% creating a custom
OpenCart theme: *emem9er< you can always revert 9ac to the de%ault theme 9y selecting it under the store settings
under Settings in the administration:
Eone
http://docs.opencart.com/display/opencart/Settingshttp://docs.opencart.com/display/opencart/Settingshttp://docs.opencart.com/display/opencart/Settings8/9/2019 Testing Opencart
242/243
&dd tothedocumentation
Get help %rom
$uy the !ser Guide 5D;
Get import
the community
toolsandmodules
http://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/moduleshttp://helpdesk.hostjars.com/forums/21302536-contributionshttp://opencart.hostjars.com/user-guidehttp://opencart.hostjars.com/import-toolshttp://forum.opencart.com/http://opencart.hostjars.com/import-toolshttp://opencart.hostjars.com/modules8/9/2019 Testing Opencart
243/243
Top Related