Upgrading Magento from 1.6.0.0 to 1.6.1.0 via diff file

November 10, 2011  |  4 Comments  |  by Raj (MagePsycho)  |  Latest, Linux, Magento

Uprading in Magento has never been an easy task for me. But this time I successfully upgraded the Magento(from 1.6.0.0 to 1.6.1.0) with minimum no of tries. And I’m going to share the success story 🙂

First, I tried with the following series of SSH commands but unluckily didn’t work for me:

rm -rf var/cache var/session
rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
rm -f downloader/pearlib/pear.ini
chmod 550 ./mage
./mage mage-setup .
./mage config-set preferred_state stable
./mage list-installed
./mage list-upgrades
./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
php shell/indexer.php reindexall

I went through all the above steps successfully but when i tried to logout and re-login at the backend, version number didn’t change in the admin footer. It means there was no effect of above code at least for me.

After that I tried the following SSH commands:

rm -rf var/cache/* var/session/*
rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
rm -f downloader/pearlib/pear.ini
wget http://www.magentocommerce.com/downloads/assets/1.6.1.0/1.6.0.0-1.6.1.0.diff.gz
zcat 1.6.0.0-1.6.1.0.diff.gz > 1.6.0.0-1.6.1.0.diff
patch -p0 -f < 1.6.0.0-1.6.1.0.diff

Notes:
– Deleting pear.ini is important in case If you have copied the same magento from another location. Else updates will be installed in your source location instead of current location.
– You need to run the above commands from the root of your Magento installation.

After successfully applying the above commands, I refreshed the magento page but got the following error:

“Error in file: “…/app/code/core/Mage/Sales/sql/sales_setup/upgrade-1.6.0.3-1.6.0.4.php” – SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_order_aggregated_updated’ already exists”

and this error was easily removed just by renaming the following file:

app/code/core/Mage/Sales/sql/sales_setup/upgrade-1.6.0.3-1.6.0.4.php

Besides i didn’t get any error and hence upgrading Magento task was successfull.
This is the first time i upgraded via applying the .diff file and was so happy that it worked for me 🙂

Cheers!!

Happy Upgrading!

How to run Magento 1.3.X on PHP 5.3?

October 15, 2011  |  1 Comments  |  by Raj (MagePsycho)  |  Linux, Magento

You know that Magento version (>= 1.4.X) works well under PHP 5.3. But what if you want to run the Magento 1.3.X under the same AMP(Apache/Mysql/PHP) package? You may need this in order to test the extension/theme compatibilities.

In order to run Magento 1.3.x on PHP 5.3, you need to replace the following function from the corresponding files:

1> index.php

error_reporting(E_ALL | E_STRICT);

to

error_reporting(E_ALL & E_STRICT & ~E_DEPRECATED);

2> lib/Varien/Object.php

__toString

to

__invoke

3> lib/Varien/Pear.php

error_reporting(E_ALL & ~E_NOTICE);

to

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

4> downloader/Maged/Pear.php

error_reporting(E_ALL & ~E_NOTICE);

to

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

5> app\code\core\Mage\Catalog\Model\Layer\Filter\Price.php

__toString

to

__invoke

6> app\code\core\Mage\Core\Controller\Request\Http.php

split

to

explode

7> app\code\core\Mage\Catalog\Model\Category\Attribute\Backend\Sortby.php

split

to

explode

8> app\code\core\Mage\Admin\Model\User.php

split

to

explode

Let me know if i missed some points.

Note that such core hack will be only suitable for testing purpose in development server only, So please bear that in mind.

EDIT:
For terminal user who just want to apply patch, i would recommend to use the following article:
http://goivvy.com/blog/magento1.3fix/

Hope this helps you.

Happy E-Commerce!!

Export / Import CMS pages / Static Blocks Via SSH

October 10, 2011  |  4 Comments  |  by Raj (MagePsycho)  |  Linux, Magento, Mysql

It’s really a tedious task when you have to copy all the cms pages / static blocks from your development server to the live server. If you are importing the whole database then you are lucky enough but if you are updating in already installed magento server then :(, luckily you can use the following commands via SSH:

1> Export from your development server:

mysqldump -u [username] -p[password] [database] cms_page cms_page_store cms_block cms_block_store | grep INSERT | sed 's/INSERT INTO/REPLACE INTO/' > cms-export.sql

Note: Don’t forget to add prefix to cms_* tables if you have prefixed your tables.

2> Import to your live/destination server:

mysql -u [username] -p[password] [database] < cms-export.sql

Hope this saves your time while copying cms pages & static blocks.

Let’s share if anyone has better idea.

Happy E-Commerce!!

Hello world!

September 17, 2011  |  No Comments  |  by Raj (MagePsycho)  |  Javascript, jQuery, Latest, Linux, Magento, Mysql, PHP, Web Service

Dear All
I am trying to share my knowledge gained so far in web development fields from now onwards via this blog.
I will be sharing stuffs related to PHP/Mysql, Magento & more.
Well nothing more to say, just stay tuned with my blog 🙂

Lastly, your suggestion/feedback is always valuable and will make my blog alive.

This much for now.
Thanks