We've been using Modman for installation of Magento modules for quite some time.
Modman has a few shortcomings, but for the most part does a really good job. What Modman doesn't do is remember versions of modules that are checked out, or easily synching one machine's installed modules to another. - This is a manual process.
What we do is include a readme
file in each project's root, that lists the Modman commands that are required to be run when setting up a new project instance, e.g. another developer's machine, or for a deployment.
Where this process lacks is if a module is updated, it must be communicated to each team member to ensure they run a modman update
.
This Modman process works, but seems clunky.
One thing that I haven't tried, but want to try out on the next new Magento project, is the Magento Composer Installer. I have used composer, and think it's great for PHP projects in general. What it does do is keep a record of the version of the module that was installed. This makes it very easy to keep all machines in sync. The Magento Composer Installer is a Composer extension that works with the Magento directory structure, and creates symlinks/copies the same way that Modman does. I believe there's been a lot of work done to add the necessary composer.json
files to the opensource Magento modules on GitHub, which should make it easy to use.
If there is a common functionality/method which you might going to use for other modules as well, better you add those methods inside a helper class.
Now for this instance, you can use either block or helper to write method in order to retrieve a set of simple products. But my suggestion is use the block to retrieve data you want and call the block (block method) in home page.
I'll elaborate the answer here itself.
Suppose we have a module name "Home" inside a namespace as "Test".
I hope you know how to create module activation file, so I'll eliminate it here.
So the config.xml is like this:
app\code\local\Test\Home\etc\config.xml
<?xml version="1.0"?> <config>
<modules>
<Test_Home>
<version>0.1.0</version>
</Test_Home>
</modules>
<frontend>
<routers>
<home>
<use>standard</use>
<args>
<module>Test_Home</module>
<frontName>home</frontName>
</args>
</home>
</routers>
<layout>
<updates>
<home>
<file>home.xml</file>
</home>
</updates>
</layout>
</frontend>
<global>
<blocks>
<home>
<class>Test_Home_Block</class>
</home>
</blocks>
<models>
<home>
<class>Test_Home_Model</class>
</home>
</models>
</global>
<admin>
<routers>
<home>
<use>admin</use>
<args>
<module>Test_Home</module>
<frontName>home</frontName>
</args>
</home>
</routers>
</admin>
</config>
And the block file is like below:
app\code\local\Test\Home\Block\Featuredproducts.php
<?php
class Test_Home_Block_Featuredproducts extends Mage_Core_Block_Template{
public function _construct() {
parent::_construct();
$this->setTemplate('test/featured_products.phtml');
}
public function getFeaturedProducts()
{
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect("*")
->addFieldToFilter('status','1')
->addFieldToFilter('visibility',array('in' => array(2,4))); // 2 = Search, 4 = Catalog, Search
return $collection;
}
}
Inside template file name as "featured_products.phtml"
app\design\frontend\default\home\template\test\featured_products.phtml
Now we can call getFeaturedProducts method which is written on the block.
$product_collection = $this->getFeaturedProducts();
Hope this answer will help you.
Best Answer
If your
modman
file in/home/users/me/mymodule
is configured properlyIt defines files of your module, to which folders of your project will be linked.
You need to go to your project folder
/var/www/mysite/public_html
and run
Anyway here is a tutorial how to use modman without git and svn.