0

I was working with PHP Core and custom MVCs by 1 and half years until when moved to magento desk.

I find it very difficult first, but later got grip in Theme integration and maintenance of previously done modules. Now I got in to Module creation and really confused with the architecture.

In frank, Everytime when I write a new code, It works well, but later edited out wasting so much time of seniors since It does not met completely with Magento's coding style.

For an example, when I need to check something and update a database, I writes,

<?php 
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$query = "SELECT ststus FROM table WHERE Id='".$id."'";
$select_query = $readConnection->fetchOne($query);
$update_value= $select_query[0];
if($update_value=='2')
{
$writeConnection = $resource->getConnection('core_write');
$query = "UPDATE table SET field_name='C' WHERE Id='".$id."'";
$writeConnection->query($query);
}
?>

This is later changed to simply this,

foreach ($dealroomIds as $dealroomId) {
                $manufacturers = Mage::getSingleton('module/module')
                    ->load($dealroomId)
                    ->setStatus($this->getRequest()->getParam('status')); //getting status 
                    if($this->getRequest()->getParam('status')=='2'){
                    $manufacturers->setRunningStatus('C'); // setting new status
                    }
                $manufacturers->setIsMassupdate(true)
                    ->save();
                Mage::getSingleton('dealroom/deals')->UpdateDealProducts($dealroomId); // Update
                    }

The above given is just an example and nothing more than that.

To know more about the coding style and standard, I think is neccessory to know more about

  • Block
  • controllers
  • Model
  • Helper
  • Data

I searched but whatever I read and understand is just far away from the basic. If anyone point out the connections and functions of these, it will be helpful to me.

4

Best practice? http://www.alanstorm.com, great blog that explains all the basics. I learned Magento this way :). Take a look at the creation of backend and frontend extensions!

  • 1
    btw if you have senior Magento devs, asking them for good tutorials or example extensions made by them would also help you alot ;) – Toon Van Dooren Feb 12 '13 at 9:02
  • Hehe you should thank Alan :D I'm just the messenger ^^ – Toon Van Dooren Feb 15 '13 at 12:13
3

A good start would be Magento Developer Knowledge base articles Then as mentioned, read Alan Storm's articles and watch Fundamentals of Magento Development Video Course by Magento (Ben Marks)

After that, I think, you should have a look at official Extension's Developer Guide by Magento - 80 pages on how-to create a custom extension (News) from scratch

2

There are tons of useful and well written guide to create and understand module architecute.

Just to name a few :

http://coding.smashingmagazine.com/2012/03/01/basics-creating-magento-module/

http://magento4u.wordpress.com/2009/06/08/create-new-module-helloworld-in-magento/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.