Monday, January 2, 2012

Magento : Access denied issue

First you should log out from the Magento admin area and then log in again.

If the above does not help, you should reset the admin privileges. This can be done through the Magento admin area > System > Permissions > Roles > Administrators.

Click on the Role Resources option from the left menu and make sure that Resource Access is set to All.

Click on the Save Role button and the permissions will be reset.

How to disable the Compare products functionality

You can disable the Compare products functionality in Magento by following these steps:

    Edit app/code/core/Mage/Catalog/Helper/Product/Compare.php and change the following code:

public function getAddUrl($product)

{

return $this->_getUrl(’catalog/product_compare/add’, $this->_getUrlParams($product));

}

to

public function getAddUrl($product)

{

//return $this->_getUrl(’catalog/product_compare/add’, $this->_getUrlParams($product)); return false;

}

    Edit ./app/design/frontend/base/default/layout/catalog.xml (if you are using a different Magento theme, enter its name instead of default) and change the following code:

<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>

to

<!-- <block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/> -->

    Flush the Magento cache from your Magento admin area > System > Cache Management.

How to redirect Magento to open through www


For SEO and usability purposes you may want to redirect your visitors to open your site only through www (http://www.yourdomain.com).
To do this in Magento, you should open the .htaccess file in the folder where your Magento is installed. In it locate the RewriteEngine on line and right after it add the following lines:
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
Once you do this, save the .htaccess file and log in to the Magento admin area > System > Configuration menu and from the left panel click the Web button.
Unfold the Unsecured set of options and change the Base URL option from http://yourdomain.com to http://www.yourdomain.com.
Save the changes and your Magento will start working through www.yourdomain.com only! 

How to enable Search Engine Friendly URLs in Magento


To enable Search Engine Friendly URLs in Magento, you have to log in to the Magento's administration area and click on the Configuration button. Under the Systemnavigation menu, switch to Web page from the sub-navigation panel on the left.
When the page loads, you will see blue lines which represent closed options tablets. Click on the Search Engines Optimization tab and turn on the Use Web Server Rewrites(mark as Yes). Click on the Save Config button and your Magento SEF URLs will be enabled.

How to reset Magento Admin Password


To change your Magento admin password, go to your cPanel > phpMyAdmin, select your Magento database, click the SQL tab and paste this query:
UPDATE admin_user SET password=CONCAT(MD5('sGnewpass'), ':sG') WHERE username='AdminUsername';

Note: You have to change newpass in the MD5('sGnewpass') with your new password, and change *AdminUsername* to your Magento admin username.
Execute the query by clicking the Go buttong and your password will be changed.

How to configure Magento to work with a new domain


There are two things you should do in order to configure Magento to work with a new domain:
  • Edit the Magento database
Go to your cPanel > phpMyAdmin. Select your Magento database from the  left menu, find the table called core_config_data and click on it.

Click the Browse tab and edit the first two fields:
web/unsecure/base_url
web/secure/base_url

by clicking the pen icon in front of each of them. Replace your old domain name with your new one and click the Go button to save the change.
  • Clear the Magento cache.
The Magento cache folder is located in your Magento installation directory > /var/cache. To clear the cache, simply delete the folder. 
Many Magento issues can be fixed just by deleting the cache.

Magento : How to speed up Magento

Many Magento issues are caused by slow performance.

1.The recommended way to speed up Magento's performance is to enable its Compilation function.  The performance increase is between 25%-50% on page loads.

You can enable Magento Compilation from your Magento admin panel > System > Tools > Compilation.

2..Modifying, I mean uncommenting few lines in your .htaccess file can speed up your magento site a looooot. Find these lines below and just remove # before them.

############################################

## enable apache served files compression

## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter

SetOutputFilter DEFLATE

# Netscape 4.x has some problems…

BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some online cialis more problems

BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine

BrowserMatch Buy Generic Drugs Without Prescription \bMSIE !no-gzip !gzip-only-text/html

# Don’t compress images

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content

Header append Vary User-Agent env=!dont-vary

# enable resulting html compression

php_flag zlib.output_compression on

3.An easier way to improve Magento website speed is to turn on GZip compression via .htaccess. GZip compression is a kind of technique to compress textual content when it’s transferred from the web server to a user’s browser.

A single web page from a Magento site can be a few hundreds KB -one of my site shows its homepage size is 500KB when Yahoo homepage is 200KB! (you can check this by clicking Information View Document Size from FireFox developer’s tool bar.)

GZip compression can reduce page size significantly and transfer the data faster to your site visitors.

The files that can be compressed are text files such as XHTML, JavaScript or CSS. Image, video or other multi media files are already compressed.

Find the section for “mod_deflate.c” from your .htaccess file and uncomment the settings as follows:

<IfModule mod_deflate.c>

############################################

## enable apache served files compression

## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter

SetOutputFilter DEFLATE

# Netscape 4.x has some problems…

BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems

BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine

BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don’t compress images

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content

Header append Vary User-Agent env=!dont-vary

</IfModule>

############################################

## enable resulting html compression

php_flag zlib.output_compression on