first of all that etc/configx.xml file…
create table.. whenever you create any table or upgrade it, always make that script and put that in folder…of sql..
create config.xml…. from this you can define controller , admin menu and child menu for admin panel…
create helper
create controller which u have defined in xml file..
now to render that block create block and in that folders.. now to mke grid create folder in block and in that create
grid.php to display all..
now go to model and create provider.php and session.php…
now create new folder Mysql4 and in that create Provider.php
now create new folder provider inmysql4 and in that create collection.php for getting grid values..
before slash first is maodule name and after that its a file name, but if its with _(underscore) then in that it will
be another folder and in that its file name will be with .php
$category = Mage::getModel(‘catalog/category’) here catalog is module name.. and category.php file is there in that..
Mage::getSingleton(‘catalog/session’)->setLastVisitedCategoryId($category->getId()); here getSingleton is used to
create object of session and you can set any id in that..
$category = Mage::getHelper(‘catalog/category_flat.php’); here catalog is module and category is folder in helper and
flat.php in that folder..
thus you can create also block,model etc..
ex. this->loadLayout()
->_addContent($this->getLayout()->createBlock(‘provider/contact’))
->renderLayout(); // its used to create block..here provider is module and contact.php
file is in block folder..
generally to set template there is one function in magento setTemplate(‘modulename/filename.phtml’), now in desing in
template there will be one folder whose name is same as modulenmae and in that this file wiil be located. but if you
want to do same as at admin panel then you can;t use this for that you have to make everything in block folder and in
that make one .php file and in that write all.. pls see whole extension..
to use any value in session do this..
in controller..
$form = Mage::getModel(‘warranty/warranty’)
->setData($this->getRequest()->getPost());
Mage::getSingleton(‘warranty/session’)->setData(‘last_saved_warranty’,$form); warranty-module name and session is
file in model folder… like sales… and then redirect ti to block,, not necessary.. u can redirect as you wish..
$this->_redirect(‘warranty/thanks/’); // warranty module and thanks is .php filie in block folder so in
block/thanks.php
and now to access that value use like this..
return Mage::getSingleton(‘warranty/session’)->getData(‘last_saved_warranty’,true); // it will return last saved
warranty id which is stored in session…
if in controller there is somoething like createBlock() and then path is there, so it will come directly form block
folder,, but if there is $this->loadLayout() then that block will come from xml.. so go to xml of that module and and
from that find data about block…
in xml file if you find that <reference name=”content”> then it will come for middle part and if you find <reference
name=”left”> then it will take left part.. thus for right part..
use mysql4 in giving name of attribute..
in customer all come from xml and in that whole form come from enetinty relationship.. means just call one function
addAttribute and with that provide all the details and also it will call one script setup.php so it will get whole
form..
always put dhyan to giving name…
never overwrite controller… no need to overwrite helper… block can be overwrite..and model can aslo be
overwrite.. and use observer for overwrite model action.. see catalogindex whole module..if you have any event and
after that event or before that event you want to call some action or something from model then use observer and all
that..pls refer catalogindex module,…
Leave a Reply