Slide 1

Slide 1 text

Introduction to Spree A Ruby on Rails E-Commerce App by Gregor MacDougall Twitter: @GrMacDougall Website: http://www.freerunningtech.com/

Slide 2

Slide 2 text

About Me Gregor MacDougall Sr. Software Developer @ FreeRunning Technologies

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

The Grand Tour rake sandbox

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Look Familiar? ● Competitors ○ Marketplace Solutions ○ SaaS Solutions ○ Self-hosted Solutions ■ Magento, VirtueMart, ZenCart, Prestashop, osCommerce, OpenCart, …

Slide 15

Slide 15 text

What Makes Spree Different? ● Ruby on Rails ● Rails Engine ● mount Spree::Core::Engine, :at => '/store' ○ / -> Your App ○ /store -> Spree ○ /blog -> Something Else

Slide 16

Slide 16 text

How Does Spree Model Data? Product ● Basic Product ○ Name ○ Description ○ SKU ○ Weight, Dimensions ○ Price

Slide 17

Slide 17 text

How Does Spree Model Data? Product ● Name ● Description Variant ● SKU ● Weight, Dimensions ● Price

Slide 18

Slide 18 text

How Does Spree Model Data? Product - OptionType: colour Variant - OptionValue: black Product - OptionType: colour Variant - OptionValue: red

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

How Does Spree Model Data?

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Customizing Spree ● View Customization ○ CSS ○ Replacing Templates ○ Deface ● Logic Customization ○ Adding new logic ○ Changing existing logic

Slide 25

Slide 25 text

xray-rails

Slide 26

Slide 26 text

Replacing a view Create the following file: ./app/views/spree/shared/_search.html.erb

Slide 27

Slide 27 text

Using Deface to Modify Templates

Slide 28

Slide 28 text

Deface app/views/spree/shared/_products.html.erb

Slide 29

Slide 29 text

Deface app/overrides/before_products.rb

Slide 30

Slide 30 text

Deface (Matching on Template)

Slide 31

Slide 31 text

Customizability Ruby Meta-Programming (pry examples)

Slide 32

Slide 32 text

With Great Power...

Slide 33

Slide 33 text

Mixed Nuts Store

Slide 34

Slide 34 text

Create The Nut Model rails g model Spree::Nut name:string

Slide 35

Slide 35 text

Create The Nut Variant Association rails g model Spree::VariantNut variant: references nut:references

Slide 36

Slide 36 text

Our Models

Slide 37

Slide 37 text

Nut Model In Action

Slide 38

Slide 38 text

Modifying Spree’s Classes app/models/spree/variant_decorator.rb

Slide 39

Slide 39 text

Overriding Spree Functionality

Slide 40

Slide 40 text

Other Spree Features ● Promotions & Discounts ● API ● Stock Location & Inventory Tracking ● ActiveMerchant Support (100+ Payment Gateways) ● Full i18n support (~40 languages currently supported) ● Large Library of Extensions ● and much more

Slide 41

Slide 41 text

For More Information Spree http://www.spreecommerce.com/ http://www.github.com/spree/spree FreeRunning Technologies http://www.freerunningtech.com/

Slide 42

Slide 42 text

About Me Twitter: @GrMacDougall Github: https://github.com/gmacdougall E-mail: [email protected] Slides: http://www.freerunningtech.com/confoo More From Me! Practical Code Review with Gerrit 9:00 AM Tomorrow (Same Room)