views:

505

answers:

3

I'm just about to start building my first magento module but I can't find any literature on the difference between the local and community folder in core. I've noticed that some people build their modules in local and others in community, what is the difference and why should I use one or the other?

Thanks

+1  A: 

The local folder is for modules that only you will use. The community folder is for modules that will eventually be packaged and made available (or sold) to the magento community. Any modules you download and install are placed in the community folder. Magento doesn't really care where your module is, the distinction is there mainly to keep modules organized. In any case since it's easy to switch from one to another it shouldn't really bother you all that much.

If you don't know which category your module belongs in, you can start in the local folder and if it is to be published, you can move it to the community folder later.

Manos Dilaverakis
+3  A: 

You'll want to develop out of local. The community folder is/was intended to be the place where you'd put modules that you downloaded or bought from the Magento Marketplace. It's my understanding that the use of this folder is being phased out, and it's Varian's recommendation that all modules be placed in the local folder, even those downloaded from the marketplace.

From a system point of view, the only difference is the community folder is searched after the core folder, but before the local folder. Checkout this path setup in app/Mage.php

$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'local';
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community';
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core';
$paths[] = BP . DS . 'lib';

$app_path = implode(PS, $paths);

set_include_path($app_path . PS . Mage::registry('original_include_path'));

So, if you have two files

app/code/community/Companyname/Models/Foo.php
app/code/local/Companyname/Models/Foo.php

Magento will use the one in the community folder first.

Alan Storm
A: 

There are two type of categorization for the module.

  1. Community and commercial Community - free for the community Commercial - paid for the community

  2. Local and Core Core - Extension is developed using magento core files. Local - Extension is developed by copying core files to the local. Actual changes are done at the local

Local one is more advisable...

zalak