Cms_VisitorPreferences
The Cms_VisitorPreferences is a multi-purpose class which allows to save visitor preferences into the server session storage and load them when it is needed. Please remember that the values saved using this class are stored in the session object, and not bound to a specific customer. The server distinguishes visitors using cookies, so visitor preferences should be considered as temporary. This data storing method is reliable during a visitor browsing session, but you should not rely on it for storing important or sensitive data. Use this class for storing non critical data, for example preferred product sorting modes.
Class methods
- set($parameter_name, $value) - saves a value to the session. The $parameter_value parameter should be a string identifying the saving value. The $value parameter could be any value - a string, number or array.
- get($parameter_name[, $default = null]) - returns a value, previously saved to the session. The $parameter_value parameter should be a string identifying the saved value. You can specify a default value in the second parameter. This value will be used in case if the value with the specified name doesn't exist in the session. By default the default value is NULL.
Next: shop:payment_receipt
Previous: Phpr_Response
Return to Reference


Comments
Ash
Wednesday, September 21, 2011Using this method to store to outcome of Shop_Cart::list_active_items();, the result is a serialized version of it. However when trying to unserialize this I get the error "strlen() expects parameter 1 to be a string, array given" but if I don't unserialize it and try and use the array I get a fatal error that I can't use a string like an array!
Where do I go from there!?
Aleksey Bobkov
Wednesday, September 21, 2011@Ash - storing cart items in the visitor preferences is not usually needed. LemonStand stores cart items in session automatically. For signed in customers it saves cart items in the database.
Add your comment
Loading form...