SlideShare a Scribd company logo
1 of 27
Download to read offline
Tutorial: How to Develop
   A Basic Magento Extension

How to create your own blocks and templates in 
 Magento Commerce using Extensions.




Hendy Irawan
@hendyirawan ­ magentoadmin.blogspot.com
CTO, Bippo
Magento Extension
Project Folder Structure
Project Folder Structure
    (design & skin)
Filename Mapping Conventions
   code/{Company}/{Module}
    -> app/code/community/{Company}/{Module}
   design/frontend/base/default/...
    -> app/design/frontend/base/default/...
   skin/frontend/base/default/...
    -> skin/frontend/base/default/...
   {Company}_{Module}.xml
    -> app/etc/modules/{Company}_{Module}.xml
Creating a Basic Block + Template
Module etc/config.xml (Basic)
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Bippo_Twitter>
            <version>1.0.0</version>
        </Bippo_Twitter>
    </modules>
</config>




code/Bippo/Twitter/etc/config.xml
Block & Helper config.xml
<config>
...
    <global>
         <models/>

        <blocks>
          <bippotwitter >
            <class>Bippo_Twitter_Block </class>
          </bippotwitter >
        </blocks>

        <helpers>
           <bippotwitter >
              <class>Bippo_Twitter_Helper </class>
           </bippotwitter >
        </helpers>
    </global>
</config>

code/Bippo/Twitter/etc/config.xml
Helper class
<?php

class Bippo_Twitter_Helper_Data
  extends Mage_Core_Helper_Abstract
{

}



code/Bippo/Twitter/Helper/Data.php
Block Class Skeleton
<?php
/**
  * Twitter Profile Stream.
  *
  * @category    Bippo
  * @package     Bippo_Twitter
  * @author      Rully Lukman <rully@bippo.co.id>
  */
class Bippo_Twitter_Block_Profilestream
    extends Mage_Core_Block_Template
{
}


code/Bippo/Twitter/Block/Profilestream.php
Block Class Implementation
class Bippo_Twitter_Block_Profilestream
  extends Mage_Core_Block_Template {

public function __construct() {
  parent::__construct();
  // template
  $this->setTemplate('bippotwitter/twitter-box.phtml');
}

}




code/Bippo/Twitter/Block/Profilestream.php
Template File
<div class="twitterbox">
<script
src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
...
  }
}).render().setUser('bippoindonesia').start();
</script>
</div>




design/frontend/base/default/
  template/bippotwitter/twitter-box .phtml
How to Use
Usage in CMS Content Editor
{{block type="bippotwitter/profilestream"}}




Usage in CMS Design tab / Layout XML
<reference name="content">
  <block type="bippotwitter/profilestream"
    name="twitterbox1"/>
</reference>
Making the Block Configurable
Adding Properties
private $twitterUsername ;

public function __construct() {
  parent::__construct();
  // property default values
  $this->twitterUsername = 'bippoindonesia';
  // template
  $this->setTemplate('bippotwitter/twitter-box.phtml');
}

public function getTwitterUsername () {
  return $this->twitterUsername ;
}

public function setTwitterUsername($twitterUsername) {
  $this->twitterUsername = $twitterUsername ;
}

code/Bippo/Twitter/Block/Profilestream.php
Using Properties
<div class="twitterbox">
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
...
  }
}).render()
  .setUser('<?php echo $this->getTwitterUsername() ?> ')
  .start();
</script>
</div>




design/frontend/base/default/
  template/bippotwitter/twitter-box .phtml
Usage in CMS Content
{{block type="bippotwitter/profilestream"
  twitterUsername="hendyirawan"}}
Usage in CMS Design tab /
          Layout XML
<reference name="content">
  <block type="bippotwitter/profilestream"
    name="twitterbox2">
    <action method="setTwitterUsername">
      <twitterUsername>
        soluvas
      </twitterUsername>
    </action>
  </block>
</reference>
Supporting
Admin Panel > System > Configuration
Bippo Twitter Configuration :)
Adminhtml Input Fields
<?xml version="1.0"?>
<!--
/**
 * Bippo Twitter
 *
 * @category   Bippo
 * @package    Bippo_Twitter
 * @copyright Copyright (c) 2011 Bippo.co.id
 */
-->
<config>
    <tabs>
        <bippo>
            <label>Bippo</label>
            <sort_order>196</sort_order>
        </bippo>
    </tabs>
...




code/Bippo/Twitter/etc/system.xml
Tabs in Configuration Page
<?xml version="1.0"?>
<!--
/**
 * Bippo Twitter
 *
 * @category   Bippo
 * @package    Bippo_Twitter
 * @copyright Copyright (c) 2011 Bippo.co.id
 */
-->
<config>
    <tabs>
        <bippo>
            <label>Bippo</label>
            <sort_order>196</sort_order>
        </bippo>
    </tabs>
...




code/Bippo/Twitter/etc/system.xml
Sections
<config>
    ...
    <sections>
     <bippotwitter translate="title"
        module="bippotwitter">
         <label>Twitter</label>
         <tab>bippo</tab>
             <frontend_type>text</frontend_type>
             <sort_order>73</sort_order>
             <show_in_default>1</show_in_default>
             <show_in_website>1</show_in_website>
             <show_in_store>1</show_in_store>
             <groups>
               ...

code/Bippo/Twitter/etc/system.xml
Groups
<config>
...
    <sections>
      <bippotwitter translate="title"
       module="bippotwitter">
      ...
            <groups>
                <general translate="label">
                     <label>General</label>
                     <sort_order>100</sort_order>
                     <show_in_default>1</show_in_default>
                     <show_in_website>1</show_in_website>
                     <show_in_store>1</show_in_store>
                     <fields>
                        ...


code/Bippo/Twitter/etc/system.xml
Fields
<config>
  ...
  <sections>
    <bippotwitter ...>
      ...
      <groups>
         <general ...>
           ...
           <fields>
             <custom_twitter_id translate="label">
               <label>Twitter ID</label>
               <comment><![CDATA[Twitter username]]></comment>
               <frontend_type>text</frontend_type>
               <sort_order>20</sort_order>
               <show_in_default>1</show_in_default>
               <show_in_website>1</show_in_website>
               <show_in_store>1</show_in_store>
             </custom_twitter_id>
             <number_of_tweets translate="label">
               ...

code/Bippo/Twitter/etc/system.xml
Access Control
<?xml version="1.0"?>
<config>
<acl>
  <resources>
    <admin>
      <children>
        <system>
          <children>
            <config>
              <children>
                <bippotwitter translate="title" module="bippotwitter">
                  <title>Twitter</title>
                </bippotwitter>
              </children>
            </config>
          </children>
        </system>
      </children>
    </admin>
  </resources>
</acl>
</config>


code/Bippo/Twitter/etc/adminhtml.xml
Default Configuration Values
<config>
...
  <default>
    <bippotwitter >
      <general>
         <custom_twitter_id >bippoindonesia</custom_twitter_id >
         <number_of_tweets >5</number_of_tweets>
         <live>1</live>
      </general>
    </bippotwitter >
  </default>
...
</config>




code/Bippo/Twitter/etc/config.xml
Need More Resources?

   Magento eCommerce Development Blog
     magentoadmin.blogspot.com
   Follow @hendyirawan on Twitter
   Follow ceefour on Slideshare
     www.slideshare.net/ceefour
Hendy Irawan

More Related Content

What's hot

Jinja2 Templates - San Francisco Flask Meetup
Jinja2 Templates - San Francisco Flask MeetupJinja2 Templates - San Francisco Flask Meetup
Jinja2 Templates - San Francisco Flask MeetupAlan Hamlett
 
Magento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kcMagento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kcSuman KC
 
Joomla Day UK 2009 Menus Presentation
Joomla Day UK 2009 Menus PresentationJoomla Day UK 2009 Menus Presentation
Joomla Day UK 2009 Menus PresentationChris Davenport
 
May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014Chad Windnagle
 
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksMagento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksYireo
 
7 reasons why developers should love Joomla!
7 reasons why developers should love Joomla!7 reasons why developers should love Joomla!
7 reasons why developers should love Joomla!Bartłomiej Krztuk
 
Joomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic TemplatesJoomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic TemplatesChris Davenport
 
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...Peter Martin
 
Editing the Visual Editor (WordPress)
Editing the Visual Editor (WordPress)Editing the Visual Editor (WordPress)
Editing the Visual Editor (WordPress)Jake Goldman
 
Developing new feature in Joomla - Joomladay UK 2016
Developing new feature in Joomla - Joomladay UK 2016Developing new feature in Joomla - Joomladay UK 2016
Developing new feature in Joomla - Joomladay UK 2016Peter Martin
 
Drupal 7 — Circle theme
Drupal 7 — Circle themeDrupal 7 — Circle theme
Drupal 7 — Circle themeKirill Borzov
 
Develop advance joomla! MVC Component for version 3
Develop advance joomla! MVC Component for version 3Develop advance joomla! MVC Component for version 3
Develop advance joomla! MVC Component for version 3Gunjan Patel
 
Magento Product Types Demystified
Magento Product Types DemystifiedMagento Product Types Demystified
Magento Product Types DemystifiedAOE
 
Magento 2 Design Patterns
Magento 2 Design PatternsMagento 2 Design Patterns
Magento 2 Design PatternsMax Pronko
 
Angular js filters and directives
Angular js filters and directivesAngular js filters and directives
Angular js filters and directivesDarryl Sherman
 

What's hot (20)

Mangento
MangentoMangento
Mangento
 
Jinja2 Templates - San Francisco Flask Meetup
Jinja2 Templates - San Francisco Flask MeetupJinja2 Templates - San Francisco Flask Meetup
Jinja2 Templates - San Francisco Flask Meetup
 
Magento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kcMagento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kc
 
DRUPAL Menu System
DRUPAL Menu SystemDRUPAL Menu System
DRUPAL Menu System
 
Joomla Day UK 2009 Menus Presentation
Joomla Day UK 2009 Menus PresentationJoomla Day UK 2009 Menus Presentation
Joomla Day UK 2009 Menus Presentation
 
May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014
 
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarksMagento 2 Seminar - Daniel Genis - Magento 2 benchmarks
Magento 2 Seminar - Daniel Genis - Magento 2 benchmarks
 
7 reasons why developers should love Joomla!
7 reasons why developers should love Joomla!7 reasons why developers should love Joomla!
7 reasons why developers should love Joomla!
 
Joomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic TemplatesJoomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic Templates
 
Magento20100226
Magento20100226Magento20100226
Magento20100226
 
Magento20100313
Magento20100313Magento20100313
Magento20100313
 
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
 
Editing the Visual Editor (WordPress)
Editing the Visual Editor (WordPress)Editing the Visual Editor (WordPress)
Editing the Visual Editor (WordPress)
 
Developing new feature in Joomla - Joomladay UK 2016
Developing new feature in Joomla - Joomladay UK 2016Developing new feature in Joomla - Joomladay UK 2016
Developing new feature in Joomla - Joomladay UK 2016
 
18. images in symfony 4
18. images in symfony 418. images in symfony 4
18. images in symfony 4
 
Drupal 7 — Circle theme
Drupal 7 — Circle themeDrupal 7 — Circle theme
Drupal 7 — Circle theme
 
Develop advance joomla! MVC Component for version 3
Develop advance joomla! MVC Component for version 3Develop advance joomla! MVC Component for version 3
Develop advance joomla! MVC Component for version 3
 
Magento Product Types Demystified
Magento Product Types DemystifiedMagento Product Types Demystified
Magento Product Types Demystified
 
Magento 2 Design Patterns
Magento 2 Design PatternsMagento 2 Design Patterns
Magento 2 Design Patterns
 
Angular js filters and directives
Angular js filters and directivesAngular js filters and directives
Angular js filters and directives
 

Similar to How to Develop a Basic Magento Extension Tutorial

Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckAnthony Montalbano
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development Mage Guru
 
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017Joke Puts
 
Implement rich snippets in your webshop
Implement rich snippets in your webshopImplement rich snippets in your webshop
Implement rich snippets in your webshopArjen Miedema
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento Ravi Mehrotra
 
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Ted Kulp
 
Html 5, a gentle introduction
Html 5, a gentle introductionHtml 5, a gentle introduction
Html 5, a gentle introductionDiego Scataglini
 
Odoo Experience 2018 - From a Web Controller to a Full CMS
Odoo Experience 2018 - From a Web Controller to a Full CMSOdoo Experience 2018 - From a Web Controller to a Full CMS
Odoo Experience 2018 - From a Web Controller to a Full CMSElínAnna Jónasdóttir
 
Html5, a gentle introduction
Html5, a gentle introduction Html5, a gentle introduction
Html5, a gentle introduction Diego Scataglini
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and ImprovedTimothy Fisher
 
Rails Antipatterns | Open Session with Chad Pytel
Rails Antipatterns | Open Session with Chad Pytel Rails Antipatterns | Open Session with Chad Pytel
Rails Antipatterns | Open Session with Chad Pytel Engine Yard
 
Resource and view
Resource and viewResource and view
Resource and viewPapp Laszlo
 
Movable Type Seminar 2011
Movable Type Seminar 2011Movable Type Seminar 2011
Movable Type Seminar 2011Six Apart KK
 
Web design and Development
Web design and DevelopmentWeb design and Development
Web design and DevelopmentShagor Ahmed
 
Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015Phil Leggetter
 

Similar to How to Develop a Basic Magento Extension Tutorial (20)

Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
 
iWebkit
iWebkitiWebkit
iWebkit
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
 
Magento20100807
Magento20100807Magento20100807
Magento20100807
 
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
 
Implement rich snippets in your webshop
Implement rich snippets in your webshopImplement rich snippets in your webshop
Implement rich snippets in your webshop
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
 
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101
 
Html 5, a gentle introduction
Html 5, a gentle introductionHtml 5, a gentle introduction
Html 5, a gentle introduction
 
Bootstrap with liferay
Bootstrap with liferayBootstrap with liferay
Bootstrap with liferay
 
Odoo Experience 2018 - From a Web Controller to a Full CMS
Odoo Experience 2018 - From a Web Controller to a Full CMSOdoo Experience 2018 - From a Web Controller to a Full CMS
Odoo Experience 2018 - From a Web Controller to a Full CMS
 
Html5, a gentle introduction
Html5, a gentle introduction Html5, a gentle introduction
Html5, a gentle introduction
 
Django crush course
Django crush course Django crush course
Django crush course
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Rails Antipatterns | Open Session with Chad Pytel
Rails Antipatterns | Open Session with Chad Pytel Rails Antipatterns | Open Session with Chad Pytel
Rails Antipatterns | Open Session with Chad Pytel
 
Resource and view
Resource and viewResource and view
Resource and view
 
Web Programming Projects
Web Programming ProjectsWeb Programming Projects
Web Programming Projects
 
Movable Type Seminar 2011
Movable Type Seminar 2011Movable Type Seminar 2011
Movable Type Seminar 2011
 
Web design and Development
Web design and DevelopmentWeb design and Development
Web design and Development
 
Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015
 

More from Hendy Irawan

Apa yang dapat Anda raih dengan Besut Kode Universitas
Apa yang dapat Anda raih dengan Besut Kode UniversitasApa yang dapat Anda raih dengan Besut Kode Universitas
Apa yang dapat Anda raih dengan Besut Kode UniversitasHendy Irawan
 
Persiapan Google Summer of Code (GSoC)
Persiapan Google Summer of Code (GSoC)Persiapan Google Summer of Code (GSoC)
Persiapan Google Summer of Code (GSoC)Hendy Irawan
 
Tutorial JSON-LD dan RabbitMQ di Java
Tutorial JSON-LD dan RabbitMQ di JavaTutorial JSON-LD dan RabbitMQ di Java
Tutorial JSON-LD dan RabbitMQ di JavaHendy Irawan
 
EBA Internship Program 2015-2016
EBA Internship Program 2015-2016EBA Internship Program 2015-2016
EBA Internship Program 2015-2016Hendy Irawan
 
Big Data innovation in Japan’s energy industry - EBA Fieldwork 2015
Big Data innovation in Japan’s energy industry - EBA Fieldwork 2015Big Data innovation in Japan’s energy industry - EBA Fieldwork 2015
Big Data innovation in Japan’s energy industry - EBA Fieldwork 2015Hendy Irawan
 
EBA (Evidence-Based Approach) Culture
EBA (Evidence-Based Approach) CultureEBA (Evidence-Based Approach) Culture
EBA (Evidence-Based Approach) CultureHendy Irawan
 
Peraturan Walikota (Perwal) PPDB Kota Bandung Tahun 2015
Peraturan Walikota (Perwal) PPDB Kota Bandung Tahun 2015Peraturan Walikota (Perwal) PPDB Kota Bandung Tahun 2015
Peraturan Walikota (Perwal) PPDB Kota Bandung Tahun 2015Hendy Irawan
 
Sosialisasi Petunjuk Teknis Penerimaan Peserta Didik Baru (PPDB) Kota Bandung...
Sosialisasi Petunjuk Teknis Penerimaan Peserta Didik Baru (PPDB) Kota Bandung...Sosialisasi Petunjuk Teknis Penerimaan Peserta Didik Baru (PPDB) Kota Bandung...
Sosialisasi Petunjuk Teknis Penerimaan Peserta Didik Baru (PPDB) Kota Bandung...Hendy Irawan
 
Twitter Author Prediction from Tweets using Bayesian Network
Twitter Author Prediction from Tweets using Bayesian NetworkTwitter Author Prediction from Tweets using Bayesian Network
Twitter Author Prediction from Tweets using Bayesian NetworkHendy Irawan
 
Biased Media - Game Theory (EL5000) Course Project
Biased Media - Game Theory (EL5000) Course ProjectBiased Media - Game Theory (EL5000) Course Project
Biased Media - Game Theory (EL5000) Course ProjectHendy Irawan
 
3D Reality Tracking in Realtime - Team Hendy-Sigit
3D Reality Tracking in Realtime - Team Hendy-Sigit3D Reality Tracking in Realtime - Team Hendy-Sigit
3D Reality Tracking in Realtime - Team Hendy-SigitHendy Irawan
 
Pemrograman Logika Induktif (Inductive Logic Programming)
Pemrograman Logika Induktif (Inductive Logic Programming)Pemrograman Logika Induktif (Inductive Logic Programming)
Pemrograman Logika Induktif (Inductive Logic Programming)Hendy Irawan
 
Inductive Logic Programming
Inductive Logic ProgrammingInductive Logic Programming
Inductive Logic ProgrammingHendy Irawan
 
AksiMata Studio Tablet
AksiMata Studio TabletAksiMata Studio Tablet
AksiMata Studio TabletHendy Irawan
 
AksiMata Studio for Lenovo® AIO
AksiMata Studio for Lenovo® AIOAksiMata Studio for Lenovo® AIO
AksiMata Studio for Lenovo® AIOHendy Irawan
 
Dasar Koperasi Kredit (Credit Union)
Dasar Koperasi Kredit (Credit Union)Dasar Koperasi Kredit (Credit Union)
Dasar Koperasi Kredit (Credit Union)Hendy Irawan
 
Search Engine Marketing (SEM)
Search Engine Marketing (SEM)Search Engine Marketing (SEM)
Search Engine Marketing (SEM)Hendy Irawan
 

More from Hendy Irawan (18)

Apa yang dapat Anda raih dengan Besut Kode Universitas
Apa yang dapat Anda raih dengan Besut Kode UniversitasApa yang dapat Anda raih dengan Besut Kode Universitas
Apa yang dapat Anda raih dengan Besut Kode Universitas
 
Persiapan Google Summer of Code (GSoC)
Persiapan Google Summer of Code (GSoC)Persiapan Google Summer of Code (GSoC)
Persiapan Google Summer of Code (GSoC)
 
Tutorial JSON-LD dan RabbitMQ di Java
Tutorial JSON-LD dan RabbitMQ di JavaTutorial JSON-LD dan RabbitMQ di Java
Tutorial JSON-LD dan RabbitMQ di Java
 
EBA Internship Program 2015-2016
EBA Internship Program 2015-2016EBA Internship Program 2015-2016
EBA Internship Program 2015-2016
 
Big Data innovation in Japan’s energy industry - EBA Fieldwork 2015
Big Data innovation in Japan’s energy industry - EBA Fieldwork 2015Big Data innovation in Japan’s energy industry - EBA Fieldwork 2015
Big Data innovation in Japan’s energy industry - EBA Fieldwork 2015
 
EBA (Evidence-Based Approach) Culture
EBA (Evidence-Based Approach) CultureEBA (Evidence-Based Approach) Culture
EBA (Evidence-Based Approach) Culture
 
Peraturan Walikota (Perwal) PPDB Kota Bandung Tahun 2015
Peraturan Walikota (Perwal) PPDB Kota Bandung Tahun 2015Peraturan Walikota (Perwal) PPDB Kota Bandung Tahun 2015
Peraturan Walikota (Perwal) PPDB Kota Bandung Tahun 2015
 
Sosialisasi Petunjuk Teknis Penerimaan Peserta Didik Baru (PPDB) Kota Bandung...
Sosialisasi Petunjuk Teknis Penerimaan Peserta Didik Baru (PPDB) Kota Bandung...Sosialisasi Petunjuk Teknis Penerimaan Peserta Didik Baru (PPDB) Kota Bandung...
Sosialisasi Petunjuk Teknis Penerimaan Peserta Didik Baru (PPDB) Kota Bandung...
 
Twitter Author Prediction from Tweets using Bayesian Network
Twitter Author Prediction from Tweets using Bayesian NetworkTwitter Author Prediction from Tweets using Bayesian Network
Twitter Author Prediction from Tweets using Bayesian Network
 
Biased Media - Game Theory (EL5000) Course Project
Biased Media - Game Theory (EL5000) Course ProjectBiased Media - Game Theory (EL5000) Course Project
Biased Media - Game Theory (EL5000) Course Project
 
3D Reality Tracking in Realtime - Team Hendy-Sigit
3D Reality Tracking in Realtime - Team Hendy-Sigit3D Reality Tracking in Realtime - Team Hendy-Sigit
3D Reality Tracking in Realtime - Team Hendy-Sigit
 
Pemrograman Logika Induktif (Inductive Logic Programming)
Pemrograman Logika Induktif (Inductive Logic Programming)Pemrograman Logika Induktif (Inductive Logic Programming)
Pemrograman Logika Induktif (Inductive Logic Programming)
 
Inductive Logic Programming
Inductive Logic ProgrammingInductive Logic Programming
Inductive Logic Programming
 
AksiMata Studio Tablet
AksiMata Studio TabletAksiMata Studio Tablet
AksiMata Studio Tablet
 
AksiMata Studio for Lenovo® AIO
AksiMata Studio for Lenovo® AIOAksiMata Studio for Lenovo® AIO
AksiMata Studio for Lenovo® AIO
 
AksiMata Studio
AksiMata StudioAksiMata Studio
AksiMata Studio
 
Dasar Koperasi Kredit (Credit Union)
Dasar Koperasi Kredit (Credit Union)Dasar Koperasi Kredit (Credit Union)
Dasar Koperasi Kredit (Credit Union)
 
Search Engine Marketing (SEM)
Search Engine Marketing (SEM)Search Engine Marketing (SEM)
Search Engine Marketing (SEM)
 

Recently uploaded

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Recently uploaded (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

How to Develop a Basic Magento Extension Tutorial

  • 1. Tutorial: How to Develop A Basic Magento Extension How to create your own blocks and templates in  Magento Commerce using Extensions. Hendy Irawan @hendyirawan ­ magentoadmin.blogspot.com CTO, Bippo
  • 3. Project Folder Structure (design & skin)
  • 4. Filename Mapping Conventions  code/{Company}/{Module} -> app/code/community/{Company}/{Module}  design/frontend/base/default/... -> app/design/frontend/base/default/...  skin/frontend/base/default/... -> skin/frontend/base/default/...  {Company}_{Module}.xml -> app/etc/modules/{Company}_{Module}.xml
  • 5. Creating a Basic Block + Template
  • 6. Module etc/config.xml (Basic) <?xml version="1.0" encoding="UTF-8"?> <config> <modules> <Bippo_Twitter> <version>1.0.0</version> </Bippo_Twitter> </modules> </config> code/Bippo/Twitter/etc/config.xml
  • 7. Block & Helper config.xml <config> ... <global> <models/> <blocks> <bippotwitter > <class>Bippo_Twitter_Block </class> </bippotwitter > </blocks> <helpers> <bippotwitter > <class>Bippo_Twitter_Helper </class> </bippotwitter > </helpers> </global> </config> code/Bippo/Twitter/etc/config.xml
  • 8. Helper class <?php class Bippo_Twitter_Helper_Data extends Mage_Core_Helper_Abstract { } code/Bippo/Twitter/Helper/Data.php
  • 9. Block Class Skeleton <?php /** * Twitter Profile Stream. * * @category Bippo * @package Bippo_Twitter * @author Rully Lukman <rully@bippo.co.id> */ class Bippo_Twitter_Block_Profilestream extends Mage_Core_Block_Template { } code/Bippo/Twitter/Block/Profilestream.php
  • 10. Block Class Implementation class Bippo_Twitter_Block_Profilestream extends Mage_Core_Block_Template { public function __construct() { parent::__construct(); // template $this->setTemplate('bippotwitter/twitter-box.phtml'); } } code/Bippo/Twitter/Block/Profilestream.php
  • 11. Template File <div class="twitterbox"> <script src="http://widgets.twimg.com/j/2/widget.js"></script> <script> new TWTR.Widget({ version: 2, type: 'profile', ... } }).render().setUser('bippoindonesia').start(); </script> </div> design/frontend/base/default/ template/bippotwitter/twitter-box .phtml
  • 12. How to Use Usage in CMS Content Editor {{block type="bippotwitter/profilestream"}} Usage in CMS Design tab / Layout XML <reference name="content"> <block type="bippotwitter/profilestream" name="twitterbox1"/> </reference>
  • 13. Making the Block Configurable
  • 14. Adding Properties private $twitterUsername ; public function __construct() { parent::__construct(); // property default values $this->twitterUsername = 'bippoindonesia'; // template $this->setTemplate('bippotwitter/twitter-box.phtml'); } public function getTwitterUsername () { return $this->twitterUsername ; } public function setTwitterUsername($twitterUsername) { $this->twitterUsername = $twitterUsername ; } code/Bippo/Twitter/Block/Profilestream.php
  • 15. Using Properties <div class="twitterbox"> <script src="http://widgets.twimg.com/j/2/widget.js"></script> <script> new TWTR.Widget({ version: 2, type: 'profile', ... } }).render() .setUser('<?php echo $this->getTwitterUsername() ?> ') .start(); </script> </div> design/frontend/base/default/ template/bippotwitter/twitter-box .phtml
  • 16. Usage in CMS Content {{block type="bippotwitter/profilestream" twitterUsername="hendyirawan"}}
  • 17. Usage in CMS Design tab / Layout XML <reference name="content"> <block type="bippotwitter/profilestream" name="twitterbox2"> <action method="setTwitterUsername"> <twitterUsername> soluvas </twitterUsername> </action> </block> </reference>
  • 18. Supporting Admin Panel > System > Configuration
  • 20. Adminhtml Input Fields <?xml version="1.0"?> <!-- /** * Bippo Twitter * * @category Bippo * @package Bippo_Twitter * @copyright Copyright (c) 2011 Bippo.co.id */ --> <config> <tabs> <bippo> <label>Bippo</label> <sort_order>196</sort_order> </bippo> </tabs> ... code/Bippo/Twitter/etc/system.xml
  • 21. Tabs in Configuration Page <?xml version="1.0"?> <!-- /** * Bippo Twitter * * @category Bippo * @package Bippo_Twitter * @copyright Copyright (c) 2011 Bippo.co.id */ --> <config> <tabs> <bippo> <label>Bippo</label> <sort_order>196</sort_order> </bippo> </tabs> ... code/Bippo/Twitter/etc/system.xml
  • 22. Sections <config> ... <sections> <bippotwitter translate="title" module="bippotwitter"> <label>Twitter</label> <tab>bippo</tab> <frontend_type>text</frontend_type> <sort_order>73</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <groups> ... code/Bippo/Twitter/etc/system.xml
  • 23. Groups <config> ... <sections> <bippotwitter translate="title" module="bippotwitter"> ... <groups> <general translate="label"> <label>General</label> <sort_order>100</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <fields> ... code/Bippo/Twitter/etc/system.xml
  • 24. Fields <config> ... <sections> <bippotwitter ...> ... <groups> <general ...> ... <fields> <custom_twitter_id translate="label"> <label>Twitter ID</label> <comment><![CDATA[Twitter username]]></comment> <frontend_type>text</frontend_type> <sort_order>20</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </custom_twitter_id> <number_of_tweets translate="label"> ... code/Bippo/Twitter/etc/system.xml
  • 25. Access Control <?xml version="1.0"?> <config> <acl> <resources> <admin> <children> <system> <children> <config> <children> <bippotwitter translate="title" module="bippotwitter"> <title>Twitter</title> </bippotwitter> </children> </config> </children> </system> </children> </admin> </resources> </acl> </config> code/Bippo/Twitter/etc/adminhtml.xml
  • 26. Default Configuration Values <config> ... <default> <bippotwitter > <general> <custom_twitter_id >bippoindonesia</custom_twitter_id > <number_of_tweets >5</number_of_tweets> <live>1</live> </general> </bippotwitter > </default> ... </config> code/Bippo/Twitter/etc/config.xml
  • 27. Need More Resources?  Magento eCommerce Development Blog magentoadmin.blogspot.com  Follow @hendyirawan on Twitter  Follow ceefour on Slideshare www.slideshare.net/ceefour Hendy Irawan