Reputation: 686
I have created magento custom module using this.In this module I'm trying to use customer_save_after event.Everything was perfect but the problem came when I merged created module files with local magento. Its throwing error like Mage registry key "_singleton/customer/session" already exists.I have cleared cache and every thing but still error was not solved.Can anyone suggest me the solution for this?
Here is the error code:
a:5:{i:0;s:62:"Mage registry key "_singleton/customer/session" already exists";i:1;s:2302:"#0 /var/www/dev/app/Mage.php(222): Mage::throwException('Mage registry k...')
#1 /var/www/dev/app/Mage.php(477): Mage::register('_singleton/cust...', false)
#2 /var/www/dev/app/code/core/Mage/Checkout/Model/Cart.php(520): Mage::getSingleton('customer/sessio...')
#3 /var/www/dev/app/code/core/Mage/Checkout/Helper/Cart.php(141): Mage_Checkout_Model_Cart->getSummaryQty()
#4 /var/www/dev/app/code/core/Mage/Checkout/Block/Links.php(46): Mage_Checkout_Helper_Cart->getSummaryCount()
#5 [internal function]: Mage_Checkout_Block_Links->addCartLink()
#6 /var/www/dev/app/code/core/Mage/Core/Model/Layout.php(348): call_user_func_array(Array, Array)
#7 /var/www/dev/app/code/core/Mage/Core/Model/Layout.php(214): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#8 /var/www/dev/app/code/core/Mage/Core/Model/Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#9 /var/www/dev/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#10 /var/www/dev/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#11 /var/www/dev/app/code/core/Mage/Cms/Helper/Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#12 /var/www/dev/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#13 /var/www/dev/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#14 /var/www/dev/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Cms_IndexController->indexAction()
#15 /var/www/dev/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#16 /var/www/dev/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 /var/www/dev/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#18 /var/www/dev/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#19 /var/www/dev/index.php(87): Mage::run('', 'store')
#20 {main}";s:3:"url";s:5:"/dev/";s:11:"script_name";s:14:"/dev/index.php";s:4:"skin";s:7:"default";}
-Thanks
Upvotes: 1
Views: 3043
Reputation: 512
In the magento folder from the shell:
php -f compiler.php clear
php -f compiler.php disable
this will disable the compilation and will clear the files, after this delete content of var/cache/* and var/session/* by this command:
rm -Rf var/cache/*
rm -Rf var/session/*
Also try do disable the module in app/etc/modules/module.xml
Upvotes: -1
Reputation: 1274
When I tried to rename <module> folder
located in App/Code/Codepool/
, I got the same Error.
Looks like the name you mentioned in the xml(app/etc/modules/<somemodule.xml>
) doesn't match with the Module Folders located in the CodePool
.
Renaming the Module Folder
as Registered in the xml file
, will resolve this issue.
Upvotes: 0
Reputation: 2443
This because you already registered the same key name _singleton/customer/session.
#File: app/Mage.php// you can see below function in this file
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;
}
We can see that any object or value we’re storing in the registry is ultimately being stored in the static $_registry class variable. We can also see that before storing the value, Magento checks if it’s already set. If so, Magento will either throw an Exception (the default behavior) or gracefully return null
its already set with other value
Finally, if you want to make you variable unavailable, you can use the unregister method to remove it from the registry.
Mage::unregister('some_name');
hope this help you
Upvotes: 2