How to change Magento default Logo

By default, Magento themes have a logo picture or a text at the top of the page, which is also a link to the home page of the store. To Remove/Replace with your own picture or logo, using your Magento Admin Panel. Go to System > Configuration, click on Design from the menu on the left and then choose Header from the options that pop out in the middle of the screen.

There are three fields that you can change (Logo Image Src, Logo Image Alt, Welcome Text): 

The first field (Logo Image Src) shows the path to the picture for the particular theme. Here, for example, it would be written as “image/logo.gif“, with the full path for the default theme being:

skin/frontend/base/default/images/logo.gif or for some other theme that you have installed it would be slightly different:

skin/frontend/default/<THEME-NAME>/images (with “<THEME-NAME>” replaced by the name of the particular theme).

The second field (Logo Image Alt) shows you the text that is displayed when there is no image or, if there is an image, the text that is shown when you hover the mouse pointer over it.

If you want to remove the Magento logo and text just delete both fields and leave them blank. You can also put your own picture or logo instead of the default one.

How to add date picker to Magento admin backend page

Step 1.
Edit system.xml, create the new field as follows:
1. &lt”my_date translate=”label comment”>
2. <label>Expire On</label>
3. <frontend_type>text</frontend_type> <!– Set the frontend type as Text –>
4. <frontend_model>MODULE_NAME/adminhtml_system_config_date</frontend_model> <!– Specify our custom model –>
5. <sort_order>4</sort_order>
6. <show_in_default>1</show_in_default>
7. <show_in_website>1</show_in_website>
8. <show_in_store>1</show_in_store>
9. <comment>Set the expiry date for the Feature Tour</comment>

Step 2.
Create the new model file at the path: app\code\local\<NAMESPACE>\<MODULE>\Block\Adminhtml\System\Config\Date.php

	class Arvtour_Tour_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
	protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
             $date = new Varien_Data_Form_Element_Date;
             $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);

             $data = array(
                          'name'=> $element->getName(),
                          'html_id'=> $element->getId(),
                          'image'=> $this->getSkinUrl('images/grid-cal.gif'),);
                          $date->setValue($element->getValue(), $format);
	                  return $date->getElementHtml();

How to dynamically get dimensions of an image and change it using Javascript

The javascript code is given below. It uses JQuery.

$(document).ready(function() {
function imgSize() {
var src = $('#myImage').attr('src');
var ow = $('#myImage').attr('width');
var oh = $('#myImage').attr('height');
var newImg = new Image();
newImg.src = src;
var height = newImg.height;
var width = newImg.width;
p = $(newImg).ready(function(){
var nw = newImg.width;
var nh = newImg.height;
if (parseInt(nw) < parseInt(ow) )
$('#myImage').attr("width", "");
if (parseInt(nh) < parseInt(oh) )
$('#myImage').attr("height", "");
return {width: newImg.width, height: newImg.height};

 The example IMG tag is shown below
<img id="myImage" align = center src="myimages/demoimage.jpg"  width="150" height="190"/>

Restricting Image Upload Size and Upload Time Using PHP

How to Check and limit the file upload size using PHP ?
We can check the file size uploaded to server using the script given below:

if ($_FILES["file"]["size"] < 15000)) // Max File Size: 15KB
echo "File size exceeded 15KB";

How to Limit File Upload Time Using PHP ?
We can limit the time taken to upload files to server by editing the pho.ini file. Edit the following line to set the upload time on your site:
ini_set(‘max_input_time’, 300);

Magento – Dumping objects with Zend_Debug::dump

Use Zend_Debug::dump($foo); instead of using var_dump($foo); or print_r($foo); it is essentially the same, just a wrapper with pre HTML tag for formatting and escaping of special characters.

However there will be times that simply dumping objects to the screen can be too much and cause browser hangups or even crashes. So the best practice is to always use the getData() method that Magento has built-in to the Varient Object, this will prevent redundant amounts of data dumped to the screen, but only the bits we really want.

Facebook, Twitter Sharing in Windows Phone

The easiest way to add Twitter and Facebook share buttons is to use the ShareLinkTask class. This class allows your Windows Phone application to launch a dialog that enables the user to share a link on the social networks (of their choice). All you need to do is to use the following code..

shareLinkTask.Title = “Article Title”;

shareLinkTask.LinkUri = new Uri(““, UriKind.Absolute);

shareLinkTask.Message = “Some Message to be shared”;



Implementing Confirm on exit in Windows Phone

Create a function for clear navigation history:

   while(NavigationService.BackStack != null
& NavigationService.BackStack.Count() > 0)
Manage the phone BackKeyPress event in your MainPage.xaml
PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
    // TO DO

Insert a MessageBox dialog and use stop back event when the user don’t want exit the application
if(MessageBox.Show(“Are you sure?”, “Exit?”, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
e.Cancel = true

Restore scroll direction in lion OSX

The new version of Mac OS ie Lion OS has reversed the scroll direction. It is useful only if we are using a touchpad. Scrolling with mouse in a different manner than we are used to is difficult. It is easy to restore the scroll direction to that of the scrollbar.

Open system preferences> select mouse> Uncheck ‘Move content in the direction of finger movement.

Adding a Custom UIBarButtonItem

We will use an image in the resources folder called “back.png”. To insert the image as the back button, add this piece of code to the AppDelegate.m file. This should be in the application:didFinishLaunchingWihOptions method.

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    UIImage *navBarImage = [UIImage imageNamed:@"menubar.png"];
     [[UINavigationBar appearance] setBackgroundImage:navBarImage
    UIImage* backButtonImage = [UIImage imageNamed:@"back.png"];
     [[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
     return YES;