On Starlink, presented by Geoff Huston at NZNOG 2024
Creating an e-commerce publications catalog with Drupal Commerce
1. Creating
an
e-‐commerce
publications
catalog
with
Drupal
Commerce
Bryan
Mayjor
-‐
Extension
&
Experiment
Station
Communications
2. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Who
is
this
guy?
• Bryan
is
a
Technology-‐assisted
education
developer
with
the
Oregon
State
Extension
Service
• Started
hacking
websites
when
Netscape
1
was
new
and
and
28K
dialup
was
cool
• Has
been
working
with
Drupal
since
2008
• Spends
way
too
much
time
coding
2
Source: http://www.niola.net
3. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Over
the
next
50
minutes
…
• You’ll
get
an
overview
of
Drupal
Commerce
and
how
it
works
• Endure
a
short
story
about
Newman
and
Catman
• See
Drupal
Commerce
in
action
• Look
at
some
code
• Ask
some
questions
• Become
a
better
person
(possibly)
3
4. NETC
2014
-‐
Tekkies
in
the
Little
Apple
What
is
Drupal
Commerce?
Drupal
Commerce
is
set
of
modules
that
provide
core
e-‐commerce
functionality
• shopping
cart
• check
out
• payments
• shipping
and
fulfillment
• discounts
• order
management
• all
without
writing
any
code
4
5. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Newman
“New
catalog
manager”
• Old,
old,
old
Filemaker
Pro
database
• Used
by
the
pubs
team
to
manage
publications
since
the
1990s
• E-‐commerce
functionality
developed
by
contractor
using
questionable
design
patterns
• Archaic
export
process
was
developed
for
online
catalog
• Updating
catalog
is
a
multistep
process
that
involves
deleting
the
catalog
database
then
reimporting
5
Source: http://article.wn.com
6. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Catman
History
of
the
Catman
project
• Contracted
out
to
3rd
party
vendor
as
I
didn’t
have
time
to
do
it
• “Completed”
project
didn’t
meet
our
needs
• I
still
don't
have
time
but
took
over
development
working
closely
with
a
pubs
team
member
(Jennifer
Alexander)
• Used
the
contracted
commerce
site
as
a
basis,
scrapped
the
project
management
site
completely
6
Source: http://fairlyoddparents.wikia.com
7. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Catman
Goals
for
new
system
• Replace
old
system
before
it
dies
again
• Combine
project
management
and
catalog
site
into
one
happy
Drupal
site
• Integrate
University
approved
payment
gateway
(used
by
current
system)
• Responsive
design
with
emphasis
on
user
experience
• Flexible
system
to
meet
current
and
future
needs
7
Source: http://fairlyoddparents.wikia.com
8. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Getting
Started
with
Drupal
Commerce
The
easy
way
Commerce
Kickstart
• Installation
profile
creates
a
fully
functional
store
in
minutes
• Pre-‐configured
advanced
functionality
• Spiffy
responsive
design
out
of
the
box
• Doesn’t
require
advanced
Drupal
knowledge
• Can
be
difficult
to
modify
to
meet
your
specifications
• Provided
theme
(Omega
kickstart)
very
complex
and
not
simple
to
customize.
8
9. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Getting
Started
with
Drupal
Commerce
Not
as
easy
but
better
way
Custom
set
up
• Use
KickStart
as
a
reference
• Backoffice
modules
are
awesome
and
provide
best
elements
of
KickStart
• Contributed
modules
do
most
of
the
heavy
lifting
• Create
custom
module(s)
to
override
defaults
and
to
add
new
functionality
• Requires
advanced
Drupal
knowledge
!
9
10. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Commerce
Kickstart
Demo
10
11. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Catman
Demo
11
12. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Taming
the
Beast
Making
Drupal
Commerce
behave
• Most
customizations
can
be
done
without
writing
code
• Rules
can
be
easily
created
or
modified
• Create
custom
modules
to
override
defaults
and
to
add
functionality
• Features
are
your
friend
12
13. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Challenges
and
things
that
didn’t
work
as
expected
Drupal
Commerce
!=
‘nirvana’
• Payment
gateway
provider
changed
• OSU
Drupal
hosting
changed
• Invoices
• Purchase
order
/
Index
codes
• Magic
Links
• Workbench
• Let’s
look
at
some
code
…
!
13
Source: http://macrobits.pinetreecapital.com
14. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Code
examples:
hook_commerce_form_alter()
Remove
the
“Country”
drop-‐down
list
on
checkout
form
14
“Don’t show the list of countries,
our shipping rates only apply to
orders within the USA”
“Don’t show the list of countries,
our shipping rates only apply to
orders within the USA”
15. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Code
examples:
hook_commerce_form_alter()
Remove
the
“Country”
drop-‐down
list
on
checkout
form
15
“Don’t show the list of countries,
our shipping rates only apply to
orders within the USA”
16. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Code
examples:
hook_commerce_form_alter()
Remove
the
“Country”
drop-‐down
list
on
checkout
form
16
v
v
v
v
17. NETC
2014
-‐
Tekkies
in
the
Little
Apple
17
“We need more options than
Pending and Processing,
what about …”
Code
examples:
hook_commerce_order_status_info()
Add
statuses
to
the
pending
order
state.
18. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Code
examples:
hook_commerce_order_status_info()
Add
statuses
to
the
pending
order
state.
18
v
19. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Code
examples:
hook_default_rules_configuration()
Rule
to
add
customer
user
role
when
new
account
is
created
19
20. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Code
examples:
hook_default_rules_configuration()
Rule
to
add
customer
user
role
when
new
account
is
created
20
v
v
v
v
21. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Resources
This
presentation
PDF
will
be
posted
on
NETC
conference
site
Code
examples
used
in
presentation
http://github.com/osu-‐eesc
Drupal
Commerce
http://www.drupalcommerce.org
Commerce
Kickstart
https://drupal.org/project/commerce_kickstart
Bootstrap
http://getbootstrap.com/
21
22. NETC
2014
-‐
Tekkies
in
the
Little
Apple
Bryan Mayjor
bryan.mayjor@oregonstate.edu
22
Source: http://http://www.marcandangel.com