SlideShare une entreprise Scribd logo
1  sur  50
How to write Custom
Modules for PHP-based E-
Commerce Systems
Dr. Roman Zenner
Roman Zenner
•  Working as freelance trainer, author and
developer since 2004
•  Has written two books on Magento
•  Is in the process of writing a book on
OXID eShop
•  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
MVC-Model (extended)
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 definitions
•  Bought by eBay in 2011 (X.commerce)
•  Current stable version: 1.6.1
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 (1)
Modules (2)
IDE, please!
Brief History
•  OS-Edition since late 2008.
•  Based on own PHP-Framework & MySQL
•  Recent version: 4.5.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 field?
Drilling down (1)
Example:
How to get from the article name in
the Smarty-Template to the database field?
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: /views/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 );
}
/core/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 specific 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 Admin:
Plugins (2)
class xmasArticle extends xmasArticle_parent
{
public function getDaysLeft()
{
$time = mktime(0, 0, 0, 12, 25, 2011, 1) - time();
$days = floor($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: 3.5.5
Enlight-Framework
•  Basis functionalities are inherited from Zend
Framework:
•  Syntax and Workflow
•  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 field?
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 find 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 files 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/profile/Roman_Zenner
Twitter: twitter.com/rzenner

Contenu connexe

Tendances

ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0Buu Nguyen
 
HTML5 and CSS3 refresher
HTML5 and CSS3 refresherHTML5 and CSS3 refresher
HTML5 and CSS3 refresherIvano Malavolta
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesWebStackAcademy
 
Templates
TemplatesTemplates
Templatessoon
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8David Chou
 
WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2Mizanur Rahaman Mizan
 
WordPress Themes 101 - PSUWeb13 Workshop
WordPress Themes 101 - PSUWeb13 WorkshopWordPress Themes 101 - PSUWeb13 Workshop
WordPress Themes 101 - PSUWeb13 WorkshopCurtiss Grymala
 
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Curtiss Grymala
 
Living on the Grid - Unlock the Power of Dojo Data Grids in XPages - MWLUG 2013
Living on the Grid - Unlock the Power of Dojo Data Grids in XPages - MWLUG 2013Living on the Grid - Unlock the Power of Dojo Data Grids in XPages - MWLUG 2013
Living on the Grid - Unlock the Power of Dojo Data Grids in XPages - MWLUG 2013balassaitis
 
Dojo Grids in XPages
Dojo Grids in XPagesDojo Grids in XPages
Dojo Grids in XPagesTeamstudio
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_HourDilip Patel
 
Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)Antonio Peric-Mazar
 
Web services in PHP using the NuSOAP library
Web services in PHP using the NuSOAP libraryWeb services in PHP using the NuSOAP library
Web services in PHP using the NuSOAP libraryFulvio Corno
 
Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Fahad Golra
 
JSP - Part 2 (Final)
JSP - Part 2 (Final) JSP - Part 2 (Final)
JSP - Part 2 (Final) Hitesh-Java
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - DirectivesWebStackAcademy
 
Deploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization FilesDeploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization FilesXMetaL
 

Tendances (20)

ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0
 
HTML5 and CSS3 refresher
HTML5 and CSS3 refresherHTML5 and CSS3 refresher
HTML5 and CSS3 refresher
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
Templates
TemplatesTemplates
Templates
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8
 
WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2
 
WordPress Themes 101 - PSUWeb13 Workshop
WordPress Themes 101 - PSUWeb13 WorkshopWordPress Themes 101 - PSUWeb13 Workshop
WordPress Themes 101 - PSUWeb13 Workshop
 
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
 
Living on the Grid - Unlock the Power of Dojo Data Grids in XPages - MWLUG 2013
Living on the Grid - Unlock the Power of Dojo Data Grids in XPages - MWLUG 2013Living on the Grid - Unlock the Power of Dojo Data Grids in XPages - MWLUG 2013
Living on the Grid - Unlock the Power of Dojo Data Grids in XPages - MWLUG 2013
 
Dojo Grids in XPages
Dojo Grids in XPagesDojo Grids in XPages
Dojo Grids in XPages
 
MVC & SQL_In_1_Hour
MVC & SQL_In_1_HourMVC & SQL_In_1_Hour
MVC & SQL_In_1_Hour
 
Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)
 
Web services in PHP using the NuSOAP library
Web services in PHP using the NuSOAP libraryWeb services in PHP using the NuSOAP library
Web services in PHP using the NuSOAP library
 
Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2Lecture 9 - Java Persistence, JPA 2
Lecture 9 - Java Persistence, JPA 2
 
REST Basics
REST BasicsREST Basics
REST Basics
 
Handlebars & Require JS
Handlebars  & Require JSHandlebars  & Require JS
Handlebars & Require JS
 
JSP - Part 2 (Final)
JSP - Part 2 (Final) JSP - Part 2 (Final)
JSP - Part 2 (Final)
 
Content Modeling Behavior
Content Modeling BehaviorContent Modeling Behavior
Content Modeling Behavior
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - Directives
 
Deploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization FilesDeploying Schemas and XMetaL Customization Files
Deploying Schemas and XMetaL Customization Files
 

Similaire à How to Write Custom Modules for PHP-based E-Commerce Systems (2011)

Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Lucidworks
 
Dexterity in the Wild
Dexterity in the WildDexterity in the Wild
Dexterity in the WildDavid Glick
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoFu Cheng
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGentkevinvw
 
Magento mega menu extension
Magento mega menu extensionMagento mega menu extension
Magento mega menu extensionBun Danny
 
Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introductioncherukumilli2
 
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
 
Web Components v1
Web Components v1Web Components v1
Web Components v1Mike Wilcox
 
Oracle BI Publsiher Using Data Template
Oracle BI Publsiher Using Data TemplateOracle BI Publsiher Using Data Template
Oracle BI Publsiher Using Data TemplateEdi Yanto
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!Roberto Messora
 
HTML 5 Fundamental
HTML 5 FundamentalHTML 5 Fundamental
HTML 5 FundamentalLanh Le
 
"Umbraco MVC - a journey of discovery" - Lotte Pitcher
"Umbraco MVC - a journey of discovery" - Lotte Pitcher"Umbraco MVC - a journey of discovery" - Lotte Pitcher
"Umbraco MVC - a journey of discovery" - Lotte Pitcherlottepitcher
 
Stupid Index Block Tricks
Stupid Index Block TricksStupid Index Block Tricks
Stupid Index Block Trickshannonhill
 
Extending and Customizing Open Atrium
Extending and Customizing Open AtriumExtending and Customizing Open Atrium
Extending and Customizing Open AtriumNuvole
 
Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JSAkshay Mathur
 
The Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedThe Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedGil Fink
 
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
 

Similaire à How to Write Custom Modules for PHP-based E-Commerce Systems (2011) (20)

Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
 
Dexterity in the Wild
Dexterity in the WildDexterity in the Wild
Dexterity in the Wild
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
 
Magento mega menu extension
Magento mega menu extensionMagento mega menu extension
Magento mega menu extension
 
Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introduction
 
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
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
 
Oracle BI Publsiher Using Data Template
Oracle BI Publsiher Using Data TemplateOracle BI Publsiher Using Data Template
Oracle BI Publsiher Using Data Template
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!
 
HTML 5 Fundamental
HTML 5 FundamentalHTML 5 Fundamental
HTML 5 Fundamental
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
"Umbraco MVC - a journey of discovery" - Lotte Pitcher
"Umbraco MVC - a journey of discovery" - Lotte Pitcher"Umbraco MVC - a journey of discovery" - Lotte Pitcher
"Umbraco MVC - a journey of discovery" - Lotte Pitcher
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
 
Stupid Index Block Tricks
Stupid Index Block TricksStupid Index Block Tricks
Stupid Index Block Tricks
 
Extending and Customizing Open Atrium
Extending and Customizing Open AtriumExtending and Customizing Open Atrium
Extending and Customizing Open Atrium
 
Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JS
 
The Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedThe Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has Arrived
 
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
 

Plus 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
 

Plus 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
 

Dernier

Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleanscorenetworkseo
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Intellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptxIntellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptxBipin Adhikari
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 

Dernier (20)

Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleans
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Intellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptxIntellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptx
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 

How to Write Custom Modules for PHP-based E-Commerce Systems (2011)

  • 1. How to write Custom Modules for PHP-based E- Commerce Systems Dr. Roman Zenner
  • 2. Roman Zenner •  Working as freelance trainer, author and developer since 2004 •  Has written two books on Magento •  Is in the process of writing a book on OXID eShop •  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
  • 8.
  • 9. 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 definitions •  Bought by eBay in 2011 (X.commerce) •  Current stable version: 1.6.1
  • 13. 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
  • 14. Drilling down (1) Example: How to get from the article name in the template to the database field?
  • 15. 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'); }
  • 16. 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; }
  • 19.
  • 20. Brief History •  OS-Edition since late 2008. •  Based on own PHP-Framework & MySQL •  Recent version: 4.5.3
  • 21. Features •  ADODB database abstraction layer •  Uses Smarty 2 (but Template Inheritance by Smarty 3) •  Block Inheritance •  Autoloader
  • 24. 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
  • 25. 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
  • 26. Drilling down (1) Example: How to get from the article name in the Smarty-Template to the database field?
  • 27. Drilling down (1) Example: How to get from the article name in the Smarty-Template to the database field?
  • 28. 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: /views/details.php
  • 29. 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 ) ) { ... } }
  • 30. 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 ); } /core/oxarticle.php /core/oxbase.php
  • 31. 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
  • 32. Custom classes (2) •  This procedure becomes problematic when there is more than one new module wanting to extend a specific 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
  • 33. 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 Admin:
  • 34. Plugins (2) class xmasArticle extends xmasArticle_parent { public function getDaysLeft() { $time = mktime(0, 0, 0, 12, 25, 2011, 1) - time(); $days = floor($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
  • 35.
  • 36. 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: 3.5.5
  • 37. Enlight-Framework •  Basis functionalities are inherited from Zend Framework: •  Syntax and Workflow •  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
  • 39. 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>
  • 40. Template-Inheritance {extends file=”../_default/frontend/home/index.tpl} {block name=’frontend_index_content’ prepend} <h1>Hallo Welt</h1> {/block} SMARTY: Append – Prepend - Replace
  • 42. Drilling down Example: How to get from the article name in the Smarty-Template to the database field?
  • 43. 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 find 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
  • 44. 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 } }
  • 45. 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; }
  • 46. 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'); }
  • 47. 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) { } }
  • 48. Summary • Each system employs a slightly different method of inserting custom functionalities • Layout and functional files are more or less encapsulated • No core-hacking required – still a need for testing!
  • 49. ?
  • 50. Thank you! Blog: romanzenner.com Skype: roman_zenner XING: xing.com/profile/Roman_Zenner Twitter: twitter.com/rzenner