Referrals
Know someone
who needs web
development?

Haul in the
BIG
MONEY!

BIG MONEY




Share/Save/Bookmark

I just ran across an error transferring a Magento site from one host to another and wanted to share the solution here. The fix is fairly simple however the debug process to track down the fix was quite involved.

 

The Problem:

After an export/import of the Magento database I ran into the following two errors when trying to access the site.

The first error I ran into after moving the site was the following:

Notice: Undefined index:  0 in/app/code/core/Mage/Core/Model/Mysql4/Config.php on line 88 

 

The solution:

The solution to this error was to add the following two lines to the top of my sql import file.

SET FOREIGN_KEY_CHECKS = 0 ;

SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

The first line fixes a common issue with Magento when trying to export/import databases where you get an error about foreign constraints.

The second line fixes  an issue where associative id's are automatically changed by MySQL which breaks the association.The specific values that get changed and cause this error are:

Table = core_store | Values = store_id & website_id

The correct values are: 

store_id code website_id group_id name sort_order is_active
0 admin 0 0 Admin 0 1
1 default 1 1 Default Store View 0 1

Table = core_website | Values =  website_id 

The correct values are: 

website_id code name sort_order default_group_id is_default
0 admin Admin 0 0 0
1 base Main Website 0 1 1

Basically the website_id column in core_store must match thewebsite_id column in core_website and the store_id for admin in core_store must be 0. 

 

The Second Problem:

After fixing the first issue I ran into a second error message as follows:

Recoverable Error: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance 
of Mage_Core_Model_Website, null given, called in... ...app/code/core/Mage/Core/Model/App.php on 
line 341 [0] in Mage_Core_Model_Store->setWebsite(NULL) in...

 

The Second Solution:

This is because the id's from the first issue where cached so in short... delete everything in var/cache/ and you should be home free! 


Last Updated ( 11-16-2010 @ 05:53:29 )
 

Suggestion Box

Language



New Releases
Google Project Management
Piggy Banks
Wall Street Gifts
Very Large Stuffed Animals
Pony Pony Pony
Globes Globes Globes
HCG Drops
Discussion Topics
Oil Field Trash
New Jersey Pediatric Dentist
CF Dental Group