Magento, PHP, MySQL, AJAX, Zend, cPanel or OpenSource…
How to fix Mage registry key “XXXXXX” already exists?
I got the following error message in a magento store after upgrading from 1.4.0.1 to 1.4.1.1. Though I moved products and categories from old site. And this lead me to see the error in the report directory:
Mage registry key "_resource_singleton/customer/customer_address" already exists
To fix this quickly, first, I simply commented a line in app/Mage.php file, line No.192
public static function register($key, $value, $graceful = false)
{
if (isset(self::$_registry[$key])) {
if ($graceful) {
return;
}
//self::throwException('Mage registry key "'.$key.'" already exists');
}
self::$_registry[$key] = $value;
}
Above trick will resolve the issue quickly. Though I would not recommend. So, I restored the file as it was before. Then I looked at eav_entity_type table. And noticed in entity_model field value is customer/customer_address where entity_type_code is customer_address. This value should be customer/address, changed it, wow, started to work perfectly again!
So, if you see the similar error and don’t know how to fix in database then commenting the mentioned line will definitely help.
Let me how you have fixed
| This entry was posted by admin on September 3, 2010 at 10:30 am, and is filed under General, Magento. Follow any responses to this post through RSS 2.0. You can skip to the end and leave a response. Pinging is currently not allowed. |
about 1 year ago
Thank you, it work´s great.
about 1 year ago
Thanks mate. I had the same issue myself BUT until I made a comparison with a fresh database I still didn’t managed to get it right
In the end I saw that customer/customer_address -> customer/address .
I’m not a programmer btw
about 1 year ago
Mage::unregister
about 1 year ago
I wouldn’t recommend both of your solutions! The first is a no-go. You should never touch core files and I think removing the Exception throwing is a very very bad trick…!
Thats my opinion, I don’t believe that fixes it correctly!
And I think if you change entity_type_code in database it just works fine, because somewhere in code they use ‘customer_address’ (hard coded) for registry, then they use somewhere else the value of database for registry. Now you have two different registries. No wonder it works. But again, you touched core configurations. And even if you compare this code with the others, I don’t think it should be ‘customer/address’ instead of ‘customer_address’ because they’re all wrote with an underscore. It’s just a code, so you can write it however you want
about 1 year ago
i want to know when will create this exception
about 10 months ago
Sorry, but it did not work in my case:
–
Error in file: “/var/www/clients/client1/web1/web/app/code/core/Mage/Customer/sql/customer_setup/mysql4-data-upgrade-1.4.0.0.7-1.4.0.0.8.php” – Invalid entity_type specified: customer_address
Trace:
#0 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/Resource/Setup.php(390): Mage::exception(‘Mage_Core’, ‘Error in file: …’)
#1 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/Resource/Setup.php(264): Mage_Core_Model_Resource_Setup->_modifyResourceDb(‘data-upgrade’, ’1.4.0.0.7′, ’1.4.0.0.13′)
#2 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/Resource/Setup.php(211): Mage_Core_Model_Resource_Setup->_upgradeData(’1.4.0.0.7′, ’1.4.0.0.13′)
#3 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/Resource/Setup.php(194): Mage_Core_Model_Resource_Setup->applyDataUpdates()
#4 /var/www/clients/client1/web1/web/app/code/core/Mage/Core/Model/App.php(337): Mage_Core_Model_Resource_Setup::applyAllDataUpdates()
#5 /var/www/clients/client1/web1/web/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#6 /var/www/clients/client1/web1/web/index.php(80): Mage::run(”, ‘store’)
#7 {main}
–
about 8 months ago
Instead of changing entity_type_code, I changed entity_model from customer/customer_address to customer/address, which fixed the problem.
about 8 months ago
Fine article, especially the second paragraph
Subcribed to your rss
about 8 months ago
I love http://www.magelancers.com , bookmarked for future reference
[url=http://www.buzzfeed.com/bookie/legal-steroids-prohormones-bodybuilding-supple-39dn]legal steroids[/url]
about 8 months ago
I was just seeking this info for a while. After six hours of continuous Googleing, at last I got it in your web site. I wonder what is the lack of Google strategy that do not rank this type of informative websites in top of the list. Generally the top sites are full of garbage.
about 8 months ago
http://www.magelancers.com is cool, bookmarked!
[url=http://www.buzzfeed.com/bookie/unlock-samsung-blackberry-nokia-lg-motorola-an-39dn]unlock nokia[/url]
about 8 months ago
I have to admit that i typically get bored to learn the entire thing but i feel you can add some value. Bravo !
about 5 months ago
This post is very useful for me, much appreciated!
about 5 months ago
I??m delighted that I have observed this weblog. Lastly something not a junk, which we undergo extremely frequently. The web site is lovingly serviced and stored up to date. So it need to be, thank you for sharing this with us.
about 4 months ago
I don’t believe it. This is the first error I’ve come across with Magento that was actually easy to fix, as opposed to spending hours trying to find a solution. I was getting a similar error, but with a different registry key.
Thank you for this. Saved me a buttload of time.