Magento Themes and Magento Extensions


Posted on April 28th, 2013 | Posted by admin

If you’re working with Magento often you’ll find sometimes you need to use Magento functions and classes outside of the Magento platform. This can be easily achieved with the following lines of code.

require_once('app/Mage.php'); //Path to Magento
// Now you can run ANY Magento code you want
// Change 12 to the ID of the product you want to load
$_product = Mage::getModel('catalog/product')->load(12);
echo $_product->getName();

This was only a quick post but hopefully it will be useful to someone.

Magento : add massDelete action in coupon code

Posted on November 17th, 2012 | Posted by admin

Magento : add massDelete action in coupon code

First override Mage_Adminhtml_Block_Promo_Quote_Grid class and add following code
protected function _prepareMassaction()

$this->getMassactionBlock()->addItem(‘delete’, array(
‘label’    => Mage::helper(‘rule’)->__(‘Delete’),
‘url’      => $this->getUrl(‘*/*/massDelete’),
‘confirm’  => Mage::helper(‘rule’)->__(‘Are you sure?’)
return $this;

Generated Magento Model Code

Posted on October 8th, 2012 | Posted by admin

This is a quick one for advanced users, and was inspired by a recent question I answered over at StackOverflow.

One of the nice things about a well abstracted system like Magento is the opportunities it presents for meta-programming. Drop the following code in a controller action (yes, you can define an inner function in PHP)

function someAction()
        header('Content-Type: text/plain');
        $coupon = Mage::getModel('salesrule/rule')->load(1);        

        function outputValue($value)
                case 'string':
                    echo "'".str_replace("'","\\'",$value)."'";
                case 'array':
                    echo "array(";
                    foreach($value as $v)
                        echo ",";

How To Create An Admin Account From Magento Code

Posted on July 13th, 2011 | Posted by admin

Wondering how to restore your broken Magento admin access? If you have lost your magento admin credentials and you are stuck you should not loose heart. If accidentally you have deleted the admin access you can gain your access again with the help of slight magento code. In this article  i will tell you how you can create another temporary admin account and grant all necessary access to your new account.

Create User

Use a ftp program to edit: /app/code/core/Mage/Adminhtml/controllers/indexController.php

find the function loginAction and replace it by the following code (create a backup which you should restore later) :

Add Adwords tracking code to order confirmation page in Magento

Posted on May 12th, 2011 | Posted by admin

Adding an Adwords tracking code to order confirmation page in Magento is relatively easy task. One that can be handled under an hour or so if you choose to implement it the proper way. Here is how.

Modify the “app/design/frontend/default/my_custom_theme/layout/checkout.xml” file. Look for section

Page 1 of 212»