In the backend, I have got "Enable Persistence" set to "No". Still, If I use one browser to add something to cart, I can see that in the second browser after page reload. How can this work if persistent cart is disabled?
3 Answers
Persistent shopping cart isn't necessarily just the synchronization of the shopping cart experience, it is the persistence of the logged in session, meaning you don't get logged out after some period of inactivity. This always-logged-in experience (popularized by Amazon) gives the customer personalization and allows the store owner to merchandise in a more targeted fashion.
When you are actively logged in as a registered customer you utilize the same cart session and that session is shared by all devices as the records are stored in the database and are refreshed to your logged in sessions on each page load.
Update:
Your original question was 'why does my cart persist across devices even without persistent cart turned on' - which is the question I answered. Perhaps I over-simplified the feature.
So, hopefully this is to your satisfaction - having performed a code review on persistent cart in 1.8 Alpha this is the functionality introduced:
- Adds "not [username]?" to the welcome statement, before logout link
- Adds a 'remember me' checkbox to registration forms
- Provides its own customer registration forms
- Provides its own session object
- Observes login / logout
- Provides a shim between purchase and account access if the persistent login session is being used (to prevent unauthorized purchases, for instance)
- Provides emulation of quotes, customer objects to piggyback data into the regular customer session
- Provides a
synchronizePersistentOnLogout/Login
method that seems to log all browser sessions out if the customer session logs out of one browser (would appreciate some feedback here)
All of the above is to facilitate a non-expiring customer session that gives the store manager the ability to merchandise to the customer differently based on customer segment. With Enterprise Edition Banners, Customer Segments, Promotions one could provide a completely different site experience, based on customer segments alone (geographic location, items/categories purchased, total $ spend in a calendar year, etc.) that would persist to all devices.
-
Thanks but I don't quite understand what is persistent cart good for. "you don't get logged out after some period of inactivity." Is that all? Then I could raise session expiration time to achieve a similar effect.– climeMay 16, 2013 at 9:08
-
Thank you for this. I must admit, I am quite new to Magento and I don't quite understand everything you have written (e.g. "Provides its own customer registration forms") but I'll surely backereference to this when I know more.– climeMay 16, 2013 at 16:06
This is the normal behaviour of Magento session's - and depends entirely on how your session validation is configured.
Its entirely possible that you are not even logged in, but another computer/device on the same IP as you can also share your basket contents.
To disable/enable persistent on your admin configurations, you need to edit your layout file at app/design/frontend/base/default/layout/persistent.xml or of your theme layout folder and find all the action tags that are used to set template. as following:
<action method="setTemplate"><template>persistent/customer/form/login.phtml</template></action>
<action method="setTemplate"><template>persistent/customer/form/register.phtml</template></action>
<action method="setTemplate"><template>persistent/checkout/onepage/login.phtml</template></action>
<action method="setTemplate"><template>persistent/checkout/onepage/billing.phtml</template></action>
and replace them with
<action method="setTemplate" ifconfig="persistent/options/enabled"><template>persistent/customer/form/login.phtml</template></action>
<action method="setTemplate" ifconfig="persistent/options/enabled"><template>persistent/customer/form/register.phtml</template></action>
<action method="setTemplate" ifconfig="persistent/options/enabled"><template>persistent/checkout/onepage/login.phtml</template></action>
<action method="setTemplate" ifconfig="persistent/options/enabled"><template>persistent/checkout/onepage/billing.phtml</template>
after updates, please refresh your cache. Now your persistent cart will solely depend on your admin configurations.