Magento: error message – Notice: Undefined index: 0 app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92
The Quick resolution to this problem it to move the database command line, and not use phpmyadmin. If you just need to fix your database keep reading.
I was moving a installation to a production server and was getting this error message: Notice: Undefined index: 0 in app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92. It took alot of searching to figure out the problem, but here is what I found. When Magento installs it sets store and website ids in the database. When transferring the database the new database did not like having an id of 0 for the admin part of the site, so it made it have an id of 2. This is what my problem was. To fix it I went into the core_store and core_website Tables and gave the admin site an id of 0. It looks like this may only affect certain versions of magento(Earlier versions). Hope this helps someone else.
P.S. I also got foreign_key_constraint errors when importing my database. To solve this disable foreign key check when you export your database. Then when you need to change the core_store and core_website id’s you will probably need to surround your sql with the following code:
set foreign_key_checks=0;
//SQL to update ids
SET FOREIGN_KEY_CHECKS=1;

58 Responses to “ Magento: error message – Notice: Undefined index: 0 app/code/core/Mage/Core/Model/Mysql4/Config.php on line 92 ”
March 23rd, 2009 at 11:28 pm
Thank you for sharing this information!
March 31st, 2009 at 10:20 am
Thanks!. Lifesaver for me
May 4th, 2009 at 4:52 am
Thanks!!!
May 6th, 2009 at 4:16 am
Thanks Mate, it saved many hours for me.
May 15th, 2009 at 1:15 am
Hello,
if you migrate your Magento Online store to another server, you have to input in your sql dump the following line:
SET SQL_MODE = NO_AUTO_VALUE_ON_ZERO;
So this error never happens
June 29th, 2009 at 1:59 am
Thanks! You saved me!!
July 16th, 2009 at 7:49 am
hey Mike, u r a life saver for me too. was stuck at this error for quite some time now. after changing the IDs, everything worked like a breeze
thanks once again!
July 30th, 2009 at 2:42 pm
I could kiss you.
Thanks a million.
September 9th, 2009 at 2:00 pm
You are a God, dude.
September 18th, 2009 at 9:46 am
They need to stop wasting our time, a few minutes an extra day of common sense would save collective thousands of hours of developer time. Its not like we asked them to not release a test suite or documentation.
October 28th, 2009 at 9:09 am
Thank you ! Quick search, quick answer, quick fix !
November 11th, 2009 at 8:32 am
You are the man – thanks a lot for this information.
December 18th, 2009 at 11:59 pm
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 38: parser error : Entity ‘trade’ not defined in /www/magento/lib/Varien/Simplexml/Config.php on line 510
Trace:
#0 /www/magento/lib/Varien/Simplexml/Config.php(510): mageCoreErrorHandler(2, ‘simplexml_load_…’, ‘/content/Hostin…’, 510, Array)
#1 /www/magento/lib/Varien/Simplexml/Config.php(498): Varien_Simplexml_Config->loadString(’loadFile(’loadModulesConfiguration(’/content/Hostin…’)
#4 /www/magento/app/code/core/Mage/Adminhtml/Model/Config.php(63): Mage_Adminhtml_Model_Config->_initSectionsAndTabs(’system.xml’)
#5 /www/magento/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php(70): Mage_Adminhtml_Model_Config->getSections()
#6 /www/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(376): Mage_Adminhtml_System_ConfigController->editAction(NULL)
#7 /www/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch()
#8 /www/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(’edit’)
#9 /www/magento/app/Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch(Object(Mage_Core_Controller_Request_Http))
#10 /www/magento/index.php(65): Mage::run()
#11 {main}
Will really really appreciate if someone can help me with getting this going. I am at the last lap of the entire project and this has put a spanner in the works. Friends please help urgently.
December 19th, 2009 at 9:52 am
Do you have any custom modules installed? Did this begin after installing something? check any config.xml and system.xml files you have modified or created.
December 22nd, 2009 at 2:30 am
Thanks a lot life saver for me
January 14th, 2010 at 10:45 pm
Hey thanks a lot.. very useful.. God will surely bless u..
February 4th, 2010 at 10:05 am
I changed the admin site to 0 in both tables but it does not work in my case. could somone help?
February 4th, 2010 at 1:03 pm
@monsbutu: are you getting this exact error message? if not you might want to post the error you are getting. Also when did this error start occurring?
February 4th, 2010 at 8:12 pm
Thank you dude, saved my life
February 10th, 2010 at 3:06 pm
Helps a lot. TY !
February 12th, 2010 at 1:46 am
Hi,
I have another solution.
First: Import only structure of tables.
Next, import data but add at the very top of your SQL script:
SET SQL_MODE = “NO_AUTO_VALUE_ON_ZERO”;
It works
March 3rd, 2010 at 3:30 am
Thanks a million. Saved my life.
March 4th, 2010 at 5:05 pm
I want to donate some money to you for this post! It was a lifesaver. BTW This post has been pirated by quite a few spammy magento sites.
March 11th, 2010 at 1:54 pm
it works!
March 24th, 2010 at 6:48 am
dankeschön!
greetings from dresden
April 12th, 2010 at 12:07 am
thank you for sharing that information! i was starting to bite my keyboard!
greetings from flensburg.
April 18th, 2010 at 3:55 am
Thanks a lot, saved me a bunch of time!
April 27th, 2010 at 2:52 pm
ur the man!!!
April 30th, 2010 at 4:48 am
Thanks!!
May 11th, 2010 at 2:22 am
great job … thanks
May 28th, 2010 at 3:45 pm
You, sir, are my new hero. Thank you!
June 20th, 2010 at 2:01 am
Wow, huge time saver … sending karma your way!
July 7th, 2010 at 5:27 am
u r my life saver dear, I Love U
July 9th, 2010 at 10:15 am
Had the problem with Magento 1.4 – found this site and the problem was solved!
Thak you very much!
July 27th, 2010 at 3:17 am
Man, you are the legend.. thanks for this stuff.. works!
August 23rd, 2010 at 7:01 am
Thanks a lot you save my week !
August 24th, 2010 at 12:51 am
This article saved me lots of hair pulling.
Thanks for taking the time to publish it!
September 8th, 2010 at 3:28 pm
Notice: Undefined index: 5200 in /app/code/core/Mage/Bundle/Model/Mysql4/Price/Index.php on line 689
I know it is in my database, but i don´t know where. It happens when we are loading the prices and inventory.
September 8th, 2010 at 7:47 pm
@Raquel – 1. What version are you using? 2.Have you migrated the database, have you always had this problem?
September 9th, 2010 at 12:26 pm
My Magento is: 1.3.2.3
We have a automate price/stock updater.
I think we miss some data.
in line 689:
if (!$salableStatus[$selection['product_id']]) {
continue;
September 9th, 2010 at 12:42 pm
@Raquel – With out digging into it, I am guessing that $salableStatus doesn’t have a key of “5200″ in the array. I would assume that this is an Indexing error. Make sure you have refreshed all your indexes(and that they complete successfully). This could be the issue.
Have you always had this problem?
September 9th, 2010 at 12:46 pm
No, started yesterday morning.
September 9th, 2010 at 2:09 pm
1. Have You tried reindexing everything?
2. did you update or change anything in the file that could have caused this?
3. did you do or change anything in the admin that could have caused this issue? such as refreshing cache, indexes, search reindexing, ect…;
4. what type of hosting do you have? shared , dedicated, other?
5. How large is your catalog.(how many products?)
September 9th, 2010 at 2:27 pm
1. How can i do this?
2. Yes, we update it.
3. yes, but the server is very slow.
4. dedicated
5. more than 5,500 items
September 9th, 2010 at 3:21 pm
I think I foud the error.
I found some crashed products.
I’m fixing them, and it’s working.
Thanks.
September 19th, 2010 at 7:46 pm
Just saved me a major headache! Cheers dude!
November 14th, 2010 at 7:14 pm
I love you.
November 22nd, 2010 at 5:11 am
Thanks a lot
December 13th, 2010 at 1:26 am
HEY, man, Thank You very much.
December 13th, 2010 at 1:27 am
^_^
December 13th, 2010 at 6:35 am
Thanks for sharing that!!!
December 23rd, 2010 at 6:12 am
10000 Thanks!!!!
December 27th, 2010 at 12:45 am
Looks like you helped a lot of people, myself included. Thanks!
January 31st, 2011 at 6:36 am
[...] dazu verschiedene Lösungen, die meistens das manuelle Editieren der betroffenen Einträge zur Folge haben. Das manuelle editieren in Datenbanken sollte man allerdings Fachleute machen lassen, da man [...]
February 15th, 2011 at 8:57 am
Fantastic! saved me hours and hours of work!
March 3rd, 2011 at 2:02 pm
Great Article, saved a lot of effort for me at a very critical time.
Thank you Mike.
March 29th, 2011 at 8:19 pm
thanks for this solution , its very much useful to me and saves my lots of time , THANKS
September 21st, 2011 at 11:49 am
Wow, thank goodness I came across this article.
I would *never* use Magento personally, because it just requires too much maintenace, and seems so fragile — even upgrading seems to break things. There are better carts out there, and it seems that most folks who use Magento just don’t want to spend money on a real cart, like SunShop by TurnkeyWebTools, or Interspire’s Shopping Cart software. I’ll gladly spend money on a solution that isn’t going to require hours upon hours of needless maintenance and labor for the most minor things. =0)
But nonetheless, I have a client who uses it, and I moved his site to a new server, and sure enough I encountered the *same* problem.
I have shell access to both servers, so I just went with moving it using mysqlimport and mysqldump and used SCP to move it from one server to another.
Now it works!
Thanks man! =0)