Monday, January 30, 2012

Upgrade Magento from 1.5.1 to 1.6.2 with magento connect in windows

I think upgrading using magento connect is not so risk

Step:1
Go to admin pannel and login.

step:2
Go to System ->Magento Connect->Magento Connect Manager

step:3
Login with your admin user and password and copy&paste this link
"http://connect20.magentocommerce.com/community/Mage_All_Latest"
in the paste extenstion key install and press 'install' button.Then you get a list of all modules with latest version.
Step:4
Before clicking commit Change you have to do this
  To allow MCM to overwrite existing files you need to edit this file:
  downloader\lib\Mage\Connect\Validator.php
  and remove this part:
 if (file_exists($dest)) {
                $this->addError("'{$file}' already exists");
                return false;
            }
 which is right at the bottom of the file
 If installation fails you will need to re-edit the file as it will be replaced by the version just  downloaded
If you install without changing you will get error "files already exists" and it will not install.

Step:5
After successfull installation when you open the front end you get a error
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtimeor capacity problems. Please try again later.
error 
To clear the error check if there is a file called maintenance.flag in your magento root. If so Delete it
and also clear the cache.

Step:6
Not over there is still error
Stops at "1025 Error on rename of catalog_category_flat_store_1
If you encounter the error
Error in file: "/xxx/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php" - SQLSTATE[HY000]: General error: 1025 Error on rename of './catalog_category_flat_store_1' to './#sql2-6221-31dae3' (errno: 152)” 
to solve this error by running the queries in the database
ALTER TABLE catalog_category_entity ENGINE=INNODB;
ALTER TABLE core_store ENGINE=INNODB;
ALTER TABLE catalog_category_entity ENGINE=INNODB;
ALTER TABLE core_store ENGINE=INNODB;


NOW YOUR PROBLEM IS SOLVED YOU HAVE UPDATED MAGENTO 1.5.1.0 TO MAGENTO 1.6.2.0

Tuesday, January 24, 2012

.htaccess Rewrite Rule for converting /names.php?name=boy&id=23&page=1 to names/boy/23/1

Pass the Query string through url not by traditional method but by using mod rule in .htaccess file
 /names.php?name=boy&id=23&page=1 to names/boy/23/1


RewriteEngine on
RewriteCond %{QUERY_STRING} ^name=(.+)&id=(.+)&page=(.+)$ [NC]
RewriteRule ^names\.php$  /names/%1/%2/%3? [R=301,NE,NC,L]

If you want to convert all the pages to
http://localhost/ram1/2/3
http://localhost/ram1.php?id=2&page=3
http://localhost/ram1/1
http://localhost/ram1.phppage=1
 use the rewrite rule below to automatically converts to corresponding Query String


RewriteEngine on
RewriteRule ^(.+)/([0-9]+)/([0-9]+)/?$ $1.php?id=$2&page=$3 [L]
RewriteRule ^(.+)/([0-9]+)/?$ $1.php?page=$2 [L]