Magento + WP: MyRingPop.com

Don't get fancy. Don't do it.

Let's talk about

  1. Architectural drivers
  2. Integration options
  3. Why we done did what we did
  4. Some of the nitty gritty
  5. Things to improve
  6. Question time

Thanks to Tim Broder,
because I cloned your presentation code

Stupid photos offered without comment

Beer will change the world

Architectural drivers

  1. Flexible CTDs
  2. Usable admin area
  3. Media management
  4. Ease of Magento integration
  5. Bypass hyper-fractured Magento theming

1. Flexible CTDs

Content types were not fully defined at project start
(nor should they be).

Pods Framework helps.

Advanced Custom Fields is also great.

Beer belt

2. Usable admin area

Target audience: Not CMS wizards.

3. Media management

Don't trust the Magento.

4. Ease of Magento integration

Keep it flexible: loose data coupling

Minimize what Magento needs to know

Banana guy en fuego

5. Bypass hyper-fractured
Magento theming

One page, ten thousand templates

Ten thousand templates, ten thousand blocks

Ten thousand blocks, ten thousand contexts

Simplify bender-fender handoff

Goal: One page = one query = one template

Integration options

  1. FishPig
  2. Custom queries
  3. REST

1. FishPig

Pros

  • Easy integration
  • Popular extension

Cons

  • Tight integration into Magento
  • More than one extension needed
    for custom post types
  • Requires Magento-style theming
Banana fire extinguisher

2. Custom queries

Pros

  • Total control
  • Could make a nifty resource layer

Cons

  • Relies too much on Magento
  • May still require
    Magento-style theming
  • Too much customization for
    the project

3. REST

Pros

  • Loose coupling of services
  • Easy to debug
  • Get to use WP JSON API

Cons

  • Performance implications
  • Requires translation layer
    in Magento

Decision: REST

Darth Vader on beach

Why we done

Did

What we did

Topps_Content

  1. Magento: (Almost no) blocks
  2. Magento: Fat helpers
  3. Magento: Fat templates
  4. WP: No theming
  5. WP: All JSON

1. Magento: (Almost no) blocks

Blocks are great for reusability.

Not reusing? Don't get stuck with blocks.

Page context simplifies reference.

2. Magento: Fat helpers

Avoided fancy data resource layer.

Helpers get data via REST.

Helpers handle multilayered caching.

Provide monolithic data object to presentation layer.

3. Magento: Fat templates

No more "How do I access X from this template?"

Monolithic data object eases context, control.

Aquarium head

4. WP: No theming

WP serves only data.

All presentation is in Magento.

5. WP: All JSON

Extend JSON layer as needed.

Cache JSON responses as needed.

Some of the nitty gritty

Fish geek

A custom post type: Pods

An Article type's custom fields

A custom post type: WP

An Article type's edit view

A custom "parent": Pods

A Subchannel type's custom fields

A custom "parent": WP

A Subchannel type's edit view
Metal.

Subchannel: JSON view

Check it

What Magento needs to know

Magento categories

Fat helper, pt. 1

loadWorld()

Fat helper, pt. 2

populateObjectWithCustomFields()

Fat helper, pt. 3

getCustomFieldsForPostType()

Custom cache layers

Mitigates performance concerns from so many REST calls

Magento cache conrol

Monolithic World object

Bridal-Bachelorette

125 KB

Fun with templating

world.phtml

The Ass family

CMS pages: In WP

A simple WP page

CMS pages: In Magento

Magento CMS reference

CMS pages: Observer

Observer

Star Trek

Things to improve

  • Simplicity of presentation object
  • Portability to other projects
  • Future-proofing for WP/JSON
  • More helpers
  • More: Ask Tom and Adam
Obama Spock
Fake Zebra
Swan Dress

Question time

Question Time