The Future of Magento Extensibility | Imagine 2013 Technology | Christopher O’Toole

Post on 20-Feb-2017

597 views 1 download

Transcript of The Future of Magento Extensibility | Imagine 2013 Technology | Christopher O’Toole

Insert photo of speaker

here

891 pixels h x 688 pixels w

New Presentation

Tier in Magento

Eugene Tulika

Software Engineer

Magento

Insert photo of speaker

here

891 pixels h x 688 pixels w

Service IDL

Webhooks

Software Engineer

Magento

Christopher O’Toole

Rethinking the extensions framework in Magento

• Efficient, secure, easy to use

• Focus: Upgradability and Compatibility

• We are introducing new concepts and gathering feedback to

refine the ideas

Services

• Encapsulates the access to the business logic

• Provides access to the data needed in templates

• Have well defined interfaces, which allows exposing the

logic via API

• Keeps access to business logic consistent for all clients:

SOAP, internal, etc

Twig templates

• Template is populated with data

• Restricts view layer from complex business logic and data

access scenarios

• Focused on data rendering

• Development of templates become easier without risk of

changing the business logic

• Allows building a secure view layer

• Automatic output encoding

• Magento provides custom functions and filters to access the

layout functionality within a template

No more SQL queries in Templates!

Twig on Her Majesty’s Secret Service

Access to the Service from view

Services

Configura

ble

Serv

ice C

alls

Presentation tier Business logic

Define the service call configuration

Make a reference to the service call from the layout

Display service data in the Twig

Data from service call can be used in layout

Blocks encapsulation

• Just generic blocks are needed

• Each block has its own data

• Parent block doesn’t share data with child

• Layout elements can be easily repositioned

Configurable dropdown options

• via service call

• via constants

• via configuration

Service?

• Interface to Business logic

• PHP Code

• Remote Endpoint

IDL will be a combination

of PHP annotations

and external schemas

Service IDL

The PHP function receives an

associative array reflecting the

structure described by the annotation

IDL Annotations

Input Data is defined in XML Schema

IDL Input Schema

Expected Output is defined in XML Schema

IDL Output Schema

Webhooks

What?

– Like Event Observers over HTTP

– Eliminates need for polling

– Supports real-time data integrations

– Asynchronous

Webhook Config

Webhook Listener

Parsing Event Data

Extension points where callback

results influence Magento behavior

(synchronous)

Callback Extension Points

• Define your shipping config

• Use the provided callback service

Shipping Extension Config

What was that <subscriber> tag all about?

Callback Subscriber

Shipping Endpoint

Input defined in the IDL

{

"shippingMethods": [

{

"carrier": “acme",

"carrierTitle": “ACME Shipping",

"method": "ground",

"methodTitle": “ACME Ground",

"price": 3.75

}

]

}

Endpoint Response

It Works!