Difference between relative Db table and EAV table

ALL Magento Models inherit from the Mage_Core_Model_Abstract class.
Difference starts from the Resource object.

All resources extend the base Mage_Core_Model_Resource_Abstract class but
simple Models have a resource that inherits from Mage_Core_Model_Mysql4_Abstract (Mage_Core_Model_Resource_Db_Abstract),
and EAV Models have a resource that inherits from Mage_Eav_Model_Entity_Abstract

Adminhtml layouts

Adminhtml Grid and Edit is possible to add from layout or it is possible to specify directly in Adminhtml controller for example:

this way:

app/design/adminhtml/default/default/layout/photo.xml
<?xml version="1.0"?>
<layout>
    <adminhtml_photograph_index>
        <reference name="content">
            <block type="photo/adminhtml_photograph" name="photograph" />
        </reference>
    </adminhtml_photograph_index>
    <adminhtml_photograph_edit>
        <reference name="content">
            <block type="photo/adminhtml_photograph_edit" name="photograph_edit" />
        </reference>
    </adminhtml_photograph_edit>
</layout>

or this way:

    public function indexAction()
    {
	...
        $this->_addContent($this->getLayout()->createBlock('photo/adminhtml_photograph'));
        $this->renderLayout();
    }
 
    public function editAction()
    {
	...
        $this->_addContent($this->getLayout()->createBlock('photo/adminhtml_photograph_edit'));
        $this->renderLayout();
    }

Magento explaining model naming

This:

$model = Mage::getModel('shop/people');

comes from:

 app/local/VendorName/PluginName/etc/config.xml
        <models>
            <shop>
                <class>VisionDirect_StoreLocator_Model</class>
                <resourceModel>storelocator_mysql4</resourceModel>
            </shop>
            <shop_mysql4>
                <class>VisionDirect_StoreLocator_Model_Mysql4</class>
                <entities>
                    <people>
                        <table>storelocator_people</table>
                    </people>
                </entities>
            </shop_mysql4>
        </models>

How-to magento add Admin Backend Controller

1. Firstly, create adminhtml.xml file and put there

and blocks within .
Alternatively, you can put

to config.xml -> block.

2. In order to have path to controller working propertly, never forget to add block in config.xml

3. Also, put to either adminhtml.xml or alternatively to config.xml block.

Reset admin password in Db

In case you forgot admin password it is possible to reset it directly in db:

SELECT * FROM admin_user WHERE username='admin';
 
UPDATE admin_user SET password=MD5('admin123') WHERE username='admin';

Exception printing is disabled by default for security reasons

Rename the local.xml.sample in /errors to local.xml and you would be able to see the error and the entire stack trace

Disable cache

1. Go to Magento Admin Panel > System > Cache Management > Select all cache from left side checkboxes > Select Action: disable from right top dropdown > Click Submit

The only thing different in Magento’s MVC model that is different from other MVCs is the way it uses Block. In normal MVC, variables are passed to the View through Controller. However, in Magento, Views get data from Block, and Block gets its data from Model.

Magento url redirect from a Controller

 
<?php
 
namespace Imran\Test\Controller\Index;
 
use \Magento\Framework\App\Action\Action;
 
class Index extends Action
{
    /**
     * @var  \Magento\Framework\View\Result\Page
     */
    protected $resultPageFactory;
 
    /**
     * @param \Magento\Framework\App\Action\Context $context
     */
    public function __construct(\Magento\Framework\App\Action\Context $context,
                                    \Magento\Framework\View\Result\PageFactory $resultPageFactory)
    {
        parent::__construct($context);
        $this->resultPageFactory = $resultPageFactory;
        $this->resultRedirectFactory->create()->setUrl('https://www.someurl.com');
    }
}

Magento Zend Framework Mappings

CE – Community Edition
PE – Professional Edition
EE – Enterprise Edition

CE 1.9 – ZF 1.12.3
CE 1.5 – CE 1.8 – ZF 1.11.1
CE 1.4.2.0 – ZF 1.10.8
CE 1.4.0.1 – ZF 1.9.6
CE 1.3.2.1 – ZF 1.7.2
CE 1.2.0.1 – ZF 1.7.2
CE 1.1.6 – ZF 1.5.1
CE 1.0.19870.4 – ZF 1.5.1

PE 1.11 – ZF 1.11.1
PE 1.10 – ZF 1.11.1

EE 1.14 – ZF 1.12.3
EE 1.10 – 1.13 – ZF 1.11.1
EE 1.9.1.1 – ZF 1.10.8