How-to get current locale of the store
<?php echo Mage::getStoreConfig(’general/locale/code’) ?>
<?php echo Mage::getStoreConfig(’general/locale/code’) ?>
hen we do toHtml(), we render only single block, for example in Adminhtml sorting, when we click on field we want to render only single block not whole page public function gridAction() { $this->loadLayout(); // $this->getResponse()->setBody( // $this->getLayout()->createBlock(‘storelocator/adminhtml_entity_grid’)->toHtml() // ); // return $this; } but if we dont do toHtml() and follow with renderLayout() then […]
By default, Magento will automatically connect to it’s database and provide two separate resources which you can use to access data: “core_read” and “core_write”. <?php /** * Get the resource model */ $resource = Mage::getSingleton(’core/resource’); /** * Retrieve the read connection */ $readConnection = $resource->getConnection(’core_read’); /** * Retrieve the write connection */ $writeConnection […]
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 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: $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>
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.
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’;
Rename the local.xml.sample in /errors to local.xml and you would be able to see the error and the entire stack trace