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

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

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