Technically speaking, each user has a different session. The "problem" for you is that a quote object is tied directly to the customer, not the browser session. This is necessary to have saved carts. And as @ashfame pointed out, this is a poor design decision.
Beyond this being a poor design decision though, what you want is not going to be easy (nor simple). Doing this would require massive amounts of custom code, would necessitate redesigning database schemas and refactoring tons of quote related code and logic. At the end of the day, it's going to be buggy and won't work with the customer cart functionality in the admin, since the admin was only designed to have one cart per customer.
To me, and without any context of the client needs, it sounds like you are dealing with B2B user scenarios which should be solved in other ways.
My suggestion is, go back to the drawing board. Don't try to simply bend Magento to do something like this…it will bit you in the end unless you have hundreds of man hours to throw at it and are willing to create a site which will be 100% non-upgradable without rebuilding all the custom development work. Most clients will thank you if you are willing to explain why what they want is a poor decision and instead recommend an alternative approach.
If the wrong session is used, it is because the session_name is wrong. The session name is set in Mage_Core_Model_Session_Abstract_Varien::setSessionName()
.
But after a look on the Stacktrace, I have no idea, why overwriting _construct
or even __construct
should be a problem here:
#0 Mage_Core_Model_Session_Abstract_Varien->setSessionName(frontend) called at [app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:111]
#1 Mage_Core_Model_Session_Abstract_Varien->start(frontend) called at [app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:166]
#2 Mage_Core_Model_Session_Abstract_Varien->init(core, frontend) called at [app/code/core/Mage/Core/Model/Session/Abstract.php:84]
#3 Mage_Core_Model_Session_Abstract->init(core, frontend) called at [app/code/core/Mage/Core/Model/Session.php:42]
#4 Mage_Core_Model_Session->__construct(Array ([name] => frontend)) called at [app/code/core/Mage/Core/Model/Config.php:1348]
#5 Mage_Core_Model_Config->getModelInstance(core/session, Array ([name] => frontend)) called at [app/Mage.php:462]
#6 Mage::getModel(core/session, Array ([name] => frontend)) called at [app/Mage.php:476]
#7 Mage::getSingleton(core/session, Array ([name] => frontend)) called at [app/code/core/Mage/Core/Controller/Varien/Action.php:494]
#8 Mage_Core_Controller_Varien_Action->preDispatch() called at [app/code/core/Mage/Core/Controller/Front/Action.php:64]
#9 Mage_Core_Controller_Front_Action->preDispatch() called at [app/code/core/Mage/Core/Controller/Varien/Action.php:408]
#10 Mage_Core_Controller_Varien_Action->dispatch(view) called at [app/code/core/Mage/Core/Controller/Varien/Router/Standard.php:250]
#11 Mage_Core_Controller_Varien_Router_Standard->match(Mage_Core_Controller_Request_Http Object ([] => /test.html,[] => ,[] => /test.html,[] => ,[] => ,[] => Array (),[] => catalog,[] => ,[] => Mage_Catalog,[] => ,[] => Array (),[] => Array ([0] => _GET,[1] => _POST),[] => /catalog/product/view/id/21,[] => ,[] => ,[] => catalog/product/view/id/21,[] => Array ([id] => 21),[] => ,[] => Array ([rewrite_request_path] => test.html),[] => 1,[] => catalog,[] => module,[] => product,[] => controller,[] => view,[] => action)) called at [app/code/core/Mage/Core/Controller/Varien/Front.php:176]
#12 Mage_Core_Controller_Varien_Front->dispatch() called at [app/code/core/Mage/Core/Model/App.php:354]
#13 Mage_Core_Model_App->run(Array ([scope_code] => ,[scope_type] => store,[options] => Array ())) called at [app/Mage.php:683]
#14 Mage::run(, store) called at [index.php:87]
Best Answer
Whenever the logout() function of Mage_Customer_Model_Session called then
Magento is assign the customer as guest using
$this->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
For this reason at magento,you can see *the customer as guest *. also as per as system, after fire of
customer_logout
event magento is setcustomer as guest
.So if you tried to make change then that may be not reflectIf you want to remove those assign then just rewrite
Mage_Customer_Model_Session
and remove the code:
rewrite class:
This may be help you.