// using model magento\app\code\core\Mage\Core\Model\Email\Template.php
public function send_error_email($error = NULL) {
$mailTemplate = Mage::getModel('core/email_template');
$mailTemplate->setSenderName('Insert Sender Name'); // use general Mage::getStoreConfig('trans_email/ident_general/name');
$mailTemplate->setSenderEmail('[email protected]'); // use general Mage::getStoreConfig('trans_email/ident_general/email')
$mailTemplate->setTemplateSubject('Insert Subject Title');
$mailTemplate->setTemplateText('Insert Body Text');
/**
* All of these functions can be found in class Mage_Core_Model_Store
* File: app/code/core/Mage/Core/Model/Store.php
*/
//Get store data
Mage::app()->getStore();
/**
* Get SQL for get record count
*
* Rewrited for GROUP_BY
* @return Varien_Db_Select
*/
public function getSelectCountSql()
{
$this->_renderFilters();
/**
* Retrieve all active payment methods
*/
public function getActivPaymentMethods()
{
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
$methods = array(array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('--Please Select--')));
Mage::getModel('sales/order')->loadByIncrementId('10000001'); //use a real increment order id here
Mage::getModel('sales/order')->load(24999); //use an entity id here
/**
* Redirect redirect from default customer/account/createPost action to noRoute action (404 page)
* Observer event "controller_action_predispatch_customer_account_createpost"
*/
public function redirectToNoRoute()
{
Mage::app()->getResponse()
->setRedirect(Mage::getUrl('cms/index/noRoute'), 301)
$(function(){
$('#name').bind('input', function(){
$(this).val(function(_, v){
return v.charAt(0).toUpperCase() + v.slice(1);
});
});
});
/**
* Clean everything
*/
Mage::app()->getCacheInstance()->flush();
Mage::app()->getCache()->clean();
/**
* Clean specific types
While going through the study guide for the Magento Developer Exam, I’ve been learning a few interesting details that are squirreled away in the Magento code, but can be useful in day to day Magento development.
For example, while going through the section on Module loading, it is revealed that we can easily disable all modules living in the local (app/code/local) namespace by editing app/etc/local.xml
and setting the disable_local_modules
node to true
:
<config>
<global>
...
true