Table Of Contentphp|architect’s
php|architect’s
Guide to E-commerce
Programming with Magento
This highly anticipated book will give you the insight you need to successfully manage and
customize your Magento Commerce installation. Guide to Enterprise
php|architect's Guide to Programming with Magento takes you from installation to
deployment of this popular e-commerce open source software. Magentos flexibility and
k
Zend Framework-based structure have made it an increasingly popular e-commerce
o
solution. o
b
d
Designed as a valuable companion to the the documentation provided on the Magento PHP Development
n
web site, this comprehensive book covers everything you as a developer need to know, a
including: H
s
’
• Installation and configuration r
e
• Overview of front-end and back-end systems t
n
• Dealing with multiple stores
u
• Accommodating multiple languages & internationalization issues H
• Handling Magento modules b
• Working with the Magento template system o
J
• Understanding Magento's EAV database structure
P
• Made-to-order products
H
• Adding a rewards or points system P
• Integration with a CMS s
’
• Accounting, inventory and order fulfillment and exporting information with XML t
c
• An entire chapter devoted to quick answers to common questions e
t
i
h
php|architect's Guide to Programming with Magento is a must for anyone dealing with
c
or curious about the Magento software. r
a
|
p
h
p
NanoBooks are excellent, in-depth resources created by the publishers of
php|architect (http://www.phparch.com), the world’s premier magazine dedicated
to PHP professionals.
NanoBooks focus on delivering high-quality content with in-depth analysis and
expertise, centered around a single, well-defined topic and without any of the fluff
of larger, more expensive books.
s
MSRP $34.99 US t
t
e
r
From the publishers of e
v
E
/
al Ivo Jansch
s
m
Ki
Licensed to:
ken mondshine
[email protected]
User #58516
et)
n
al.
b
php|architect’s Guide to o
gl
c
b
s
@
Enterprise PHP Development e
n
hi
s
d
n
o
m
e (
byIvoJansch hin
s
d
n
o
m
n
e
k
6 -
1
5
8
5
o
d t
e
s
n
e
c
Li
php|architect’sGuidetoEnterprisePHPDevelopment
ContentsCopyright©2008IvoJansch–AllRightsReserved
Bookandcoverlayout,designandtextCopyright©2004-2008MarcoTabini&Associates,Inc.–AllRightsReserved
FirstEdition:June2008
ISBN:978-0-9738621-8-8
ProducedinCanada
PrintedintheUnitedStates
Nopartofthisbookmaybereproduced,storedinaretrievalsystem,ortransmittedinanyformor
bymeanswithoutthepriorwrittenpermissionofthepublisher,excetinthecaseofbriefquotations
embeddedincriticalreviewsorarticles.
Disclaimer net)
Althougheveryefforthasbeenmadeinthepreparationofthisbooktoensuretheaccuracyofthe al.
b
o
informationcontainedtherein, thisbookisprovided”as-is”andthepublisher, theauthor(s), their gl
c
distributorsandretailers,aswellasallaffiliated,relatedorsubsidiarypartiestakenoresponsibility b
s
foranyinaccuracyandanyandalldamagescaused,eitherdirectlyorindirectly,bytheuseofsuch @
e
information. Wehaveendeavouredtoproperlyprovidetrademarkinformationonallcompaniesand n
hi
productsmentionedinthebookbytheappropriateuseofcapitals.However,wecannotguaranteethe s
d
n
accuracyofsuchinformation. o
m
e (
MarcoTabini&Associates,TheMTAlogo,php|architect,thephp|architectlogo,NanoBookandthe n
hi
NanoBooklogoaretrademarksorregisteredtrademarksofMarcoTabini&Associates,Inc. s
d
n
o
m
n
e
Writtenby IvoJansch k
TechnicalReviewers PeterC.VerhageandLornaMitchell 6 -
1
Publishedby MarcoTabini&Associates,Inc. 85
5
28BombayAve. o
Toronto,ONM3H1B7 d t
Canada se
n
e
c
(416)630-6202/(877)630-6202 Li
[email protected]/www.phparch.com
Publisher MarcoTabini
LayoutandDesign ArbiArzoumani
ManagingEditor ElizabethNaramore
FinanceandResourceManagement EmanuelaCorso
et)
n
al.
b
o
gl
c
b
s
@
e
n
hi
s
d
n
o
m
e (
n
hi
s
d
n
o
m
n
e
k
6 -
1
5
8
5
o
d t
e
s
n
e
c
Li
et)
n
al.
b
o
gl
c
b
s
@
e
n
hi
s
d
n
o
m
e (
n
hi
s
d
n
o
m
n
e
k
6 -
1
5
8
5
o
d t
e
s
n
e
c
Li
Contents
Acknowledgements xv net)
al.
b
o
Foreword xvii gl
c
b
s
@
Introduction xix
e
n
hi
s
d
n
I Background 3 mo
e (
n
Chapter1—FromtheAttictotheCubicle 7 hi
s
d
PHP’sEvolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 n
o
m
TheRiseofOpenSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 n
e
TheLAMPStack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 k
ProfessionalAdoption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 16 -
5
TheMaturityoftheInternet . . . . . . . . . . . . . . . . . . . . . . . . . . 9 58
o
Web2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 d t
e
DetailedHistoryofPHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 ns
e
ApplicationAreas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Lic
Chapter2—PHPintheEnterprise 15
PHP’sSuccessFactors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
BuiltfortheWeb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
EasytoLearn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
AvailabilityofSoftware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Widespread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
vi ” CONTENTS
Pragmatic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
TimetoMarket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
EnterpriseChallenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
EasytoLearn,DifficulttoMaster . . . . . . . . . . . . . . . . . . . . . . . 18
Inconsistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
PersistentObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
InterpretationversusCompilation . . . . . . . . . . . . . . . . . . . . . . 20
PHP’sPlaceintheEnterpriseMarket . . . . . . . . . . . . . . . . . . . . . . . 21
TheRightJobfortheTool . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
PHPandOtherLanguages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Ruby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 et)
n
Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 al.
b
Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 o
gl
c
.NET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 b
s
@
Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
e
n
OtherLanguages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 hi
s
d
HybridEnvironments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 n
o
m
e (
n
hi
II EnterpriseDevelopment 27 s
d
n
o
m
Chapter3—TheTeam 31 n
e
RolesandResponsibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 k
6 -
TheCustomer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 1
5
8
TheAnalyst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5
o
TheSoftwareArchitect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 d t
e
TheSystemArchitect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 ns
e
TheDeveloper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Lic
TheLeadDeveloper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
The(Graphic)Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
TheTester . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
TheProjectManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
TheAccountManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
TheSystemAdministrator . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
TheCodeManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
CONTENTS ” vii
TheTrainer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Training . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
TrainingRequirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Certification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Self-Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Community . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Conferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Recruitment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
DefiningYourNeeds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
ReachingPHPDevelopers . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
AssessingSkills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 et)
n
BeinganAttractiveEmployer . . . . . . . . . . . . . . . . . . . . . . . . . 45 al.
b
o
gl
Chapter4—RequirementsGathering 49 c
b
s
BusinessGoals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 @
e
ExpectationManagement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 n
hi
s
FunctionalRequirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 d
n
o
Non-functionalRequirements . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 m
InteractionDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 ne (
hi
Wireframes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 s
d
n
Flowcharts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 mo
MoSCoW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 en
k
6 -
Chapter5—Planning 61 1
5
8
ThePlanningParadox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 5
o
GettingLostinDetails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 d t
e
s
ThePlanningProcess. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 n
e
c
NotJustCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Li
Chapter6—Architecture 69
Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
OO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
ClassesandObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
ConstructorsandDestructors . . . . . . . . . . . . . . . . . . . . . . . . . 71
Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
viii ” CONTENTS
AccessSpecifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
AbstractClasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
StaticMembers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
MagicMethods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
ObjectLifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
UML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
ClassDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
SequenceDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 et)
n
UMLTools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 al.
b
DesignPatterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 o
gl
c
CommonPHPPatterns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 b
s
@
MagicMethodsandDesignPatterns . . . . . . . . . . . . . . . . . . . . . 86
e
n
EnterprisePatterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 hi
s
d
DatabaseDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 n
o
m
ERD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 e (
Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 hin
s
Constraints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 d
n
o
TriggersandStoredProcedures . . . . . . . . . . . . . . . . . . . . . . . . 93 m
n
Normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 e
k
ORM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 6 -
1
5
Base-table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 8
5
Specializedtables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 d to
Normalizedmodel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 se
n
HighLevelArchitecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 ce
Li
MVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Multi-tierDevelopment . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
SOA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
CONTENTS ” ix
Chapter7—Tools 109
Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
IntegratedDevelopmentEnvironments(IDEs). . . . . . . . . . . . . . . . . . 110
Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Alt-tabDebugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
EchoDebugging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
UsingaDebugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Root-CauseAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
SourceControl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
TheProcess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
TheTools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 et)
n
Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 al.
b
Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 o
gl
c
Merging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 b
s
@
IssueTracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
e
n
Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 hi
s
d
APIDocumentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 n
o
m
Wiki . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 e (
n
hi
Chapter8—BuildingBlocks 129 s
d
n
Don’tReinventtheWheel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 mo
The“NotInventedHereSyndrome” . . . . . . . . . . . . . . . . . . . . . . . . 130 en
k
Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 6 -
1
ContentManagement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 5
8
5
Portals/Communities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 o
E-commerce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 ed t
s
n
Forums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 e
c
Blogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Li
Frameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
ComponentFrameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
FullStackFrameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
JavaScriptFrameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
SpecialPurposeFrameworks . . . . . . . . . . . . . . . . . . . . . . . . . 139
LibrariesandComponents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Description:I bought this book hoping to improve my software development skill set by adding management skills to my repertoire but alas found that the book went much further than that. This book discusses available tools, workflow scenarios, and general knowledge about PHP from a non technical perspective. I s