How to write a custom extension?












125














Because I had a lot of issues lately with free and commercial extension I've decided to ask this question and answer it with the steps I usually follow when writing an extension. Feel free to edit the answer or add a new one.

In most of the cases when installing an extension or a theme I have to spend a few hours (sometimes more, sometimes less) to make it work on all the environments I need:




  • dev: usually localhost where the project is in a subfolder

  • preprod & live


This has happened even with extensions from large extension providers (that should remain nameless at least until I get really really mad and add their names in here)
So the main question is..what steps should I consider when writing an extension to ensure the quality of the code and make it easier for a technical and non-technical person to use it and for a technical person to change it?










share|improve this question




















  • 11




    It seems that one of the large extension providers didn't like this question and downvoted it. :)
    – Marius
    May 14 '15 at 7:03








  • 1




    Personally, absolutly no prob with Wyomind, but they encrypt their code and are still "premium partners" :( (just for example)
    – sv3n
    Sep 7 '18 at 21:11
















125














Because I had a lot of issues lately with free and commercial extension I've decided to ask this question and answer it with the steps I usually follow when writing an extension. Feel free to edit the answer or add a new one.

In most of the cases when installing an extension or a theme I have to spend a few hours (sometimes more, sometimes less) to make it work on all the environments I need:




  • dev: usually localhost where the project is in a subfolder

  • preprod & live


This has happened even with extensions from large extension providers (that should remain nameless at least until I get really really mad and add their names in here)
So the main question is..what steps should I consider when writing an extension to ensure the quality of the code and make it easier for a technical and non-technical person to use it and for a technical person to change it?










share|improve this question




















  • 11




    It seems that one of the large extension providers didn't like this question and downvoted it. :)
    – Marius
    May 14 '15 at 7:03








  • 1




    Personally, absolutly no prob with Wyomind, but they encrypt their code and are still "premium partners" :( (just for example)
    – sv3n
    Sep 7 '18 at 21:11














125












125








125


77





Because I had a lot of issues lately with free and commercial extension I've decided to ask this question and answer it with the steps I usually follow when writing an extension. Feel free to edit the answer or add a new one.

In most of the cases when installing an extension or a theme I have to spend a few hours (sometimes more, sometimes less) to make it work on all the environments I need:




  • dev: usually localhost where the project is in a subfolder

  • preprod & live


This has happened even with extensions from large extension providers (that should remain nameless at least until I get really really mad and add their names in here)
So the main question is..what steps should I consider when writing an extension to ensure the quality of the code and make it easier for a technical and non-technical person to use it and for a technical person to change it?










share|improve this question















Because I had a lot of issues lately with free and commercial extension I've decided to ask this question and answer it with the steps I usually follow when writing an extension. Feel free to edit the answer or add a new one.

In most of the cases when installing an extension or a theme I have to spend a few hours (sometimes more, sometimes less) to make it work on all the environments I need:




  • dev: usually localhost where the project is in a subfolder

  • preprod & live


This has happened even with extensions from large extension providers (that should remain nameless at least until I get really really mad and add their names in here)
So the main question is..what steps should I consider when writing an extension to ensure the quality of the code and make it easier for a technical and non-technical person to use it and for a technical person to change it?







module magento-1 extensions best-practice development






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 18 hours ago

























asked Sep 23 '13 at 9:15









Marius

163k28311658




163k28311658








  • 11




    It seems that one of the large extension providers didn't like this question and downvoted it. :)
    – Marius
    May 14 '15 at 7:03








  • 1




    Personally, absolutly no prob with Wyomind, but they encrypt their code and are still "premium partners" :( (just for example)
    – sv3n
    Sep 7 '18 at 21:11














  • 11




    It seems that one of the large extension providers didn't like this question and downvoted it. :)
    – Marius
    May 14 '15 at 7:03








  • 1




    Personally, absolutly no prob with Wyomind, but they encrypt their code and are still "premium partners" :( (just for example)
    – sv3n
    Sep 7 '18 at 21:11








11




11




It seems that one of the large extension providers didn't like this question and downvoted it. :)
– Marius
May 14 '15 at 7:03






It seems that one of the large extension providers didn't like this question and downvoted it. :)
– Marius
May 14 '15 at 7:03






1




1




Personally, absolutly no prob with Wyomind, but they encrypt their code and are still "premium partners" :( (just for example)
– sv3n
Sep 7 '18 at 21:11




Personally, absolutly no prob with Wyomind, but they encrypt their code and are still "premium partners" :( (just for example)
– sv3n
Sep 7 '18 at 21:11










5 Answers
5






active

oldest

votes


















170





+100









Here is what I usually do:




  1. Always develop with error_reporting on.

  2. Always develop with isDeveloperMode set to true. Just add SetEnv MAGE_IS_DEVELOPER_MODE 1 to your httpd.conf file (or corresponding file for Nginx or something else)

  3. If the extension is linked to a core functionality add the
    dependency in the declaration file <depends><Mage_Catalog /></depend>

  4. If the module is for community use, use community as codepool to
    give the developers the chance to override some classes without
    modifying the code directly

  5. Put your frontend design files in app/design/frontend/base/default
    to make them available for all themes.

  6. Put your admin design files in
    app/design/adminhtml/default/default and do not change the admin
    theme. I may want to change it in one of my modules.

  7. Prefix your layout file names and template folder name with the
    company name to make it easier to isolate them.
    easylife_articles.xml and app/design/.../easylife_articles

  8. Put your static resources (JavaScript, CSS, and images) in a similar folder as
    the template files easylife_articles/images/doh.png

  9. Attach a simple text file with how to uninstall the extension: What
    files need to be removed, what tables need to be dropped, what
    config settings need to be removed from core_config_data table.

  10. Do not write queries directly in models, blocks or helpers, use a
    resource model for that.

  11. Do not write queries using the table names directly Select * from
    sales_flat_order where ...
    . Use a Zend_Select and transform the
    table names using ->getTable('sales/order').

  12. Use the base url to include js files in template. Wrong
    <script type="text/javascript" src="../js/some.js"></script>.
    Right <script type="text/javascript" src="<?php echo Mage::getBaseUrl('js').'some.js'?>"></script>

  13. Do not rewrite classes unless is necessary. Use observers and if
    it's not possible to use helper methods that receive as parameter and
    instance of a class that you wanted to override. Wrong:
    Override Mage_Catalog_Model_Product to add the method
    getProductArticles(). Right. In your helper add
    getProductArticles(Mage_Catalog_Model_Product $product)

  14. If you override classes put a list of them in a readme.txt file

  15. Use the default admin path for the admin section of your module.
    Wrong admin URL articles/adminhtml_articles/index. Right admin URL admin/articles/index

  16. Add ACL for your admin sections. I may want to restrict access to
    some of the administrators.

  17. Do not add another JavaScript framework (jQuery, MooTools, etc.) if it's not
    necessary. Write you code in the prototype.

  18. Make you template HTML W3C valid (this is for OCD developers like myself).

  19. Do not put images in the media folder. Use skin. The media
    folder usually is not versioned and this makes it harder to move the
    website to different environments.

  20. Test your extension with flat catalog on and off. In order not to double the development time, use Chaos Monkey.

  21. Test your extension with cache on and cache off.

  22. Avoid using uppercase letter in the module and class names. If not
    properly tested this may cause issues on different OS. This is more a recommendation, not a 'must'.

  23. Dispatch events in your code to make it easier for developers to
    alter the functionality.

  24. Follow the same coding standards that Magento uses and comment your code.

  25. Do not use PHP short tags (<? $this->doSomething() ?>). Use full tags (<?php $this->doSomething()?>). Also don't use short echo tags, yet. (<?="D'oh";?>). Use (<?php echo "D'oh";?>)

  26. Translate your texts using $this->__ and add the locale translation file with your texts (app/local/en_US/Easylife_Articles.csv) at least for en_US language. Not all websites are built in English and the identification of texts to translate is time consuming.

  27. If you sell an extension offer at least basic support. Or at least
    answer the support e-mails you receive.

  28. Do not make constant calls to your servers through your extension for licence validation. Once, at installation is more than enough (I don't like this approach either, but it's better than to make calls all the time).
    (Inspired by this question)

  29. Develop with the log activated and from time to time take a look at
    the var/log/system.log file. The errors listed here are not shown
    even with developer mode on. If there is at least one error you end
    up with a large log file after a few months of running the extension.

  30. If your extension affects the checkout process or the orders in
    some way, make sure it works with multi-shipping, or if it
    shouldn't work with multi-shipping, make sure it doesn't affect it.

  31. Do not replace the default Admin Notification bar (or feed URL). If
    I'm interested in what you have to offer I will subscribe to your
    newsletter. Let me see what Magento has to say. It's more important
    to me.

  32. If you encrypt your code files with Ioncube (or something
    else)...well...I just hate you and I hope your business goes bankrupt


That's what have so far. I will add more as soon as I think of something else.






share|improve this answer























  • I agree with you, it's definitely a good start. For sure, you will also understand that it's not always possible to cover all different kind of configuration and issues, at least it will reduce the possible one. Most of problem I meet with other extensions or people meet with mine are due to conflict with overwriting.
    – Sylvain Rayé
    Sep 23 '13 at 9:26






  • 2




    @Marius,sure 1+ from me.it covers most of the cases and scenario what we are facing in development.
    – liyakat
    Sep 23 '13 at 14:23








  • 4




    @ColinM. First of all it's an honor to have your comment here. :). I agree there is a difference, I will modify the answer, but I still think that both of them should be avoided, at least until PHP 5.3 becomes the "new PHP 4". I mean it is still used on a large scale.
    – Marius
    Sep 23 '13 at 16:27






  • 4




    @Marius, your points are very helpful. Till #31 I was seriously focusing on each point, but on #32 I just burst out a loud laugh. +1 specially for point #32
    – MTM
    Aug 24 '14 at 16:30






  • 1




    If you encrypt your code files with Ioncube (or something else)...well...I just hate you and I hope your business goes bankrupt I feel the same. There are some companies that don't offer updated version, you will have to pay for them, it's really frustrating for me and don't understand why they want to sell same product again and again (to make money? obviously). I just don't buy their product anymore. You know whom I talking about.
    – Adarsh Khatri
    Apr 11 '16 at 4:01



















29














I am a big fan of using modman so that I can develop and source control just my extension and leave the core files and folder structure unchanged. It is also makes testing across different installations run smoother.



Oh and one massive tip always try to install your packaged extension locally on a clean install of magento before uploading it to Magento Connect, I have missed out files so many times in the package manager.






share|improve this answer

















  • 3




    Good call about the 'install your packaged extension locally'. I think this falls in the category: 'Test your god damn extension top to bottom'.
    – Marius
    Sep 23 '13 at 14:01










  • I've been caught out by this before too. Make sure you test the package on a clean install that is not the same one you packaged it on!
    – Joseph Leedy
    Oct 9 '13 at 18:13





















20














Andreas von Studnitz and Dr. Nikolai Krambrock gave a good presentation on code quality on the Meet Magento DE 2014. They distinguish between general code quality and Magento-specific code quality. In short there are following general rules:




  • The use of structure elements - just like classes and methods - should be arranged in middle seizes classes. These elements of structure only make sense when they are used for structuring. Therefore they have to be of medium size. It is regarded to use 100-200 Lines of Code for classes and 3-20 Lines of Code for methods.

  • Because of the use of "if" or "while" the code is indented. If there are more than 3 indentations it is better to revise them. Too many indentations are an evidence for the code's complexity and should therefore be avoided.

  • Dead Code should be avoided and deleted. Static analyses help finding it if one exists.


Even more important are the Magento-specific rules:




  • Modules should work independently. They should only have little dependency on other modules and no dependency on templates. A solution is to use layout-updates (base/default) instead of adaption to template files and a module that covers additional functions of the template.

  • To maintain the ability of updates in Magento core-hacks and hacks of external modules should be avoided. A better way is the use rewriters or observer instead.

  • For changes it is better to use setup scripts instead of direct changes of the database or of the admin. Thanks to them changes have to be done only onetime.


Here are some more details and a video of the presentation:
http://www.code4business.de/code-qualitaet-magento/






share|improve this answer

















  • 1




    Nice and useful information. Thanks for sharing. +1 from me.
    – Marius
    Aug 25 '14 at 8:50






  • 1




    But If you had an english version of the link you posted would be even better.
    – Marius
    Aug 25 '14 at 9:00










  • An English version of this presentation is going to be written soon. I will keep you current and I will share the new link as soon as the English version is published.
    – user3743859
    Aug 25 '14 at 15:08










  • An English version of the presentation is online now. Here is the link to it: code4business.de/code-quality-magento
    – user3743859
    Oct 1 '14 at 6:57










  • huh? It's still in German. But I just happened to attend this presentation in English at MeetMagentRo about 2 weeks ago. Great stuff.
    – Marius
    Oct 1 '14 at 6:59



















16














If you sell your extension or share it with others, think about writing code that is human readable.




  1. don't make method too complex

  2. add DOC blocks to your methods

  3. use proper variable names, like $productIds instead of $ids

  4. same for methods, public function myOnProductSaveMethod() {...} says ... nothing , but tryDisableInternetOnProductSave() will give a hint want's planned

  5. use type hints where it makes sense someMethod(Varien_Data_Db_Collection $collection)

  6. avoid magic numbers and strings *

  7. if you use models set $_eventPrefix property (and $_eventObject) to make them better accessible to observers

  8. if you add system config fields


    • set default values in config.xml

    • add <validate> nodes to fields in system.xml

    • add ACL resources to adminhtml.xml



  9. do not add useless/advertising first-level menu entries in admin backend - neither in topbar nor in config sections

  10. add ACL resources for all controller actions (massactions too!)

  11. ensure your queries work with DB table prefixes

  12. think about (no) backward comptibility (this is really opinion based)


    • do not support Mysql4 classes

    • do not use deprecated methods



  13. ensure your extionsion works as expected in every case - add UnitTests (PhpUnit for example)

  14. in addition to David Manners ... add a composer.json too to make deployment easier




* Often used:




  • admin store ID



    • 0 > Mage_Core_Model_App::ADMIN_STORE_ID



  • product status



    • 1 > Mage_Catalog_Model_Product_Status::STATUS_ENABLED


    • 2 > Mage_Catalog_Model_Product_Status::STATUS_DISABLED (not 0 as maybe expected)



  • product type



    • simple > Mage_Catalog_Model_Product_Type::TYPE_SIMPLE


    • bundle > Mage_Catalog_Model_Product_Type::TYPE_BUNDLE


    • configurable > Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE


    • grouped > Mage_Catalog_Model_Product_Type::TYPE_GROUPED


    • virtual > Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL



  • product visibity



    • 1 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE


    • 2 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG


    • 3 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH


    • 4 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH




Same for SQL order ASC vs Zend_Db_Select::SQL_ASC (for example).



Saying "it's not nessessary cause it will never ever change"? For example entity ID for catalog_product attributes changed somewhere between Magento 1.5 and 1.9 from 10 to 4, so this could break your extension:



$collection->addFieldToFilter('entity_type_id', 10)


Using this instead adds one query, but you'll be safe ...



$entityTypeId = Mage::getModel('eav/config')
->getEntityType(Mage_Catalog_Model_Product::ENTITY)
->getEntityTypeId();

$collection->addFieldToFilter('entity_type_id', $entityTypeId)





share|improve this answer































    6














    @marius, regarding Coding Standards (point 24 in your list).



    I like to use PHP_CodeSniffer along with EQP and ECG CS to automatically enforce these standards.



    Using PHP_CodeSniffer you don't have to worry about forgetting things like replacing array() with , avoid using is_null, leave unused local variables or even a method without PHPDoc block.



    PHP_CodeSniffer will always tell you about it.






    share|improve this answer























    • Agreed! Possible howto: magento.stackexchange.com/questions/178640/…
      – sv3n
      Jul 29 '17 at 21:37










    • I think there is no way to configure both CS in PHPStorm (for those who use PHPStorm) but you can always use the terminal to check the CS in your code. Also there are tools such as grumphp github.com/phpro/grumphp that help a bit.
      – diazwatson
      Jul 30 '17 at 0:29










    • It might be help you magento.stackexchange.com/questions/200022/…
      – Pramod Kharade
      Jan 20 '18 at 17:05













    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f8344%2fhow-to-write-a-custom-extension%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    170





    +100









    Here is what I usually do:




    1. Always develop with error_reporting on.

    2. Always develop with isDeveloperMode set to true. Just add SetEnv MAGE_IS_DEVELOPER_MODE 1 to your httpd.conf file (or corresponding file for Nginx or something else)

    3. If the extension is linked to a core functionality add the
      dependency in the declaration file <depends><Mage_Catalog /></depend>

    4. If the module is for community use, use community as codepool to
      give the developers the chance to override some classes without
      modifying the code directly

    5. Put your frontend design files in app/design/frontend/base/default
      to make them available for all themes.

    6. Put your admin design files in
      app/design/adminhtml/default/default and do not change the admin
      theme. I may want to change it in one of my modules.

    7. Prefix your layout file names and template folder name with the
      company name to make it easier to isolate them.
      easylife_articles.xml and app/design/.../easylife_articles

    8. Put your static resources (JavaScript, CSS, and images) in a similar folder as
      the template files easylife_articles/images/doh.png

    9. Attach a simple text file with how to uninstall the extension: What
      files need to be removed, what tables need to be dropped, what
      config settings need to be removed from core_config_data table.

    10. Do not write queries directly in models, blocks or helpers, use a
      resource model for that.

    11. Do not write queries using the table names directly Select * from
      sales_flat_order where ...
      . Use a Zend_Select and transform the
      table names using ->getTable('sales/order').

    12. Use the base url to include js files in template. Wrong
      <script type="text/javascript" src="../js/some.js"></script>.
      Right <script type="text/javascript" src="<?php echo Mage::getBaseUrl('js').'some.js'?>"></script>

    13. Do not rewrite classes unless is necessary. Use observers and if
      it's not possible to use helper methods that receive as parameter and
      instance of a class that you wanted to override. Wrong:
      Override Mage_Catalog_Model_Product to add the method
      getProductArticles(). Right. In your helper add
      getProductArticles(Mage_Catalog_Model_Product $product)

    14. If you override classes put a list of them in a readme.txt file

    15. Use the default admin path for the admin section of your module.
      Wrong admin URL articles/adminhtml_articles/index. Right admin URL admin/articles/index

    16. Add ACL for your admin sections. I may want to restrict access to
      some of the administrators.

    17. Do not add another JavaScript framework (jQuery, MooTools, etc.) if it's not
      necessary. Write you code in the prototype.

    18. Make you template HTML W3C valid (this is for OCD developers like myself).

    19. Do not put images in the media folder. Use skin. The media
      folder usually is not versioned and this makes it harder to move the
      website to different environments.

    20. Test your extension with flat catalog on and off. In order not to double the development time, use Chaos Monkey.

    21. Test your extension with cache on and cache off.

    22. Avoid using uppercase letter in the module and class names. If not
      properly tested this may cause issues on different OS. This is more a recommendation, not a 'must'.

    23. Dispatch events in your code to make it easier for developers to
      alter the functionality.

    24. Follow the same coding standards that Magento uses and comment your code.

    25. Do not use PHP short tags (<? $this->doSomething() ?>). Use full tags (<?php $this->doSomething()?>). Also don't use short echo tags, yet. (<?="D'oh";?>). Use (<?php echo "D'oh";?>)

    26. Translate your texts using $this->__ and add the locale translation file with your texts (app/local/en_US/Easylife_Articles.csv) at least for en_US language. Not all websites are built in English and the identification of texts to translate is time consuming.

    27. If you sell an extension offer at least basic support. Or at least
      answer the support e-mails you receive.

    28. Do not make constant calls to your servers through your extension for licence validation. Once, at installation is more than enough (I don't like this approach either, but it's better than to make calls all the time).
      (Inspired by this question)

    29. Develop with the log activated and from time to time take a look at
      the var/log/system.log file. The errors listed here are not shown
      even with developer mode on. If there is at least one error you end
      up with a large log file after a few months of running the extension.

    30. If your extension affects the checkout process or the orders in
      some way, make sure it works with multi-shipping, or if it
      shouldn't work with multi-shipping, make sure it doesn't affect it.

    31. Do not replace the default Admin Notification bar (or feed URL). If
      I'm interested in what you have to offer I will subscribe to your
      newsletter. Let me see what Magento has to say. It's more important
      to me.

    32. If you encrypt your code files with Ioncube (or something
      else)...well...I just hate you and I hope your business goes bankrupt


    That's what have so far. I will add more as soon as I think of something else.






    share|improve this answer























    • I agree with you, it's definitely a good start. For sure, you will also understand that it's not always possible to cover all different kind of configuration and issues, at least it will reduce the possible one. Most of problem I meet with other extensions or people meet with mine are due to conflict with overwriting.
      – Sylvain Rayé
      Sep 23 '13 at 9:26






    • 2




      @Marius,sure 1+ from me.it covers most of the cases and scenario what we are facing in development.
      – liyakat
      Sep 23 '13 at 14:23








    • 4




      @ColinM. First of all it's an honor to have your comment here. :). I agree there is a difference, I will modify the answer, but I still think that both of them should be avoided, at least until PHP 5.3 becomes the "new PHP 4". I mean it is still used on a large scale.
      – Marius
      Sep 23 '13 at 16:27






    • 4




      @Marius, your points are very helpful. Till #31 I was seriously focusing on each point, but on #32 I just burst out a loud laugh. +1 specially for point #32
      – MTM
      Aug 24 '14 at 16:30






    • 1




      If you encrypt your code files with Ioncube (or something else)...well...I just hate you and I hope your business goes bankrupt I feel the same. There are some companies that don't offer updated version, you will have to pay for them, it's really frustrating for me and don't understand why they want to sell same product again and again (to make money? obviously). I just don't buy their product anymore. You know whom I talking about.
      – Adarsh Khatri
      Apr 11 '16 at 4:01
















    170





    +100









    Here is what I usually do:




    1. Always develop with error_reporting on.

    2. Always develop with isDeveloperMode set to true. Just add SetEnv MAGE_IS_DEVELOPER_MODE 1 to your httpd.conf file (or corresponding file for Nginx or something else)

    3. If the extension is linked to a core functionality add the
      dependency in the declaration file <depends><Mage_Catalog /></depend>

    4. If the module is for community use, use community as codepool to
      give the developers the chance to override some classes without
      modifying the code directly

    5. Put your frontend design files in app/design/frontend/base/default
      to make them available for all themes.

    6. Put your admin design files in
      app/design/adminhtml/default/default and do not change the admin
      theme. I may want to change it in one of my modules.

    7. Prefix your layout file names and template folder name with the
      company name to make it easier to isolate them.
      easylife_articles.xml and app/design/.../easylife_articles

    8. Put your static resources (JavaScript, CSS, and images) in a similar folder as
      the template files easylife_articles/images/doh.png

    9. Attach a simple text file with how to uninstall the extension: What
      files need to be removed, what tables need to be dropped, what
      config settings need to be removed from core_config_data table.

    10. Do not write queries directly in models, blocks or helpers, use a
      resource model for that.

    11. Do not write queries using the table names directly Select * from
      sales_flat_order where ...
      . Use a Zend_Select and transform the
      table names using ->getTable('sales/order').

    12. Use the base url to include js files in template. Wrong
      <script type="text/javascript" src="../js/some.js"></script>.
      Right <script type="text/javascript" src="<?php echo Mage::getBaseUrl('js').'some.js'?>"></script>

    13. Do not rewrite classes unless is necessary. Use observers and if
      it's not possible to use helper methods that receive as parameter and
      instance of a class that you wanted to override. Wrong:
      Override Mage_Catalog_Model_Product to add the method
      getProductArticles(). Right. In your helper add
      getProductArticles(Mage_Catalog_Model_Product $product)

    14. If you override classes put a list of them in a readme.txt file

    15. Use the default admin path for the admin section of your module.
      Wrong admin URL articles/adminhtml_articles/index. Right admin URL admin/articles/index

    16. Add ACL for your admin sections. I may want to restrict access to
      some of the administrators.

    17. Do not add another JavaScript framework (jQuery, MooTools, etc.) if it's not
      necessary. Write you code in the prototype.

    18. Make you template HTML W3C valid (this is for OCD developers like myself).

    19. Do not put images in the media folder. Use skin. The media
      folder usually is not versioned and this makes it harder to move the
      website to different environments.

    20. Test your extension with flat catalog on and off. In order not to double the development time, use Chaos Monkey.

    21. Test your extension with cache on and cache off.

    22. Avoid using uppercase letter in the module and class names. If not
      properly tested this may cause issues on different OS. This is more a recommendation, not a 'must'.

    23. Dispatch events in your code to make it easier for developers to
      alter the functionality.

    24. Follow the same coding standards that Magento uses and comment your code.

    25. Do not use PHP short tags (<? $this->doSomething() ?>). Use full tags (<?php $this->doSomething()?>). Also don't use short echo tags, yet. (<?="D'oh";?>). Use (<?php echo "D'oh";?>)

    26. Translate your texts using $this->__ and add the locale translation file with your texts (app/local/en_US/Easylife_Articles.csv) at least for en_US language. Not all websites are built in English and the identification of texts to translate is time consuming.

    27. If you sell an extension offer at least basic support. Or at least
      answer the support e-mails you receive.

    28. Do not make constant calls to your servers through your extension for licence validation. Once, at installation is more than enough (I don't like this approach either, but it's better than to make calls all the time).
      (Inspired by this question)

    29. Develop with the log activated and from time to time take a look at
      the var/log/system.log file. The errors listed here are not shown
      even with developer mode on. If there is at least one error you end
      up with a large log file after a few months of running the extension.

    30. If your extension affects the checkout process or the orders in
      some way, make sure it works with multi-shipping, or if it
      shouldn't work with multi-shipping, make sure it doesn't affect it.

    31. Do not replace the default Admin Notification bar (or feed URL). If
      I'm interested in what you have to offer I will subscribe to your
      newsletter. Let me see what Magento has to say. It's more important
      to me.

    32. If you encrypt your code files with Ioncube (or something
      else)...well...I just hate you and I hope your business goes bankrupt


    That's what have so far. I will add more as soon as I think of something else.






    share|improve this answer























    • I agree with you, it's definitely a good start. For sure, you will also understand that it's not always possible to cover all different kind of configuration and issues, at least it will reduce the possible one. Most of problem I meet with other extensions or people meet with mine are due to conflict with overwriting.
      – Sylvain Rayé
      Sep 23 '13 at 9:26






    • 2




      @Marius,sure 1+ from me.it covers most of the cases and scenario what we are facing in development.
      – liyakat
      Sep 23 '13 at 14:23








    • 4




      @ColinM. First of all it's an honor to have your comment here. :). I agree there is a difference, I will modify the answer, but I still think that both of them should be avoided, at least until PHP 5.3 becomes the "new PHP 4". I mean it is still used on a large scale.
      – Marius
      Sep 23 '13 at 16:27






    • 4




      @Marius, your points are very helpful. Till #31 I was seriously focusing on each point, but on #32 I just burst out a loud laugh. +1 specially for point #32
      – MTM
      Aug 24 '14 at 16:30






    • 1




      If you encrypt your code files with Ioncube (or something else)...well...I just hate you and I hope your business goes bankrupt I feel the same. There are some companies that don't offer updated version, you will have to pay for them, it's really frustrating for me and don't understand why they want to sell same product again and again (to make money? obviously). I just don't buy their product anymore. You know whom I talking about.
      – Adarsh Khatri
      Apr 11 '16 at 4:01














    170





    +100







    170





    +100



    170




    +100




    Here is what I usually do:




    1. Always develop with error_reporting on.

    2. Always develop with isDeveloperMode set to true. Just add SetEnv MAGE_IS_DEVELOPER_MODE 1 to your httpd.conf file (or corresponding file for Nginx or something else)

    3. If the extension is linked to a core functionality add the
      dependency in the declaration file <depends><Mage_Catalog /></depend>

    4. If the module is for community use, use community as codepool to
      give the developers the chance to override some classes without
      modifying the code directly

    5. Put your frontend design files in app/design/frontend/base/default
      to make them available for all themes.

    6. Put your admin design files in
      app/design/adminhtml/default/default and do not change the admin
      theme. I may want to change it in one of my modules.

    7. Prefix your layout file names and template folder name with the
      company name to make it easier to isolate them.
      easylife_articles.xml and app/design/.../easylife_articles

    8. Put your static resources (JavaScript, CSS, and images) in a similar folder as
      the template files easylife_articles/images/doh.png

    9. Attach a simple text file with how to uninstall the extension: What
      files need to be removed, what tables need to be dropped, what
      config settings need to be removed from core_config_data table.

    10. Do not write queries directly in models, blocks or helpers, use a
      resource model for that.

    11. Do not write queries using the table names directly Select * from
      sales_flat_order where ...
      . Use a Zend_Select and transform the
      table names using ->getTable('sales/order').

    12. Use the base url to include js files in template. Wrong
      <script type="text/javascript" src="../js/some.js"></script>.
      Right <script type="text/javascript" src="<?php echo Mage::getBaseUrl('js').'some.js'?>"></script>

    13. Do not rewrite classes unless is necessary. Use observers and if
      it's not possible to use helper methods that receive as parameter and
      instance of a class that you wanted to override. Wrong:
      Override Mage_Catalog_Model_Product to add the method
      getProductArticles(). Right. In your helper add
      getProductArticles(Mage_Catalog_Model_Product $product)

    14. If you override classes put a list of them in a readme.txt file

    15. Use the default admin path for the admin section of your module.
      Wrong admin URL articles/adminhtml_articles/index. Right admin URL admin/articles/index

    16. Add ACL for your admin sections. I may want to restrict access to
      some of the administrators.

    17. Do not add another JavaScript framework (jQuery, MooTools, etc.) if it's not
      necessary. Write you code in the prototype.

    18. Make you template HTML W3C valid (this is for OCD developers like myself).

    19. Do not put images in the media folder. Use skin. The media
      folder usually is not versioned and this makes it harder to move the
      website to different environments.

    20. Test your extension with flat catalog on and off. In order not to double the development time, use Chaos Monkey.

    21. Test your extension with cache on and cache off.

    22. Avoid using uppercase letter in the module and class names. If not
      properly tested this may cause issues on different OS. This is more a recommendation, not a 'must'.

    23. Dispatch events in your code to make it easier for developers to
      alter the functionality.

    24. Follow the same coding standards that Magento uses and comment your code.

    25. Do not use PHP short tags (<? $this->doSomething() ?>). Use full tags (<?php $this->doSomething()?>). Also don't use short echo tags, yet. (<?="D'oh";?>). Use (<?php echo "D'oh";?>)

    26. Translate your texts using $this->__ and add the locale translation file with your texts (app/local/en_US/Easylife_Articles.csv) at least for en_US language. Not all websites are built in English and the identification of texts to translate is time consuming.

    27. If you sell an extension offer at least basic support. Or at least
      answer the support e-mails you receive.

    28. Do not make constant calls to your servers through your extension for licence validation. Once, at installation is more than enough (I don't like this approach either, but it's better than to make calls all the time).
      (Inspired by this question)

    29. Develop with the log activated and from time to time take a look at
      the var/log/system.log file. The errors listed here are not shown
      even with developer mode on. If there is at least one error you end
      up with a large log file after a few months of running the extension.

    30. If your extension affects the checkout process or the orders in
      some way, make sure it works with multi-shipping, or if it
      shouldn't work with multi-shipping, make sure it doesn't affect it.

    31. Do not replace the default Admin Notification bar (or feed URL). If
      I'm interested in what you have to offer I will subscribe to your
      newsletter. Let me see what Magento has to say. It's more important
      to me.

    32. If you encrypt your code files with Ioncube (or something
      else)...well...I just hate you and I hope your business goes bankrupt


    That's what have so far. I will add more as soon as I think of something else.






    share|improve this answer














    Here is what I usually do:




    1. Always develop with error_reporting on.

    2. Always develop with isDeveloperMode set to true. Just add SetEnv MAGE_IS_DEVELOPER_MODE 1 to your httpd.conf file (or corresponding file for Nginx or something else)

    3. If the extension is linked to a core functionality add the
      dependency in the declaration file <depends><Mage_Catalog /></depend>

    4. If the module is for community use, use community as codepool to
      give the developers the chance to override some classes without
      modifying the code directly

    5. Put your frontend design files in app/design/frontend/base/default
      to make them available for all themes.

    6. Put your admin design files in
      app/design/adminhtml/default/default and do not change the admin
      theme. I may want to change it in one of my modules.

    7. Prefix your layout file names and template folder name with the
      company name to make it easier to isolate them.
      easylife_articles.xml and app/design/.../easylife_articles

    8. Put your static resources (JavaScript, CSS, and images) in a similar folder as
      the template files easylife_articles/images/doh.png

    9. Attach a simple text file with how to uninstall the extension: What
      files need to be removed, what tables need to be dropped, what
      config settings need to be removed from core_config_data table.

    10. Do not write queries directly in models, blocks or helpers, use a
      resource model for that.

    11. Do not write queries using the table names directly Select * from
      sales_flat_order where ...
      . Use a Zend_Select and transform the
      table names using ->getTable('sales/order').

    12. Use the base url to include js files in template. Wrong
      <script type="text/javascript" src="../js/some.js"></script>.
      Right <script type="text/javascript" src="<?php echo Mage::getBaseUrl('js').'some.js'?>"></script>

    13. Do not rewrite classes unless is necessary. Use observers and if
      it's not possible to use helper methods that receive as parameter and
      instance of a class that you wanted to override. Wrong:
      Override Mage_Catalog_Model_Product to add the method
      getProductArticles(). Right. In your helper add
      getProductArticles(Mage_Catalog_Model_Product $product)

    14. If you override classes put a list of them in a readme.txt file

    15. Use the default admin path for the admin section of your module.
      Wrong admin URL articles/adminhtml_articles/index. Right admin URL admin/articles/index

    16. Add ACL for your admin sections. I may want to restrict access to
      some of the administrators.

    17. Do not add another JavaScript framework (jQuery, MooTools, etc.) if it's not
      necessary. Write you code in the prototype.

    18. Make you template HTML W3C valid (this is for OCD developers like myself).

    19. Do not put images in the media folder. Use skin. The media
      folder usually is not versioned and this makes it harder to move the
      website to different environments.

    20. Test your extension with flat catalog on and off. In order not to double the development time, use Chaos Monkey.

    21. Test your extension with cache on and cache off.

    22. Avoid using uppercase letter in the module and class names. If not
      properly tested this may cause issues on different OS. This is more a recommendation, not a 'must'.

    23. Dispatch events in your code to make it easier for developers to
      alter the functionality.

    24. Follow the same coding standards that Magento uses and comment your code.

    25. Do not use PHP short tags (<? $this->doSomething() ?>). Use full tags (<?php $this->doSomething()?>). Also don't use short echo tags, yet. (<?="D'oh";?>). Use (<?php echo "D'oh";?>)

    26. Translate your texts using $this->__ and add the locale translation file with your texts (app/local/en_US/Easylife_Articles.csv) at least for en_US language. Not all websites are built in English and the identification of texts to translate is time consuming.

    27. If you sell an extension offer at least basic support. Or at least
      answer the support e-mails you receive.

    28. Do not make constant calls to your servers through your extension for licence validation. Once, at installation is more than enough (I don't like this approach either, but it's better than to make calls all the time).
      (Inspired by this question)

    29. Develop with the log activated and from time to time take a look at
      the var/log/system.log file. The errors listed here are not shown
      even with developer mode on. If there is at least one error you end
      up with a large log file after a few months of running the extension.

    30. If your extension affects the checkout process or the orders in
      some way, make sure it works with multi-shipping, or if it
      shouldn't work with multi-shipping, make sure it doesn't affect it.

    31. Do not replace the default Admin Notification bar (or feed URL). If
      I'm interested in what you have to offer I will subscribe to your
      newsletter. Let me see what Magento has to say. It's more important
      to me.

    32. If you encrypt your code files with Ioncube (or something
      else)...well...I just hate you and I hope your business goes bankrupt


    That's what have so far. I will add more as soon as I think of something else.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Oct 19 '18 at 18:41


























    community wiki





    20 revs, 7 users 87%
    Marius













    • I agree with you, it's definitely a good start. For sure, you will also understand that it's not always possible to cover all different kind of configuration and issues, at least it will reduce the possible one. Most of problem I meet with other extensions or people meet with mine are due to conflict with overwriting.
      – Sylvain Rayé
      Sep 23 '13 at 9:26






    • 2




      @Marius,sure 1+ from me.it covers most of the cases and scenario what we are facing in development.
      – liyakat
      Sep 23 '13 at 14:23








    • 4




      @ColinM. First of all it's an honor to have your comment here. :). I agree there is a difference, I will modify the answer, but I still think that both of them should be avoided, at least until PHP 5.3 becomes the "new PHP 4". I mean it is still used on a large scale.
      – Marius
      Sep 23 '13 at 16:27






    • 4




      @Marius, your points are very helpful. Till #31 I was seriously focusing on each point, but on #32 I just burst out a loud laugh. +1 specially for point #32
      – MTM
      Aug 24 '14 at 16:30






    • 1




      If you encrypt your code files with Ioncube (or something else)...well...I just hate you and I hope your business goes bankrupt I feel the same. There are some companies that don't offer updated version, you will have to pay for them, it's really frustrating for me and don't understand why they want to sell same product again and again (to make money? obviously). I just don't buy their product anymore. You know whom I talking about.
      – Adarsh Khatri
      Apr 11 '16 at 4:01


















    • I agree with you, it's definitely a good start. For sure, you will also understand that it's not always possible to cover all different kind of configuration and issues, at least it will reduce the possible one. Most of problem I meet with other extensions or people meet with mine are due to conflict with overwriting.
      – Sylvain Rayé
      Sep 23 '13 at 9:26






    • 2




      @Marius,sure 1+ from me.it covers most of the cases and scenario what we are facing in development.
      – liyakat
      Sep 23 '13 at 14:23








    • 4




      @ColinM. First of all it's an honor to have your comment here. :). I agree there is a difference, I will modify the answer, but I still think that both of them should be avoided, at least until PHP 5.3 becomes the "new PHP 4". I mean it is still used on a large scale.
      – Marius
      Sep 23 '13 at 16:27






    • 4




      @Marius, your points are very helpful. Till #31 I was seriously focusing on each point, but on #32 I just burst out a loud laugh. +1 specially for point #32
      – MTM
      Aug 24 '14 at 16:30






    • 1




      If you encrypt your code files with Ioncube (or something else)...well...I just hate you and I hope your business goes bankrupt I feel the same. There are some companies that don't offer updated version, you will have to pay for them, it's really frustrating for me and don't understand why they want to sell same product again and again (to make money? obviously). I just don't buy their product anymore. You know whom I talking about.
      – Adarsh Khatri
      Apr 11 '16 at 4:01
















    I agree with you, it's definitely a good start. For sure, you will also understand that it's not always possible to cover all different kind of configuration and issues, at least it will reduce the possible one. Most of problem I meet with other extensions or people meet with mine are due to conflict with overwriting.
    – Sylvain Rayé
    Sep 23 '13 at 9:26




    I agree with you, it's definitely a good start. For sure, you will also understand that it's not always possible to cover all different kind of configuration and issues, at least it will reduce the possible one. Most of problem I meet with other extensions or people meet with mine are due to conflict with overwriting.
    – Sylvain Rayé
    Sep 23 '13 at 9:26




    2




    2




    @Marius,sure 1+ from me.it covers most of the cases and scenario what we are facing in development.
    – liyakat
    Sep 23 '13 at 14:23






    @Marius,sure 1+ from me.it covers most of the cases and scenario what we are facing in development.
    – liyakat
    Sep 23 '13 at 14:23






    4




    4




    @ColinM. First of all it's an honor to have your comment here. :). I agree there is a difference, I will modify the answer, but I still think that both of them should be avoided, at least until PHP 5.3 becomes the "new PHP 4". I mean it is still used on a large scale.
    – Marius
    Sep 23 '13 at 16:27




    @ColinM. First of all it's an honor to have your comment here. :). I agree there is a difference, I will modify the answer, but I still think that both of them should be avoided, at least until PHP 5.3 becomes the "new PHP 4". I mean it is still used on a large scale.
    – Marius
    Sep 23 '13 at 16:27




    4




    4




    @Marius, your points are very helpful. Till #31 I was seriously focusing on each point, but on #32 I just burst out a loud laugh. +1 specially for point #32
    – MTM
    Aug 24 '14 at 16:30




    @Marius, your points are very helpful. Till #31 I was seriously focusing on each point, but on #32 I just burst out a loud laugh. +1 specially for point #32
    – MTM
    Aug 24 '14 at 16:30




    1




    1




    If you encrypt your code files with Ioncube (or something else)...well...I just hate you and I hope your business goes bankrupt I feel the same. There are some companies that don't offer updated version, you will have to pay for them, it's really frustrating for me and don't understand why they want to sell same product again and again (to make money? obviously). I just don't buy their product anymore. You know whom I talking about.
    – Adarsh Khatri
    Apr 11 '16 at 4:01




    If you encrypt your code files with Ioncube (or something else)...well...I just hate you and I hope your business goes bankrupt I feel the same. There are some companies that don't offer updated version, you will have to pay for them, it's really frustrating for me and don't understand why they want to sell same product again and again (to make money? obviously). I just don't buy their product anymore. You know whom I talking about.
    – Adarsh Khatri
    Apr 11 '16 at 4:01













    29














    I am a big fan of using modman so that I can develop and source control just my extension and leave the core files and folder structure unchanged. It is also makes testing across different installations run smoother.



    Oh and one massive tip always try to install your packaged extension locally on a clean install of magento before uploading it to Magento Connect, I have missed out files so many times in the package manager.






    share|improve this answer

















    • 3




      Good call about the 'install your packaged extension locally'. I think this falls in the category: 'Test your god damn extension top to bottom'.
      – Marius
      Sep 23 '13 at 14:01










    • I've been caught out by this before too. Make sure you test the package on a clean install that is not the same one you packaged it on!
      – Joseph Leedy
      Oct 9 '13 at 18:13


















    29














    I am a big fan of using modman so that I can develop and source control just my extension and leave the core files and folder structure unchanged. It is also makes testing across different installations run smoother.



    Oh and one massive tip always try to install your packaged extension locally on a clean install of magento before uploading it to Magento Connect, I have missed out files so many times in the package manager.






    share|improve this answer

















    • 3




      Good call about the 'install your packaged extension locally'. I think this falls in the category: 'Test your god damn extension top to bottom'.
      – Marius
      Sep 23 '13 at 14:01










    • I've been caught out by this before too. Make sure you test the package on a clean install that is not the same one you packaged it on!
      – Joseph Leedy
      Oct 9 '13 at 18:13
















    29












    29








    29






    I am a big fan of using modman so that I can develop and source control just my extension and leave the core files and folder structure unchanged. It is also makes testing across different installations run smoother.



    Oh and one massive tip always try to install your packaged extension locally on a clean install of magento before uploading it to Magento Connect, I have missed out files so many times in the package manager.






    share|improve this answer












    I am a big fan of using modman so that I can develop and source control just my extension and leave the core files and folder structure unchanged. It is also makes testing across different installations run smoother.



    Oh and one massive tip always try to install your packaged extension locally on a clean install of magento before uploading it to Magento Connect, I have missed out files so many times in the package manager.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 23 '13 at 13:58









    David Manners

    24.5k861211




    24.5k861211








    • 3




      Good call about the 'install your packaged extension locally'. I think this falls in the category: 'Test your god damn extension top to bottom'.
      – Marius
      Sep 23 '13 at 14:01










    • I've been caught out by this before too. Make sure you test the package on a clean install that is not the same one you packaged it on!
      – Joseph Leedy
      Oct 9 '13 at 18:13
















    • 3




      Good call about the 'install your packaged extension locally'. I think this falls in the category: 'Test your god damn extension top to bottom'.
      – Marius
      Sep 23 '13 at 14:01










    • I've been caught out by this before too. Make sure you test the package on a clean install that is not the same one you packaged it on!
      – Joseph Leedy
      Oct 9 '13 at 18:13










    3




    3




    Good call about the 'install your packaged extension locally'. I think this falls in the category: 'Test your god damn extension top to bottom'.
    – Marius
    Sep 23 '13 at 14:01




    Good call about the 'install your packaged extension locally'. I think this falls in the category: 'Test your god damn extension top to bottom'.
    – Marius
    Sep 23 '13 at 14:01












    I've been caught out by this before too. Make sure you test the package on a clean install that is not the same one you packaged it on!
    – Joseph Leedy
    Oct 9 '13 at 18:13






    I've been caught out by this before too. Make sure you test the package on a clean install that is not the same one you packaged it on!
    – Joseph Leedy
    Oct 9 '13 at 18:13













    20














    Andreas von Studnitz and Dr. Nikolai Krambrock gave a good presentation on code quality on the Meet Magento DE 2014. They distinguish between general code quality and Magento-specific code quality. In short there are following general rules:




    • The use of structure elements - just like classes and methods - should be arranged in middle seizes classes. These elements of structure only make sense when they are used for structuring. Therefore they have to be of medium size. It is regarded to use 100-200 Lines of Code for classes and 3-20 Lines of Code for methods.

    • Because of the use of "if" or "while" the code is indented. If there are more than 3 indentations it is better to revise them. Too many indentations are an evidence for the code's complexity and should therefore be avoided.

    • Dead Code should be avoided and deleted. Static analyses help finding it if one exists.


    Even more important are the Magento-specific rules:




    • Modules should work independently. They should only have little dependency on other modules and no dependency on templates. A solution is to use layout-updates (base/default) instead of adaption to template files and a module that covers additional functions of the template.

    • To maintain the ability of updates in Magento core-hacks and hacks of external modules should be avoided. A better way is the use rewriters or observer instead.

    • For changes it is better to use setup scripts instead of direct changes of the database or of the admin. Thanks to them changes have to be done only onetime.


    Here are some more details and a video of the presentation:
    http://www.code4business.de/code-qualitaet-magento/






    share|improve this answer

















    • 1




      Nice and useful information. Thanks for sharing. +1 from me.
      – Marius
      Aug 25 '14 at 8:50






    • 1




      But If you had an english version of the link you posted would be even better.
      – Marius
      Aug 25 '14 at 9:00










    • An English version of this presentation is going to be written soon. I will keep you current and I will share the new link as soon as the English version is published.
      – user3743859
      Aug 25 '14 at 15:08










    • An English version of the presentation is online now. Here is the link to it: code4business.de/code-quality-magento
      – user3743859
      Oct 1 '14 at 6:57










    • huh? It's still in German. But I just happened to attend this presentation in English at MeetMagentRo about 2 weeks ago. Great stuff.
      – Marius
      Oct 1 '14 at 6:59
















    20














    Andreas von Studnitz and Dr. Nikolai Krambrock gave a good presentation on code quality on the Meet Magento DE 2014. They distinguish between general code quality and Magento-specific code quality. In short there are following general rules:




    • The use of structure elements - just like classes and methods - should be arranged in middle seizes classes. These elements of structure only make sense when they are used for structuring. Therefore they have to be of medium size. It is regarded to use 100-200 Lines of Code for classes and 3-20 Lines of Code for methods.

    • Because of the use of "if" or "while" the code is indented. If there are more than 3 indentations it is better to revise them. Too many indentations are an evidence for the code's complexity and should therefore be avoided.

    • Dead Code should be avoided and deleted. Static analyses help finding it if one exists.


    Even more important are the Magento-specific rules:




    • Modules should work independently. They should only have little dependency on other modules and no dependency on templates. A solution is to use layout-updates (base/default) instead of adaption to template files and a module that covers additional functions of the template.

    • To maintain the ability of updates in Magento core-hacks and hacks of external modules should be avoided. A better way is the use rewriters or observer instead.

    • For changes it is better to use setup scripts instead of direct changes of the database or of the admin. Thanks to them changes have to be done only onetime.


    Here are some more details and a video of the presentation:
    http://www.code4business.de/code-qualitaet-magento/






    share|improve this answer

















    • 1




      Nice and useful information. Thanks for sharing. +1 from me.
      – Marius
      Aug 25 '14 at 8:50






    • 1




      But If you had an english version of the link you posted would be even better.
      – Marius
      Aug 25 '14 at 9:00










    • An English version of this presentation is going to be written soon. I will keep you current and I will share the new link as soon as the English version is published.
      – user3743859
      Aug 25 '14 at 15:08










    • An English version of the presentation is online now. Here is the link to it: code4business.de/code-quality-magento
      – user3743859
      Oct 1 '14 at 6:57










    • huh? It's still in German. But I just happened to attend this presentation in English at MeetMagentRo about 2 weeks ago. Great stuff.
      – Marius
      Oct 1 '14 at 6:59














    20












    20








    20






    Andreas von Studnitz and Dr. Nikolai Krambrock gave a good presentation on code quality on the Meet Magento DE 2014. They distinguish between general code quality and Magento-specific code quality. In short there are following general rules:




    • The use of structure elements - just like classes and methods - should be arranged in middle seizes classes. These elements of structure only make sense when they are used for structuring. Therefore they have to be of medium size. It is regarded to use 100-200 Lines of Code for classes and 3-20 Lines of Code for methods.

    • Because of the use of "if" or "while" the code is indented. If there are more than 3 indentations it is better to revise them. Too many indentations are an evidence for the code's complexity and should therefore be avoided.

    • Dead Code should be avoided and deleted. Static analyses help finding it if one exists.


    Even more important are the Magento-specific rules:




    • Modules should work independently. They should only have little dependency on other modules and no dependency on templates. A solution is to use layout-updates (base/default) instead of adaption to template files and a module that covers additional functions of the template.

    • To maintain the ability of updates in Magento core-hacks and hacks of external modules should be avoided. A better way is the use rewriters or observer instead.

    • For changes it is better to use setup scripts instead of direct changes of the database or of the admin. Thanks to them changes have to be done only onetime.


    Here are some more details and a video of the presentation:
    http://www.code4business.de/code-qualitaet-magento/






    share|improve this answer












    Andreas von Studnitz and Dr. Nikolai Krambrock gave a good presentation on code quality on the Meet Magento DE 2014. They distinguish between general code quality and Magento-specific code quality. In short there are following general rules:




    • The use of structure elements - just like classes and methods - should be arranged in middle seizes classes. These elements of structure only make sense when they are used for structuring. Therefore they have to be of medium size. It is regarded to use 100-200 Lines of Code for classes and 3-20 Lines of Code for methods.

    • Because of the use of "if" or "while" the code is indented. If there are more than 3 indentations it is better to revise them. Too many indentations are an evidence for the code's complexity and should therefore be avoided.

    • Dead Code should be avoided and deleted. Static analyses help finding it if one exists.


    Even more important are the Magento-specific rules:




    • Modules should work independently. They should only have little dependency on other modules and no dependency on templates. A solution is to use layout-updates (base/default) instead of adaption to template files and a module that covers additional functions of the template.

    • To maintain the ability of updates in Magento core-hacks and hacks of external modules should be avoided. A better way is the use rewriters or observer instead.

    • For changes it is better to use setup scripts instead of direct changes of the database or of the admin. Thanks to them changes have to be done only onetime.


    Here are some more details and a video of the presentation:
    http://www.code4business.de/code-qualitaet-magento/







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 25 '14 at 8:46









    user3743859

    31122




    31122








    • 1




      Nice and useful information. Thanks for sharing. +1 from me.
      – Marius
      Aug 25 '14 at 8:50






    • 1




      But If you had an english version of the link you posted would be even better.
      – Marius
      Aug 25 '14 at 9:00










    • An English version of this presentation is going to be written soon. I will keep you current and I will share the new link as soon as the English version is published.
      – user3743859
      Aug 25 '14 at 15:08










    • An English version of the presentation is online now. Here is the link to it: code4business.de/code-quality-magento
      – user3743859
      Oct 1 '14 at 6:57










    • huh? It's still in German. But I just happened to attend this presentation in English at MeetMagentRo about 2 weeks ago. Great stuff.
      – Marius
      Oct 1 '14 at 6:59














    • 1




      Nice and useful information. Thanks for sharing. +1 from me.
      – Marius
      Aug 25 '14 at 8:50






    • 1




      But If you had an english version of the link you posted would be even better.
      – Marius
      Aug 25 '14 at 9:00










    • An English version of this presentation is going to be written soon. I will keep you current and I will share the new link as soon as the English version is published.
      – user3743859
      Aug 25 '14 at 15:08










    • An English version of the presentation is online now. Here is the link to it: code4business.de/code-quality-magento
      – user3743859
      Oct 1 '14 at 6:57










    • huh? It's still in German. But I just happened to attend this presentation in English at MeetMagentRo about 2 weeks ago. Great stuff.
      – Marius
      Oct 1 '14 at 6:59








    1




    1




    Nice and useful information. Thanks for sharing. +1 from me.
    – Marius
    Aug 25 '14 at 8:50




    Nice and useful information. Thanks for sharing. +1 from me.
    – Marius
    Aug 25 '14 at 8:50




    1




    1




    But If you had an english version of the link you posted would be even better.
    – Marius
    Aug 25 '14 at 9:00




    But If you had an english version of the link you posted would be even better.
    – Marius
    Aug 25 '14 at 9:00












    An English version of this presentation is going to be written soon. I will keep you current and I will share the new link as soon as the English version is published.
    – user3743859
    Aug 25 '14 at 15:08




    An English version of this presentation is going to be written soon. I will keep you current and I will share the new link as soon as the English version is published.
    – user3743859
    Aug 25 '14 at 15:08












    An English version of the presentation is online now. Here is the link to it: code4business.de/code-quality-magento
    – user3743859
    Oct 1 '14 at 6:57




    An English version of the presentation is online now. Here is the link to it: code4business.de/code-quality-magento
    – user3743859
    Oct 1 '14 at 6:57












    huh? It's still in German. But I just happened to attend this presentation in English at MeetMagentRo about 2 weeks ago. Great stuff.
    – Marius
    Oct 1 '14 at 6:59




    huh? It's still in German. But I just happened to attend this presentation in English at MeetMagentRo about 2 weeks ago. Great stuff.
    – Marius
    Oct 1 '14 at 6:59











    16














    If you sell your extension or share it with others, think about writing code that is human readable.




    1. don't make method too complex

    2. add DOC blocks to your methods

    3. use proper variable names, like $productIds instead of $ids

    4. same for methods, public function myOnProductSaveMethod() {...} says ... nothing , but tryDisableInternetOnProductSave() will give a hint want's planned

    5. use type hints where it makes sense someMethod(Varien_Data_Db_Collection $collection)

    6. avoid magic numbers and strings *

    7. if you use models set $_eventPrefix property (and $_eventObject) to make them better accessible to observers

    8. if you add system config fields


      • set default values in config.xml

      • add <validate> nodes to fields in system.xml

      • add ACL resources to adminhtml.xml



    9. do not add useless/advertising first-level menu entries in admin backend - neither in topbar nor in config sections

    10. add ACL resources for all controller actions (massactions too!)

    11. ensure your queries work with DB table prefixes

    12. think about (no) backward comptibility (this is really opinion based)


      • do not support Mysql4 classes

      • do not use deprecated methods



    13. ensure your extionsion works as expected in every case - add UnitTests (PhpUnit for example)

    14. in addition to David Manners ... add a composer.json too to make deployment easier




    * Often used:




    • admin store ID



      • 0 > Mage_Core_Model_App::ADMIN_STORE_ID



    • product status



      • 1 > Mage_Catalog_Model_Product_Status::STATUS_ENABLED


      • 2 > Mage_Catalog_Model_Product_Status::STATUS_DISABLED (not 0 as maybe expected)



    • product type



      • simple > Mage_Catalog_Model_Product_Type::TYPE_SIMPLE


      • bundle > Mage_Catalog_Model_Product_Type::TYPE_BUNDLE


      • configurable > Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE


      • grouped > Mage_Catalog_Model_Product_Type::TYPE_GROUPED


      • virtual > Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL



    • product visibity



      • 1 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE


      • 2 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG


      • 3 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH


      • 4 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH




    Same for SQL order ASC vs Zend_Db_Select::SQL_ASC (for example).



    Saying "it's not nessessary cause it will never ever change"? For example entity ID for catalog_product attributes changed somewhere between Magento 1.5 and 1.9 from 10 to 4, so this could break your extension:



    $collection->addFieldToFilter('entity_type_id', 10)


    Using this instead adds one query, but you'll be safe ...



    $entityTypeId = Mage::getModel('eav/config')
    ->getEntityType(Mage_Catalog_Model_Product::ENTITY)
    ->getEntityTypeId();

    $collection->addFieldToFilter('entity_type_id', $entityTypeId)





    share|improve this answer




























      16














      If you sell your extension or share it with others, think about writing code that is human readable.




      1. don't make method too complex

      2. add DOC blocks to your methods

      3. use proper variable names, like $productIds instead of $ids

      4. same for methods, public function myOnProductSaveMethod() {...} says ... nothing , but tryDisableInternetOnProductSave() will give a hint want's planned

      5. use type hints where it makes sense someMethod(Varien_Data_Db_Collection $collection)

      6. avoid magic numbers and strings *

      7. if you use models set $_eventPrefix property (and $_eventObject) to make them better accessible to observers

      8. if you add system config fields


        • set default values in config.xml

        • add <validate> nodes to fields in system.xml

        • add ACL resources to adminhtml.xml



      9. do not add useless/advertising first-level menu entries in admin backend - neither in topbar nor in config sections

      10. add ACL resources for all controller actions (massactions too!)

      11. ensure your queries work with DB table prefixes

      12. think about (no) backward comptibility (this is really opinion based)


        • do not support Mysql4 classes

        • do not use deprecated methods



      13. ensure your extionsion works as expected in every case - add UnitTests (PhpUnit for example)

      14. in addition to David Manners ... add a composer.json too to make deployment easier




      * Often used:




      • admin store ID



        • 0 > Mage_Core_Model_App::ADMIN_STORE_ID



      • product status



        • 1 > Mage_Catalog_Model_Product_Status::STATUS_ENABLED


        • 2 > Mage_Catalog_Model_Product_Status::STATUS_DISABLED (not 0 as maybe expected)



      • product type



        • simple > Mage_Catalog_Model_Product_Type::TYPE_SIMPLE


        • bundle > Mage_Catalog_Model_Product_Type::TYPE_BUNDLE


        • configurable > Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE


        • grouped > Mage_Catalog_Model_Product_Type::TYPE_GROUPED


        • virtual > Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL



      • product visibity



        • 1 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE


        • 2 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG


        • 3 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH


        • 4 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH




      Same for SQL order ASC vs Zend_Db_Select::SQL_ASC (for example).



      Saying "it's not nessessary cause it will never ever change"? For example entity ID for catalog_product attributes changed somewhere between Magento 1.5 and 1.9 from 10 to 4, so this could break your extension:



      $collection->addFieldToFilter('entity_type_id', 10)


      Using this instead adds one query, but you'll be safe ...



      $entityTypeId = Mage::getModel('eav/config')
      ->getEntityType(Mage_Catalog_Model_Product::ENTITY)
      ->getEntityTypeId();

      $collection->addFieldToFilter('entity_type_id', $entityTypeId)





      share|improve this answer


























        16












        16








        16






        If you sell your extension or share it with others, think about writing code that is human readable.




        1. don't make method too complex

        2. add DOC blocks to your methods

        3. use proper variable names, like $productIds instead of $ids

        4. same for methods, public function myOnProductSaveMethod() {...} says ... nothing , but tryDisableInternetOnProductSave() will give a hint want's planned

        5. use type hints where it makes sense someMethod(Varien_Data_Db_Collection $collection)

        6. avoid magic numbers and strings *

        7. if you use models set $_eventPrefix property (and $_eventObject) to make them better accessible to observers

        8. if you add system config fields


          • set default values in config.xml

          • add <validate> nodes to fields in system.xml

          • add ACL resources to adminhtml.xml



        9. do not add useless/advertising first-level menu entries in admin backend - neither in topbar nor in config sections

        10. add ACL resources for all controller actions (massactions too!)

        11. ensure your queries work with DB table prefixes

        12. think about (no) backward comptibility (this is really opinion based)


          • do not support Mysql4 classes

          • do not use deprecated methods



        13. ensure your extionsion works as expected in every case - add UnitTests (PhpUnit for example)

        14. in addition to David Manners ... add a composer.json too to make deployment easier




        * Often used:




        • admin store ID



          • 0 > Mage_Core_Model_App::ADMIN_STORE_ID



        • product status



          • 1 > Mage_Catalog_Model_Product_Status::STATUS_ENABLED


          • 2 > Mage_Catalog_Model_Product_Status::STATUS_DISABLED (not 0 as maybe expected)



        • product type



          • simple > Mage_Catalog_Model_Product_Type::TYPE_SIMPLE


          • bundle > Mage_Catalog_Model_Product_Type::TYPE_BUNDLE


          • configurable > Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE


          • grouped > Mage_Catalog_Model_Product_Type::TYPE_GROUPED


          • virtual > Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL



        • product visibity



          • 1 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE


          • 2 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG


          • 3 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH


          • 4 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH




        Same for SQL order ASC vs Zend_Db_Select::SQL_ASC (for example).



        Saying "it's not nessessary cause it will never ever change"? For example entity ID for catalog_product attributes changed somewhere between Magento 1.5 and 1.9 from 10 to 4, so this could break your extension:



        $collection->addFieldToFilter('entity_type_id', 10)


        Using this instead adds one query, but you'll be safe ...



        $entityTypeId = Mage::getModel('eav/config')
        ->getEntityType(Mage_Catalog_Model_Product::ENTITY)
        ->getEntityTypeId();

        $collection->addFieldToFilter('entity_type_id', $entityTypeId)





        share|improve this answer














        If you sell your extension or share it with others, think about writing code that is human readable.




        1. don't make method too complex

        2. add DOC blocks to your methods

        3. use proper variable names, like $productIds instead of $ids

        4. same for methods, public function myOnProductSaveMethod() {...} says ... nothing , but tryDisableInternetOnProductSave() will give a hint want's planned

        5. use type hints where it makes sense someMethod(Varien_Data_Db_Collection $collection)

        6. avoid magic numbers and strings *

        7. if you use models set $_eventPrefix property (and $_eventObject) to make them better accessible to observers

        8. if you add system config fields


          • set default values in config.xml

          • add <validate> nodes to fields in system.xml

          • add ACL resources to adminhtml.xml



        9. do not add useless/advertising first-level menu entries in admin backend - neither in topbar nor in config sections

        10. add ACL resources for all controller actions (massactions too!)

        11. ensure your queries work with DB table prefixes

        12. think about (no) backward comptibility (this is really opinion based)


          • do not support Mysql4 classes

          • do not use deprecated methods



        13. ensure your extionsion works as expected in every case - add UnitTests (PhpUnit for example)

        14. in addition to David Manners ... add a composer.json too to make deployment easier




        * Often used:




        • admin store ID



          • 0 > Mage_Core_Model_App::ADMIN_STORE_ID



        • product status



          • 1 > Mage_Catalog_Model_Product_Status::STATUS_ENABLED


          • 2 > Mage_Catalog_Model_Product_Status::STATUS_DISABLED (not 0 as maybe expected)



        • product type



          • simple > Mage_Catalog_Model_Product_Type::TYPE_SIMPLE


          • bundle > Mage_Catalog_Model_Product_Type::TYPE_BUNDLE


          • configurable > Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE


          • grouped > Mage_Catalog_Model_Product_Type::TYPE_GROUPED


          • virtual > Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL



        • product visibity



          • 1 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE


          • 2 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG


          • 3 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH


          • 4 > Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH




        Same for SQL order ASC vs Zend_Db_Select::SQL_ASC (for example).



        Saying "it's not nessessary cause it will never ever change"? For example entity ID for catalog_product attributes changed somewhere between Magento 1.5 and 1.9 from 10 to 4, so this could break your extension:



        $collection->addFieldToFilter('entity_type_id', 10)


        Using this instead adds one query, but you'll be safe ...



        $entityTypeId = Mage::getModel('eav/config')
        ->getEntityType(Mage_Catalog_Model_Product::ENTITY)
        ->getEntityTypeId();

        $collection->addFieldToFilter('entity_type_id', $entityTypeId)






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 27 '18 at 23:22

























        answered Jul 29 '17 at 21:07









        sv3n

        9,64062352




        9,64062352























            6














            @marius, regarding Coding Standards (point 24 in your list).



            I like to use PHP_CodeSniffer along with EQP and ECG CS to automatically enforce these standards.



            Using PHP_CodeSniffer you don't have to worry about forgetting things like replacing array() with , avoid using is_null, leave unused local variables or even a method without PHPDoc block.



            PHP_CodeSniffer will always tell you about it.






            share|improve this answer























            • Agreed! Possible howto: magento.stackexchange.com/questions/178640/…
              – sv3n
              Jul 29 '17 at 21:37










            • I think there is no way to configure both CS in PHPStorm (for those who use PHPStorm) but you can always use the terminal to check the CS in your code. Also there are tools such as grumphp github.com/phpro/grumphp that help a bit.
              – diazwatson
              Jul 30 '17 at 0:29










            • It might be help you magento.stackexchange.com/questions/200022/…
              – Pramod Kharade
              Jan 20 '18 at 17:05


















            6














            @marius, regarding Coding Standards (point 24 in your list).



            I like to use PHP_CodeSniffer along with EQP and ECG CS to automatically enforce these standards.



            Using PHP_CodeSniffer you don't have to worry about forgetting things like replacing array() with , avoid using is_null, leave unused local variables or even a method without PHPDoc block.



            PHP_CodeSniffer will always tell you about it.






            share|improve this answer























            • Agreed! Possible howto: magento.stackexchange.com/questions/178640/…
              – sv3n
              Jul 29 '17 at 21:37










            • I think there is no way to configure both CS in PHPStorm (for those who use PHPStorm) but you can always use the terminal to check the CS in your code. Also there are tools such as grumphp github.com/phpro/grumphp that help a bit.
              – diazwatson
              Jul 30 '17 at 0:29










            • It might be help you magento.stackexchange.com/questions/200022/…
              – Pramod Kharade
              Jan 20 '18 at 17:05
















            6












            6








            6






            @marius, regarding Coding Standards (point 24 in your list).



            I like to use PHP_CodeSniffer along with EQP and ECG CS to automatically enforce these standards.



            Using PHP_CodeSniffer you don't have to worry about forgetting things like replacing array() with , avoid using is_null, leave unused local variables or even a method without PHPDoc block.



            PHP_CodeSniffer will always tell you about it.






            share|improve this answer














            @marius, regarding Coding Standards (point 24 in your list).



            I like to use PHP_CodeSniffer along with EQP and ECG CS to automatically enforce these standards.



            Using PHP_CodeSniffer you don't have to worry about forgetting things like replacing array() with , avoid using is_null, leave unused local variables or even a method without PHPDoc block.



            PHP_CodeSniffer will always tell you about it.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Oct 12 '17 at 1:04

























            answered Jul 23 '17 at 23:03









            diazwatson

            1,45911223




            1,45911223












            • Agreed! Possible howto: magento.stackexchange.com/questions/178640/…
              – sv3n
              Jul 29 '17 at 21:37










            • I think there is no way to configure both CS in PHPStorm (for those who use PHPStorm) but you can always use the terminal to check the CS in your code. Also there are tools such as grumphp github.com/phpro/grumphp that help a bit.
              – diazwatson
              Jul 30 '17 at 0:29










            • It might be help you magento.stackexchange.com/questions/200022/…
              – Pramod Kharade
              Jan 20 '18 at 17:05




















            • Agreed! Possible howto: magento.stackexchange.com/questions/178640/…
              – sv3n
              Jul 29 '17 at 21:37










            • I think there is no way to configure both CS in PHPStorm (for those who use PHPStorm) but you can always use the terminal to check the CS in your code. Also there are tools such as grumphp github.com/phpro/grumphp that help a bit.
              – diazwatson
              Jul 30 '17 at 0:29










            • It might be help you magento.stackexchange.com/questions/200022/…
              – Pramod Kharade
              Jan 20 '18 at 17:05


















            Agreed! Possible howto: magento.stackexchange.com/questions/178640/…
            – sv3n
            Jul 29 '17 at 21:37




            Agreed! Possible howto: magento.stackexchange.com/questions/178640/…
            – sv3n
            Jul 29 '17 at 21:37












            I think there is no way to configure both CS in PHPStorm (for those who use PHPStorm) but you can always use the terminal to check the CS in your code. Also there are tools such as grumphp github.com/phpro/grumphp that help a bit.
            – diazwatson
            Jul 30 '17 at 0:29




            I think there is no way to configure both CS in PHPStorm (for those who use PHPStorm) but you can always use the terminal to check the CS in your code. Also there are tools such as grumphp github.com/phpro/grumphp that help a bit.
            – diazwatson
            Jul 30 '17 at 0:29












            It might be help you magento.stackexchange.com/questions/200022/…
            – Pramod Kharade
            Jan 20 '18 at 17:05






            It might be help you magento.stackexchange.com/questions/200022/…
            – Pramod Kharade
            Jan 20 '18 at 17:05




















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f8344%2fhow-to-write-a-custom-extension%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            1300-talet

            1300-talet

            Display a custom attribute below product name in the front-end Magento 1.9.3.8