SlideShare una empresa de Scribd logo
1 de 47
How	
  to	
  write	
  Custom	
  
Modules	
  for	
  PHP-­based	
  E-­
Commerce	
  Systems	
  
Roman	
  Z.	
  
Roman	
  Zenner	
  
•  Working	
  as	
  freelance	
  trainer,	
  author	
  and	
  
consultant	
  since	
  2004	
  
•  Has	
  written	
  three	
  books	
  on	
  Magento	
  and	
  
OXID	
  eShop	
  
•  Is	
  in	
  the	
  process	
  of	
  writing	
  a	
  “cookbook”	
  
on	
  OXID	
  eShop	
  with	
  Joscha	
  Krug	
  
•  Publishes	
  in	
  various	
  magazines	
  
Initial	
  thoughts	
  
•  Modularity	
  a	
  no-­‐brainer	
  in	
  today’s	
  
ecommerce	
  software	
  
•  There	
  must	
  be	
  a	
  way	
  of	
  extending	
  classes	
  
or	
  an	
  event-­‐listener	
  system	
  in	
  order	
  to	
  
integrate	
  custom	
  functionalities	
  
Types	
  of	
  modules	
  
•  Encapsulate	
  graphical	
  (template)	
  
changes	
  
•  Provide	
  additional	
  information	
  (e.g.	
  for	
  
an	
  article	
  
•  Special	
  calculations	
  
•  Payment	
  and	
  shipping	
  
•  Other	
  interfaces	
  (ImpEx,	
  etc.)	
  
Today‘s	
  candidates	
  
•  Magento	
  
•  OXID	
  eShop	
  
•  Shopware	
  
http://www.flickr.com/photos/exey/3815327201
Brief	
  History	
  
•  First	
  stable	
  version	
  released	
  in	
  spring	
  2008	
  
•  Community	
  Edition	
  under	
  OSL	
  
•  Professional	
  and	
  Enterprise	
  Editions	
  
•  Based	
  on	
  Zend	
  Framework	
  and	
  MySQL	
  
•  Relies	
  heavily	
  on	
  EAV	
  structure	
  
•  XML	
  de^initions	
  
•  Bought	
  by	
  eBay	
  in	
  2011	
  (X.commerce)	
  
•  Current	
  stable	
  version:	
  1.7.0.2	
  
Structure	
  
Templates	
  (1)	
  
Templates	
  (2)	
  
Templates	
  (2)	
  
<block type="page/html“ name="root" output="toHtml“ template="page/3columns.phtml">
<block type="page/html_header" name="header" as="header">
<block type="page/switch" name="store_language" as="store_language"
template="page/switch/languages.phtml"/></block>
</block>
Template: /layout/page.xml
<?php if(count($this->getStores())>1): ?>
<div class="form-language“>
<?php foreach ($this->getStores() as $_lang): ?>
<?php $_selected = ($_lang->getId() == $this->getCurrentStoreId())
? ' selected="selected"' : '' ?>
<option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>>
<?php endforeach; ?>
</div>
<?php endif; ?>
Template: /template/page/switch/languages.phtml
Drilling	
  down	
  (1)	
  
Example:
How to get from the article name in
the template to the database field?
Drilling	
  down	
  (2)	
  
1.  Block: <block type="catalog/product_view" name="product.info" template="catalog/
product/view.phtml">
2.  Template: /app/design/frontend/base/default/template/catalog/product/view.phtml
3.  Block class: Mage_Catalog_Block_Product_View
4.  Model: Mage_Catalog_Model_Product:
public function getProduct()
{
if (!Mage::registry('product') && $this->getProductId()) {
$product = Mage::getModel('catalog/product')->load($this->getProductId());
Mage::register('product', $product);
}
return Mage::registry('product');
}
Drilling	
  down	
  (3)	
  
1.  Abstract class: Mage_Core_Model_Abstract
2.  Resource model: Mage_Core_Model_Mysql4_Abstract
public function load($id, $field=null)
{
$this->_beforeLoad($id, $field);
$this->_getResource()->load($this, $id, $field);
$this->_afterLoad();
$this->setOrigData();
$this->_hasDataChanges = false;
return $this;
}
Modules	
  
Brief	
  History	
  
•  OS-­‐Edition	
  since	
  late	
  2008.	
  
•  Based	
  on	
  own	
  PHP-­‐Framework	
  &	
  MySQL	
  
•  Recent	
  version:	
  4.7.3	
  
Features	
  
•  ADODB	
  database	
  abstraction	
  layer	
  
•  Uses	
  Smarty	
  2	
  (but	
  Template	
  Inheritance	
  by	
  
Smarty	
  3)	
  
•  Block	
  Inheritance	
  
•  Autoloader	
  
Structure	
  
Template	
  Inheritance	
  (1)	
  
Template	
  Inheritance	
  (2)	
  
[{capture append="oxidBlock_content"}]
[{assign var="oFirstArticle" value=$oView->getFirstArticle()}]
[{/capture}]
[{include file="layout/page.tpl" sidebar="Right"}]
/out/azure/tpl/page/shop/start.tpl
Template	
  Inheritance	
  (3)	
  
<div id="content">
[{include file="message/errors.tpl"}]
[{foreach from=$oxidBlock_content item="_block"}]
[{$_block}]
[{/foreach}]
</div>
[{include file="layout/footer.tpl"}]
/out/azure/tpl/layout/page.tpl
Drilling	
  down	
  (1)	
  
Example:	
  	
  
How	
  to	
  get	
  from	
  the	
  article	
  name	
  in	
  
the	
  Smarty-­‐Template	
  to	
  the	
  database	
  ^ield?	
  
Drilling	
  down	
  (2)	
  
•  Article	
  detail	
  page:	
  /out/azure/tpl/page/details/inc/productmain.tpl	
  
[{block name="details_productmain_title"}]
<h1 id="productTitle"><span itemprop="name">
[{$oDetailsProduct->oxarticles__oxtitle->value}]
[{$oDetailsProduct->oxarticles__oxvarselect->value}]</span></h1>
[{/block}]
Scheme: [Object name]->[Table name]__[Field name]->value
•  View controller: /application/controller/details.php
Drilling	
  down	
  (3)	
  
public function render()
{
$myConfig = $this->getConfig();
$oProduct = $this->getProduct();
}
public function getProduct()
{
$sOxid = oxConfig::getParameter( 'anid' );
$this->_oProduct = oxNew( 'oxarticle' );
if ( !$this->_oProduct->load( $sOxid ) ) {
...
}
}
Drilling	
  down	
  (4)	
  
public function load( $oxID)
{
$blRet = parent::load( $oxID);
public function load( $sOXID)
{
//getting at least one field before lazy loading the object
$this->_addField('oxid', 0);
$sSelect = $this->buildSelectString( array( $this->getViewName().".oxid" => $sOXID));
return $this->_isLoaded = $this->assignRecord( $sSelect );
}
/application/models/oxarticle.php
/core/oxbase.php
Custom	
  classes	
  (1)	
  
•  Most	
  view-­‐	
  and	
  core	
  classes	
  can	
  be	
  overloaded	
  
•  Module	
  are	
  registered	
  in	
  backend	
  
•  Object	
  instantiation	
  via	
  oxNew():	
  core/oxutilsobject.php	
  
oxArticle
my_oxArticle
our_oxArticle
class my_oxArticle extends oxArticle
class our_oxArticle extends my_oxArticle
Custom	
  classes	
  (2)	
  
•  This	
  procedure	
  becomes	
  problematic	
  when	
  there	
  is	
  more	
  
than	
  one	
  new	
  module	
  wanting	
  to	
  extend	
  a	
  speci^ic	
  class.	
  
•  Solution:	
  oxNew()	
  dynamically	
  creates	
  transparent	
  classes	
  
in	
  the	
  form	
  of:	
  [class-­name]_parent	
  
•  This	
  means	
  that	
  by	
  means	
  of	
  the	
  following	
  structure,	
  module	
  
classes	
  can	
  be	
  chained:	
  
–  oxArticle	
  =>	
  my_oxArticle&our_oxArticle	
  
Plugins	
  (1)	
  
•  Task:	
  Write	
  a	
  module	
  that	
  displays	
  the	
  remaining	
  time	
  until	
  
X	
  mas	
  with	
  each	
  article.	
  
1.  New	
  module	
  directory:	
  /modules/xmas/	
  
2.  Publishing	
  it	
  via	
  metadata.php	
  (used	
  to	
  
be	
  via	
  Admin)	
  
'extend' => array(
'oxarticle' => ‘xmas/xmasArticle'
)
Plugins	
  (2)	
  	
  
class	
  xmasArticle	
  extends	
  xmasArticle_parent	
  
{	
  
	
  	
  	
  	
  public	
  function	
  getDaysLeft()	
  
	
  	
  	
  	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $time	
  =	
  mktime(0,	
  0,	
  0,	
  12,	
  25,	
  2011,	
  1)	
  -­‐	
  time();	
  
	
  	
  	
  	
  	
  	
  	
  	
  $days	
  =	
  ^loor($time/86400);	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  $days;	
  
	
  	
  	
  	
  }	
  
}	
  
<div>Only [{$oDetailsProduct->getDaysLeft()}] days left until Xmas!</div>
/modules/xmas/xmasArticle.php
/out/azure/tpl/page/details/inc/productmain.tpl
Brief	
  History	
  
•  First	
  stable	
  version	
  released	
  in	
  2007.	
  
•  OS-­‐Edition	
  since	
  October	
  2010.	
  
•  Since	
  v.3.5	
  based	
  on	
  Enlight	
  Framework	
  (based	
  
on	
  ZF)	
  &	
  MySQL	
  
•  MVC-­‐Model	
  
•  Backend	
  based	
  on	
  ExtJS	
  4	
  
•  Templates	
  based	
  on	
  Smarty	
  3	
  
•  Recent	
  version:	
  4.0.7	
  
Enlight-­‐Framework	
  
•  Basis	
  functionalities	
  are	
  inherited	
  from	
  Zend	
  
Framework:	
  	
  
•  Syntax	
  and	
  Work^low	
  
•  Request-­‐	
  and	
  Response-­‐Objects 	
  	
  
•  Action-­‐Controller	
  Design	
  
•  Rewritten	
  Router	
  /	
  Dispatcher	
  and	
  View-­‐
Object	
  optimised	
  for	
  performance	
  and	
  
expandability	
  	
  
•  Own	
  plugin	
  system	
  based	
  on	
  events	
  and	
  hooks	
  
Template-­‐Structure	
  
index.tpl	
  
{* Content section *}
<div id="content">
<div class="inner”>
{* Content top container *}
{block name="frontend_index_content_top"}{/block}
{* Sidebar left *}
{block name='frontend_index_content_left'}
{include file='frontend/index/left.tpl'}
{/block}
{* Main content *}
{block name='frontend_index_content'}{/block}
{* Sidebar right *}
{block name='frontend_index_content_right'}{/block}
<div class="clear">&nbsp;</div>
</div>
</div>
Template-­‐Inheritance	
  
{extends file=”../_default/frontend/home/index.tpl}
{block name=’frontend_index_content’ prepend}
<h1>Hallo Welt</h1>
{/block}
SMARTY:
Append – Prepend - Replace
Plugin-­‐Directory	
  Structure	
  
Drilling	
  down	
  
Example:	
  	
  
How	
  to	
  get	
  from	
  the	
  article	
  name	
  in	
  
the	
  Smarty-­‐Template	
  to	
  the	
  database	
  ^ield?	
  
Drilling	
  down	
  (2)	
  
•  Article	
  detail	
  page:	
  templates_defaultfrontenddetailindex.tpl	
  
•  Part	
  that	
  displays	
  article	
  name	
  in	
  frontend	
  
•  Template-­‐Path	
  (frontend/detail/index.tpl)	
  tells	
  us	
  where	
  to	
  ^ind	
  the	
  
corresponding	
  controller.	
  In	
  this	
  case:	
  Shopware/Controllers/
Frontend/Detail.php	
  –	
  indexAction.	
  
•  Get	
  article	
  information	
  from	
  Model	
  and	
  assign	
  to	
  template	
  
•  Shopware()-­>Modules()-­>Articles()	
  is	
  a	
  service	
  locator	
  to	
  access	
  the	
  
main	
  article	
  object	
  that	
  could	
  be	
  found	
  at	
  /engine/core/class/
sArticles.php	
  	
  
•  sGetArticleById	
  fetches	
  a	
  certain	
  article	
  by	
  id	
  from	
  database	
  and	
  returns	
  
the	
  result	
  as	
  an	
  array	
  for	
  further	
  processing	
  
Plugins:	
  Bootstrap	
  
<?php
class Shopware_Plugins_Frontend_IPCDEMO_Bootstrap
extends Shopware_Components_Plugin_Bootstrap
{
public function install()
{
//
return true;
}
public static function onPostDispatch(Enlight_Event_EventArgs $args)
{
// Still empty
}
}
Plugins:	
  Event	
  
public function install()
{
$event = $this->createEvent('Enlight_Controller_Action_PostDispatch','onPostDispatch');
$this-> subscribeEvent($event);
$form = $this->Form();
$form->setElement('textarea', ’yourtext',
array('label'=>’Text for left column’,'value'=>’Hello World'));
$form->save();
return true;
}
Plugins:	
  Listener	
  
!public static function onPostDispatch(Enlight_Event_EventArgs $args)
{
$view = $args->getSubject()->View();
$config = Shopware()->Plugins()->Frontend()->IPCDEMO()->Config();
$view->pluginText = $config->yourtext;
$view->addTemplateDir(dirname(__FILE__)."/Views/");
$view->extendsTemplate('plugin.tpl');
}
Plugins:	
  Hooks	
  
<?php
class Shopware_Plugins_Frontend_myHook_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
public function install()
{
$hook = $this->createHook(
'sArticles',
'sGetArticleById',
'onArticle',
Enlight_Hook_HookHandler::TypeAfter,
0
);
$this->subscribeHook($hook);
return true;
}
static function onArticle(Enlight_Hook_HookArgs $args)
{
}
}
Summary	
  
• 	
  Each	
  system	
  employs	
  a	
  slightly	
  different	
  method	
  of	
  	
  
	
  	
  	
  inserting	
  custom	
  functionalities	
  
• 	
  Layout	
  and	
  functional	
  ^iles	
  are	
  more	
  or	
  less	
  
encapsulated	
  
• 	
  No	
  core-­‐hacking	
  required	
  –	
  still	
  a	
  need	
  for	
  testing!	
  
Thank	
  you!	
  
Blog:	
  romanzenner.com	
  
Skype:	
  roman_zenner	
  
XING:	
  xing.com/pro^ile/Roman_Zenner	
  
Twitter:	
  twitter.com/rzenner	
  
MVC-­‐Model	
  (extended)	
  

Más contenido relacionado

La actualidad más candente

Presenting Data Effectively in XPages - ATLUG May 2013
Presenting Data Effectively in XPages - ATLUG May 2013Presenting Data Effectively in XPages - ATLUG May 2013
Presenting Data Effectively in XPages - ATLUG May 2013balassaitis
 
Rich Internet Applications con JavaFX e NetBeans
Rich Internet Applications  con JavaFX e NetBeans Rich Internet Applications  con JavaFX e NetBeans
Rich Internet Applications con JavaFX e NetBeans Fabrizio Giudici
 
Paris Tech Meetup talk : Troubles start at version 1.0
Paris Tech Meetup talk : Troubles start at version 1.0Paris Tech Meetup talk : Troubles start at version 1.0
Paris Tech Meetup talk : Troubles start at version 1.0Laurent Cerveau
 
Hibernate - Part 2
Hibernate - Part 2 Hibernate - Part 2
Hibernate - Part 2 Hitesh-Java
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_HourDilip Patel
 
Deploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization FilesDeploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization FilesXMetaL
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)Talha Ocakçı
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - DirectivesWebStackAcademy
 
Angular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationAngular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationWebStackAcademy
 
HTML5 and CSS3 refresher
HTML5 and CSS3 refresherHTML5 and CSS3 refresher
HTML5 and CSS3 refresherIvano Malavolta
 
Jdom how it works & how it opened the java process
Jdom how it works & how it opened the java processJdom how it works & how it opened the java process
Jdom how it works & how it opened the java processHicham QAISSI
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8David Chou
 

La actualidad más candente (18)

Presenting Data Effectively in XPages - ATLUG May 2013
Presenting Data Effectively in XPages - ATLUG May 2013Presenting Data Effectively in XPages - ATLUG May 2013
Presenting Data Effectively in XPages - ATLUG May 2013
 
Rich Internet Applications con JavaFX e NetBeans
Rich Internet Applications  con JavaFX e NetBeans Rich Internet Applications  con JavaFX e NetBeans
Rich Internet Applications con JavaFX e NetBeans
 
Paris Tech Meetup talk : Troubles start at version 1.0
Paris Tech Meetup talk : Troubles start at version 1.0Paris Tech Meetup talk : Troubles start at version 1.0
Paris Tech Meetup talk : Troubles start at version 1.0
 
JSP - Part 1
JSP - Part 1JSP - Part 1
JSP - Part 1
 
Hibernate - Part 2
Hibernate - Part 2 Hibernate - Part 2
Hibernate - Part 2
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_Hour
 
Deploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization FilesDeploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization Files
 
JDBC Part - 2
JDBC Part - 2JDBC Part - 2
JDBC Part - 2
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
 
Java JDBC
Java JDBCJava JDBC
Java JDBC
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - Directives
 
Handlebars & Require JS
Handlebars  & Require JSHandlebars  & Require JS
Handlebars & Require JS
 
Angular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase IntegrationAngular - Chapter 6 - Firebase Integration
Angular - Chapter 6 - Firebase Integration
 
Hibernate tutorial
Hibernate tutorialHibernate tutorial
Hibernate tutorial
 
HTML5 and CSS3 refresher
HTML5 and CSS3 refresherHTML5 and CSS3 refresher
HTML5 and CSS3 refresher
 
Jdom how it works & how it opened the java process
Jdom how it works & how it opened the java processJdom how it works & how it opened the java process
Jdom how it works & how it opened the java process
 
Jdbc api
Jdbc apiJdbc api
Jdbc api
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8
 

Similar a Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)

Magento mega menu extension
Magento mega menu extensionMagento mega menu extension
Magento mega menu extensionBun Danny
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentIvan Chepurnyi
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedSocial Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedClaudio Procida
 
ExtBase workshop
ExtBase workshop ExtBase workshop
ExtBase workshop schmutt
 
Intro to Drupal Module Developement
Intro to Drupal Module DevelopementIntro to Drupal Module Developement
Intro to Drupal Module DevelopementMatt Mendonca
 
Dexterity in the Wild
Dexterity in the WildDexterity in the Wild
Dexterity in the WildDavid Glick
 
Library management system
Library management systemLibrary management system
Library management systemsiddiqui241993
 
Backbone.js
Backbone.jsBackbone.js
Backbone.jsVO Tho
 
Math-Bridge Architecture
Math-Bridge ArchitectureMath-Bridge Architecture
Math-Bridge Architecturemetamath
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction PresentationNerd Tzanetopoulos
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"LogeekNightUkraine
 
Drupal module development
Drupal module developmentDrupal module development
Drupal module developmentRachit Gupta
 
Web Components v1
Web Components v1Web Components v1
Web Components v1Mike Wilcox
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 

Similar a Modul-Entwicklung für Magento, OXID eShop und Shopware (2013) (20)

CodeIgniter & MVC
CodeIgniter & MVCCodeIgniter & MVC
CodeIgniter & MVC
 
Magento mega menu extension
Magento mega menu extensionMagento mega menu extension
Magento mega menu extension
 
Codeinator
CodeinatorCodeinator
Codeinator
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes DemystifiedSocial Connections VI — IBM Connections Extensions and Themes Demystified
Social Connections VI — IBM Connections Extensions and Themes Demystified
 
ExtBase workshop
ExtBase workshop ExtBase workshop
ExtBase workshop
 
Backbonejs
BackbonejsBackbonejs
Backbonejs
 
Intro to Drupal Module Developement
Intro to Drupal Module DevelopementIntro to Drupal Module Developement
Intro to Drupal Module Developement
 
AngularJS
AngularJSAngularJS
AngularJS
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Dexterity in the Wild
Dexterity in the WildDexterity in the Wild
Dexterity in the Wild
 
Library management system
Library management systemLibrary management system
Library management system
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Math-Bridge Architecture
Math-Bridge ArchitectureMath-Bridge Architecture
Math-Bridge Architecture
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
 
Liferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for DevelopersLiferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for Developers
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"
 
Drupal module development
Drupal module developmentDrupal module development
Drupal module development
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 

Más de Roman Zenner

Daten in Online-Shops: Personalisierung & die Freaky Line (2014)
Daten in Online-Shops: Personalisierung & die Freaky Line (2014)Daten in Online-Shops: Personalisierung & die Freaky Line (2014)
Daten in Online-Shops: Personalisierung & die Freaky Line (2014)Roman Zenner
 
KPIs für den E-Commerce (2014)
KPIs für den E-Commerce (2014)KPIs für den E-Commerce (2014)
KPIs für den E-Commerce (2014)Roman Zenner
 
E-Commerce: Wachstumspotentiale erkennen und nutzen (2013)
E-Commerce: Wachstumspotentiale erkennen und nutzen (2013)E-Commerce: Wachstumspotentiale erkennen und nutzen (2013)
E-Commerce: Wachstumspotentiale erkennen und nutzen (2013)Roman Zenner
 
Die Herausforderung der Einführung einer Multi-Channel-Strategie am Beispiel ...
Die Herausforderung der Einführung einer Multi-Channel-Strategie am Beispiel ...Die Herausforderung der Einführung einer Multi-Channel-Strategie am Beispiel ...
Die Herausforderung der Einführung einer Multi-Channel-Strategie am Beispiel ...Roman Zenner
 
Curated Commerce (2014)
Curated Commerce (2014)Curated Commerce (2014)
Curated Commerce (2014)Roman Zenner
 
... das muss doch einfacher gehen (2013)
... das muss doch einfacher gehen (2013)... das muss doch einfacher gehen (2013)
... das muss doch einfacher gehen (2013)Roman Zenner
 
Neue Trends im E-Commerce (2011)
Neue Trends im E-Commerce (2011)Neue Trends im E-Commerce (2011)
Neue Trends im E-Commerce (2011)Roman Zenner
 
Wie wählt man das richtige Shopsystem? (2012)
Wie wählt man das richtige Shopsystem? (2012)Wie wählt man das richtige Shopsystem? (2012)
Wie wählt man das richtige Shopsystem? (2012)Roman Zenner
 
Github is from Venus, Excel is from Mars: Wie sich Entwickler und Business-En...
Github is from Venus, Excel is from Mars: Wie sich Entwickler und Business-En...Github is from Venus, Excel is from Mars: Wie sich Entwickler und Business-En...
Github is from Venus, Excel is from Mars: Wie sich Entwickler und Business-En...Roman Zenner
 
Commerce im Wandel: Steine, Schweine - und immer an die Leser denken!
Commerce im Wandel: Steine, Schweine - und immer an die Leser denken!Commerce im Wandel: Steine, Schweine - und immer an die Leser denken!
Commerce im Wandel: Steine, Schweine - und immer an die Leser denken!Roman Zenner
 
Mobile Commerce (Meet-Magento 04.10)
Mobile Commerce (Meet-Magento 04.10)Mobile Commerce (Meet-Magento 04.10)
Mobile Commerce (Meet-Magento 04.10)Roman Zenner
 
Magento-Schnittstellen
Magento-SchnittstellenMagento-Schnittstellen
Magento-SchnittstellenRoman Zenner
 

Más de Roman Zenner (12)

Daten in Online-Shops: Personalisierung & die Freaky Line (2014)
Daten in Online-Shops: Personalisierung & die Freaky Line (2014)Daten in Online-Shops: Personalisierung & die Freaky Line (2014)
Daten in Online-Shops: Personalisierung & die Freaky Line (2014)
 
KPIs für den E-Commerce (2014)
KPIs für den E-Commerce (2014)KPIs für den E-Commerce (2014)
KPIs für den E-Commerce (2014)
 
E-Commerce: Wachstumspotentiale erkennen und nutzen (2013)
E-Commerce: Wachstumspotentiale erkennen und nutzen (2013)E-Commerce: Wachstumspotentiale erkennen und nutzen (2013)
E-Commerce: Wachstumspotentiale erkennen und nutzen (2013)
 
Die Herausforderung der Einführung einer Multi-Channel-Strategie am Beispiel ...
Die Herausforderung der Einführung einer Multi-Channel-Strategie am Beispiel ...Die Herausforderung der Einführung einer Multi-Channel-Strategie am Beispiel ...
Die Herausforderung der Einführung einer Multi-Channel-Strategie am Beispiel ...
 
Curated Commerce (2014)
Curated Commerce (2014)Curated Commerce (2014)
Curated Commerce (2014)
 
... das muss doch einfacher gehen (2013)
... das muss doch einfacher gehen (2013)... das muss doch einfacher gehen (2013)
... das muss doch einfacher gehen (2013)
 
Neue Trends im E-Commerce (2011)
Neue Trends im E-Commerce (2011)Neue Trends im E-Commerce (2011)
Neue Trends im E-Commerce (2011)
 
Wie wählt man das richtige Shopsystem? (2012)
Wie wählt man das richtige Shopsystem? (2012)Wie wählt man das richtige Shopsystem? (2012)
Wie wählt man das richtige Shopsystem? (2012)
 
Github is from Venus, Excel is from Mars: Wie sich Entwickler und Business-En...
Github is from Venus, Excel is from Mars: Wie sich Entwickler und Business-En...Github is from Venus, Excel is from Mars: Wie sich Entwickler und Business-En...
Github is from Venus, Excel is from Mars: Wie sich Entwickler und Business-En...
 
Commerce im Wandel: Steine, Schweine - und immer an die Leser denken!
Commerce im Wandel: Steine, Schweine - und immer an die Leser denken!Commerce im Wandel: Steine, Schweine - und immer an die Leser denken!
Commerce im Wandel: Steine, Schweine - und immer an die Leser denken!
 
Mobile Commerce (Meet-Magento 04.10)
Mobile Commerce (Meet-Magento 04.10)Mobile Commerce (Meet-Magento 04.10)
Mobile Commerce (Meet-Magento 04.10)
 
Magento-Schnittstellen
Magento-SchnittstellenMagento-Schnittstellen
Magento-Schnittstellen
 

Último

Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...Escorts Call Girls
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Último (20)

Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 

Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)

  • 1. How  to  write  Custom   Modules  for  PHP-­based  E-­ Commerce  Systems   Roman  Z.  
  • 2. Roman  Zenner   •  Working  as  freelance  trainer,  author  and   consultant  since  2004   •  Has  written  three  books  on  Magento  and   OXID  eShop   •  Is  in  the  process  of  writing  a  “cookbook”   on  OXID  eShop  with  Joscha  Krug   •  Publishes  in  various  magazines  
  • 3. Initial  thoughts   •  Modularity  a  no-­‐brainer  in  today’s   ecommerce  software   •  There  must  be  a  way  of  extending  classes   or  an  event-­‐listener  system  in  order  to   integrate  custom  functionalities  
  • 4. Types  of  modules   •  Encapsulate  graphical  (template)   changes   •  Provide  additional  information  (e.g.  for   an  article   •  Special  calculations   •  Payment  and  shipping   •  Other  interfaces  (ImpEx,  etc.)  
  • 5. Today‘s  candidates   •  Magento   •  OXID  eShop   •  Shopware  
  • 7.
  • 8. Brief  History   •  First  stable  version  released  in  spring  2008   •  Community  Edition  under  OSL   •  Professional  and  Enterprise  Editions   •  Based  on  Zend  Framework  and  MySQL   •  Relies  heavily  on  EAV  structure   •  XML  de^initions   •  Bought  by  eBay  in  2011  (X.commerce)   •  Current  stable  version:  1.7.0.2  
  • 12. Templates  (2)   <block type="page/html“ name="root" output="toHtml“ template="page/3columns.phtml"> <block type="page/html_header" name="header" as="header"> <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/></block> </block> Template: /layout/page.xml <?php if(count($this->getStores())>1): ?> <div class="form-language“> <?php foreach ($this->getStores() as $_lang): ?> <?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?> <option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>> <?php endforeach; ?> </div> <?php endif; ?> Template: /template/page/switch/languages.phtml
  • 13. Drilling  down  (1)   Example: How to get from the article name in the template to the database field?
  • 14. Drilling  down  (2)   1.  Block: <block type="catalog/product_view" name="product.info" template="catalog/ product/view.phtml"> 2.  Template: /app/design/frontend/base/default/template/catalog/product/view.phtml 3.  Block class: Mage_Catalog_Block_Product_View 4.  Model: Mage_Catalog_Model_Product: public function getProduct() { if (!Mage::registry('product') && $this->getProductId()) { $product = Mage::getModel('catalog/product')->load($this->getProductId()); Mage::register('product', $product); } return Mage::registry('product'); }
  • 15. Drilling  down  (3)   1.  Abstract class: Mage_Core_Model_Abstract 2.  Resource model: Mage_Core_Model_Mysql4_Abstract public function load($id, $field=null) { $this->_beforeLoad($id, $field); $this->_getResource()->load($this, $id, $field); $this->_afterLoad(); $this->setOrigData(); $this->_hasDataChanges = false; return $this; }
  • 17.
  • 18. Brief  History   •  OS-­‐Edition  since  late  2008.   •  Based  on  own  PHP-­‐Framework  &  MySQL   •  Recent  version:  4.7.3  
  • 19. Features   •  ADODB  database  abstraction  layer   •  Uses  Smarty  2  (but  Template  Inheritance  by   Smarty  3)   •  Block  Inheritance   •  Autoloader  
  • 22. Template  Inheritance  (2)   [{capture append="oxidBlock_content"}] [{assign var="oFirstArticle" value=$oView->getFirstArticle()}] [{/capture}] [{include file="layout/page.tpl" sidebar="Right"}] /out/azure/tpl/page/shop/start.tpl
  • 23. Template  Inheritance  (3)   <div id="content"> [{include file="message/errors.tpl"}] [{foreach from=$oxidBlock_content item="_block"}] [{$_block}] [{/foreach}] </div> [{include file="layout/footer.tpl"}] /out/azure/tpl/layout/page.tpl
  • 24. Drilling  down  (1)   Example:     How  to  get  from  the  article  name  in   the  Smarty-­‐Template  to  the  database  ^ield?  
  • 25. Drilling  down  (2)   •  Article  detail  page:  /out/azure/tpl/page/details/inc/productmain.tpl   [{block name="details_productmain_title"}] <h1 id="productTitle"><span itemprop="name"> [{$oDetailsProduct->oxarticles__oxtitle->value}] [{$oDetailsProduct->oxarticles__oxvarselect->value}]</span></h1> [{/block}] Scheme: [Object name]->[Table name]__[Field name]->value •  View controller: /application/controller/details.php
  • 26. Drilling  down  (3)   public function render() { $myConfig = $this->getConfig(); $oProduct = $this->getProduct(); } public function getProduct() { $sOxid = oxConfig::getParameter( 'anid' ); $this->_oProduct = oxNew( 'oxarticle' ); if ( !$this->_oProduct->load( $sOxid ) ) { ... } }
  • 27. Drilling  down  (4)   public function load( $oxID) { $blRet = parent::load( $oxID); public function load( $sOXID) { //getting at least one field before lazy loading the object $this->_addField('oxid', 0); $sSelect = $this->buildSelectString( array( $this->getViewName().".oxid" => $sOXID)); return $this->_isLoaded = $this->assignRecord( $sSelect ); } /application/models/oxarticle.php /core/oxbase.php
  • 28. Custom  classes  (1)   •  Most  view-­‐  and  core  classes  can  be  overloaded   •  Module  are  registered  in  backend   •  Object  instantiation  via  oxNew():  core/oxutilsobject.php   oxArticle my_oxArticle our_oxArticle class my_oxArticle extends oxArticle class our_oxArticle extends my_oxArticle
  • 29. Custom  classes  (2)   •  This  procedure  becomes  problematic  when  there  is  more   than  one  new  module  wanting  to  extend  a  speci^ic  class.   •  Solution:  oxNew()  dynamically  creates  transparent  classes   in  the  form  of:  [class-­name]_parent   •  This  means  that  by  means  of  the  following  structure,  module   classes  can  be  chained:   –  oxArticle  =>  my_oxArticle&our_oxArticle  
  • 30. Plugins  (1)   •  Task:  Write  a  module  that  displays  the  remaining  time  until   X  mas  with  each  article.   1.  New  module  directory:  /modules/xmas/   2.  Publishing  it  via  metadata.php  (used  to   be  via  Admin)   'extend' => array( 'oxarticle' => ‘xmas/xmasArticle' )
  • 31. Plugins  (2)     class  xmasArticle  extends  xmasArticle_parent   {          public  function  getDaysLeft()          {                  $time  =  mktime(0,  0,  0,  12,  25,  2011,  1)  -­‐  time();                  $days  =  ^loor($time/86400);                  return  $days;          }   }   <div>Only [{$oDetailsProduct->getDaysLeft()}] days left until Xmas!</div> /modules/xmas/xmasArticle.php /out/azure/tpl/page/details/inc/productmain.tpl
  • 32.
  • 33. Brief  History   •  First  stable  version  released  in  2007.   •  OS-­‐Edition  since  October  2010.   •  Since  v.3.5  based  on  Enlight  Framework  (based   on  ZF)  &  MySQL   •  MVC-­‐Model   •  Backend  based  on  ExtJS  4   •  Templates  based  on  Smarty  3   •  Recent  version:  4.0.7  
  • 34. Enlight-­‐Framework   •  Basis  functionalities  are  inherited  from  Zend   Framework:     •  Syntax  and  Work^low   •  Request-­‐  and  Response-­‐Objects     •  Action-­‐Controller  Design   •  Rewritten  Router  /  Dispatcher  and  View-­‐ Object  optimised  for  performance  and   expandability     •  Own  plugin  system  based  on  events  and  hooks  
  • 36. index.tpl   {* Content section *} <div id="content"> <div class="inner”> {* Content top container *} {block name="frontend_index_content_top"}{/block} {* Sidebar left *} {block name='frontend_index_content_left'} {include file='frontend/index/left.tpl'} {/block} {* Main content *} {block name='frontend_index_content'}{/block} {* Sidebar right *} {block name='frontend_index_content_right'}{/block} <div class="clear">&nbsp;</div> </div> </div>
  • 37. Template-­‐Inheritance   {extends file=”../_default/frontend/home/index.tpl} {block name=’frontend_index_content’ prepend} <h1>Hallo Welt</h1> {/block} SMARTY: Append – Prepend - Replace
  • 39. Drilling  down   Example:     How  to  get  from  the  article  name  in   the  Smarty-­‐Template  to  the  database  ^ield?  
  • 40. Drilling  down  (2)   •  Article  detail  page:  templates_defaultfrontenddetailindex.tpl   •  Part  that  displays  article  name  in  frontend   •  Template-­‐Path  (frontend/detail/index.tpl)  tells  us  where  to  ^ind  the   corresponding  controller.  In  this  case:  Shopware/Controllers/ Frontend/Detail.php  –  indexAction.   •  Get  article  information  from  Model  and  assign  to  template   •  Shopware()-­>Modules()-­>Articles()  is  a  service  locator  to  access  the   main  article  object  that  could  be  found  at  /engine/core/class/ sArticles.php     •  sGetArticleById  fetches  a  certain  article  by  id  from  database  and  returns   the  result  as  an  array  for  further  processing  
  • 41. Plugins:  Bootstrap   <?php class Shopware_Plugins_Frontend_IPCDEMO_Bootstrap extends Shopware_Components_Plugin_Bootstrap { public function install() { // return true; } public static function onPostDispatch(Enlight_Event_EventArgs $args) { // Still empty } }
  • 42. Plugins:  Event   public function install() { $event = $this->createEvent('Enlight_Controller_Action_PostDispatch','onPostDispatch'); $this-> subscribeEvent($event); $form = $this->Form(); $form->setElement('textarea', ’yourtext', array('label'=>’Text for left column’,'value'=>’Hello World')); $form->save(); return true; }
  • 43. Plugins:  Listener   !public static function onPostDispatch(Enlight_Event_EventArgs $args) { $view = $args->getSubject()->View(); $config = Shopware()->Plugins()->Frontend()->IPCDEMO()->Config(); $view->pluginText = $config->yourtext; $view->addTemplateDir(dirname(__FILE__)."/Views/"); $view->extendsTemplate('plugin.tpl'); }
  • 44. Plugins:  Hooks   <?php class Shopware_Plugins_Frontend_myHook_Bootstrap extends Shopware_Components_Plugin_Bootstrap { public function install() { $hook = $this->createHook( 'sArticles', 'sGetArticleById', 'onArticle', Enlight_Hook_HookHandler::TypeAfter, 0 ); $this->subscribeHook($hook); return true; } static function onArticle(Enlight_Hook_HookArgs $args) { } }
  • 45. Summary   •   Each  system  employs  a  slightly  different  method  of          inserting  custom  functionalities   •   Layout  and  functional  ^iles  are  more  or  less   encapsulated   •   No  core-­‐hacking  required  –  still  a  need  for  testing!  
  • 46. Thank  you!   Blog:  romanzenner.com   Skype:  roman_zenner   XING:  xing.com/pro^ile/Roman_Zenner   Twitter:  twitter.com/rzenner