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.