To call the model anywhere in magento

<?php

$a = Mage::getModel('brand/brand')->getCollection();


Mage::getModel('module name/model name')->getCollection()

folder structure:

Communuity/Redstage/"Brand"/
here brand is a module name (Brand)
and to get model name

Or

<config>
<modules>
<Redstage_Brand>(NameSpace_moduleName)
<version>0.2.3</version>
</Redstage_Brand>
</modules>
<frontend>

..
..
<brand> (in tag is model name)

Note:

The module and model name must be in small caps
if name of module is WebForm then we must use the module name as webform


 foreach ($a as $b) {
  //echo '<pre>';

//print_r($b);
//echo $b->getUrlKey(); ?>
<img src="http://54.219.137.93/magento/media/brand/<?php echo $b->getImage(); ?>" />
<br/>
<br/>
<br/>

<?php
}




 ?>

Comments

Popular Posts

Magmi Single and Multiple Category Importer