Magento themes and extensions

Add a link to the product on the admin order page

Share
Posted on May 1st, 2013 | Posted by admin

We recently had a client who asked to have a link added to the magento admin order page so they could easily see what the product was. It requires a core hack so isn’t recommended. If you want to go ahead here’s the code:

Open app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml at look and at ~ line 68 until you find

1
<?php echo $this->getColumnHtml($_item, 'name') ?>

Replace with:

1
2
<?php $_pullProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getData('sku')); ?>
<a target="_blank" rel="external" href="<?php echo Mage::getUrl() . $_pullProduct->getData('url_path'); ?>"><?php echo $this->getColumnHtml($_item, 'name') ?></a>

Clear your Magento installs cache without using your admin pages

Share
Posted on March 18th, 2013 | Posted by admin

While moving Magento installs or working on an existing clients install you might need to clean the cache but you might not have access to the installs admin. With the code below you can easily clean the installs cache.

< ?php
require_once 'app/Mage.php';
$app = Mage::app();

if($app != null) {
	$cache = $app->getCache();
	if($cache != null) {
		$cache->clean();
	}
}
?>

Desire to change the admin panel theme on Magento ?

Share
Posted on December 31st, 2012 | Posted by admin

Magento do not provide any easy way to change its admin theme or template. Some time back I had a task to change size of an image displaying for category in admin panel of magento. I could not just overwrite or change the default core admin theme. After some searches I got a fine solution. That goes with Magento quite well.
Here is a step by step tutorial to be able to change the theme of admin panel or say backend of Magento.

Step 1
Create a new module. Yes, you have to create a new module for that.
So go into your local folder of code and create the following folders. App/code/local/Packagename/AdminHtml/etc
Create config.xml in etc folder. In this file write the following code.

How to display Image Preview in Admin Form magento

Share
Posted on February 15th, 2012 | Posted by admin

Magento allows us to create custom form in admin panel by creating our own custom module. We can create almost any field in the admin form by creating a class that extends the base class Mage_Adminhtml_Block_Widget_Form. The _prepareForm method allows to define our form elements.
Sometimes we may need to upload a file in the adminform, the default file field doesn’t provide the image preview when we upload an image file. For this purpose we need to use image field type as shown in the below snippet

$fieldset->addField('filename', 'image', array(
'label' => Mage::helper('customform')->__('Image'),
'required' => false,
'name' => 'filename',
));

How to Send Newsletter Subscription Alert Email to Admin in magento

Share
Posted on February 2nd, 2012 | Posted by admin

Magento has a Newsletter Module that allows the storeowner/admin to send messages to the newsletter subscribers.
The customers/vistors can subscribe to the newsletter by filling the subscription form with their email id. However a small feature is missing in this module, Whenever a customer or visitor is subscribed to the newsletter the admin doesn’t get any notification/alert about the subscription. We can add this feature through our custom module. Our custom module will hook through the newsletter save event and triggers a function in our model class that will send the notification email to admin.

Step 1: Create an email template in html and save it app/locale/en_US/template/email directory. Our email template looks as shown

Page 1 of 3123»